[
  {
    "path": ".dockerignore",
    "content": "node_modules\nnpm-debug.log\nexamples\ndatabase.sqlite\nagent.yml"
  },
  {
    "path": ".github/ISSUE_TEMPLATE/bug_report.md",
    "content": "---\nname: Bug report\nabout: Create a report to help us improve\ntitle: ''\nlabels: bug\nassignees: ''\n\n---\n\n**Bug severity**\nPlease rate severity from 1-5, 1 being very minor and 5 being critical\n\n**Describe the bug**\nA clear and concise description of what the bug is.\n\n**To Reproduce**\nSteps to reproduce the behaviour:\n1. ...\n2. ...\n3. ...\n4. ...\n\n**Observed behaviour**\nA clear and concise description of what you observe.\n   \n**Expected behaviour**\nA clear and concise description of what you expected to happen.\n\n**Details**\nIf applicable, add screenshots, error messages or stack traces to help explain your problem.\n\n**Additional context**\nAdd any other context about the problem here.\n\n**Versions (please complete the following information):**\n - Veramo: [e.g. 1.3]\n - Browser [e.g. chrome, safari]\n - Node Version [e.g. 10]\n"
  },
  {
    "path": ".github/ISSUE_TEMPLATE/feature_request.md",
    "content": "---\nname: Feature request\nabout: Suggest an idea for this project\ntitle: \"[proposal]\"\nlabels: enhancement\nassignees: ''\n\n---\n\n**Is your feature request related to a problem? Please describe.**\nA clear and concise description of what the problem is. Ex. I'm always frustrated when [...]\n\n**Describe the solution you'd like**\nA clear and concise description of what you want to happen.\n\n**Describe alternatives you've considered**\nA clear and concise description of any alternative solutions or features you've considered.\n\n**Additional context**\nAdd any other context or screenshots about the feature request here.\n"
  },
  {
    "path": ".github/pull_request_template.md",
    "content": "## What issue is this PR fixing\n\nExample:\n`closes #123`\n`fixes #456`\n\nLinking to an issue provides some context and a reason for the PR to be reviewed, as well as simplifying the release\nnotes and changelogs that get generated automatically. If an issue is linked like this it will be automatically closed\nwhen the PR is merged.\n\n## What is being changed\nA clear description of what this PR brings.\n\n## Quality\nCheck all that apply:\n* [X] I want these changes to be integrated\n* [ ] I successfully ran `pnpm i`, `pnpm build`, `pnpm test`, `pnpm test:browser` locally.\n* [ ] I allow my PR to be updated by the reviewers (to speed up the review process).\n* [ ] I added unit tests.\n* [ ] I added integration tests.\n* [ ] I did not add automated tests because _________, and I am aware that a PR without tests will likely get rejected.\n\n## Details\nIf applicable, add screen captures, error messages or stack traces to help explain your problem.\n"
  },
  {
    "path": ".github/stale.yml",
    "content": "# Number of days of inactivity before an issue becomes stale\ndaysUntilStale: 60\n# Number of days of inactivity before a stale issue is closed\ndaysUntilClose: 7\n# Issues with these labels will never be considered stale\nexemptLabels:\n  - pinned\n  - security\n  - planned-feature\n# Label to use when marking an issue as stale\nstaleLabel: wontfix\n# Comment to post when marking an issue as stale. Set to `false` to disable\nmarkComment: >\n  This issue has been automatically marked as stale because it has not had\n  recent activity. It will be closed if no further activity occurs. Thank you\n  for your contributions.\n# Comment to post when closing a stale issue. Set to `false` to disable\ncloseComment: false\n"
  },
  {
    "path": ".github/workflows/build-and-test-on-pr.yml",
    "content": "name: build-test-on-pr-cached\non: [pull_request, workflow_dispatch]\npermissions:\n  contents: read\njobs:\n  build:\n    runs-on: ubuntu-latest\n    steps:\n      - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1\n        with:\n          fetch-depth: 0\n      - uses: pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061 # v4.2.0\n        with:\n          version: 10\n      - name: 'Setup Node.js with pnpm cache'\n        uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0\n        with:\n          node-version: 20\n          cache: 'pnpm'\n\n      - run: pnpm install\n      - run: pnpm build\n      - name: 'Save build output'\n        uses: actions/cache/save@9255dc7a253b0ccc959486e2bca901246202afeb # v5.0.1\n        with:\n          path: '${{ github.workspace }}'\n          key: '${{ runner.os }}-build-${{ github.sha }}-${{ github.run_id }}'\n\n  test-integration:\n    needs: build\n    runs-on: ubuntu-latest\n    strategy:\n      matrix:\n        shard: [1, 2, 3, 4, 5]\n    services:\n      postgres:\n        image: postgres:16.0\n        env:\n          POSTGRES_USER: postgres\n          POSTGRES_PASSWORD: test123\n        ports:\n          - 5432:5432\n        options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5\n    steps:\n      - uses: pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061 # v4.2.0\n        with:\n          version: 10\n      - name: 'Restore build output'\n        uses: actions/cache/restore@9255dc7a253b0ccc959486e2bca901246202afeb # v5.0.1\n        with:\n          path: '${{ github.workspace }}'\n          key: '${{ runner.os }}-build-${{ github.sha }}-${{ github.run_id }}'\n          restore-keys: '${{ runner.os }}-build-${{ github.sha }}'\n          fail-on-cache-miss: true\n      - name: 'Setup Node.js with pnpm cache'\n        uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0\n        with:\n          node-version: 20\n          cache: 'pnpm'\n      - run: pnpm install\n      - run: pnpm rebuild -r\n      - name: 'Run integration tests'\n        env:\n          INCLUDE_POSTGRES_TESTS: true\n          POSTGRES_HOST: localhost\n          POSTGRES_USER: postgres\n          POSTGRES_PASSWORD: test123\n          POSTGRES_PORT: 5432\n        run: pnpm test:integration --shard=${{ matrix.shard }}/${{ strategy.job-total }}\n      - run: mv coverage/coverage-final.json coverage/${{matrix.shard}}.json\n      - uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0\n        with:\n          name: coverage-artifacts-${{matrix.shard}}\n          path: coverage/\n\n  report-coverage:\n    runs-on: ubuntu-latest\n    needs: [test-integration]\n    steps:\n      - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1\n        with:\n          fetch-depth: 0\n      - uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0\n        with:\n          pattern: coverage-artifacts-*\n          merge-multiple: true\n          path: coverage\n      - name: Merge Code Coverage\n        run: npx nyc merge coverage/ coverage/coverage-final.json\n      - uses: codecov/codecov-action@671740ac38dd9b0130fbe1cec585b89eea48d3de # v5.5.2\n        with:\n          token: ${{ secrets.CODECOV_TOKEN }} # not required for public repos but sometimes fails without :|\n          fail_ci_if_error: true\n\n  test-browser:\n    needs: build\n    runs-on: ubuntu-latest\n    steps:\n      - uses: pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061 # v4.2.0\n        with:\n          version: 10\n      - name: 'Restore build output'\n        uses: actions/cache/restore@9255dc7a253b0ccc959486e2bca901246202afeb # v5.0.1\n        with:\n          path: '${{ github.workspace }}'\n          key: '${{ runner.os }}-build-${{ github.sha }}-${{ github.run_id }}'\n          restore-keys: '${{ runner.os }}-build-${{ github.sha }}'\n          fail-on-cache-miss: true\n      - name: 'Setup Node.js with pnpm cache'\n        uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0\n        with:\n          node-version: 20\n          cache: 'pnpm'\n      - run: pnpm install\n      - run: pnpm rebuild -r\n      - name: 'Run browser tests'\n        run: pnpm test:browser\n\n  lint-and-docs:\n    needs: build\n    runs-on: ubuntu-latest\n    steps:\n      - uses: pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061 # v4.2.0\n        with:\n          version: 10\n      - name: 'Restore build output'\n        uses: actions/cache/restore@9255dc7a253b0ccc959486e2bca901246202afeb # v5.0.1\n        with:\n          path: '${{ github.workspace }}'\n          key: '${{ runner.os }}-build-${{ github.sha }}-${{ github.run_id }}'\n          restore-keys: '${{ runner.os }}-build-${{ github.sha }}'\n          fail-on-cache-miss: true\n      - name: 'Setup Node.js with pnpm cache'\n        uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0\n        with:\n          node-version: 20\n          cache: 'pnpm'\n      - run: pnpm run lint\n      - run: pnpm run docs\n"
  },
  {
    "path": ".github/workflows/build-test-publish-on-push.yml",
    "content": "name: build-test-publish-on-push-cached\npermissions:\n  contents: read\non:\n  workflow_dispatch:\n  push:\n    branches:\n      - 'main'\n      - 'next'\n      - 'unstable'\n\njobs:\n  build:\n    runs-on: ubuntu-latest\n    steps:\n      - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1\n        with:\n          fetch-depth: 0\n          persist-credentials: false\n      - uses: pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061 # v4.2.0\n        with:\n          version: 10\n      - name: 'Setup Node.js with pnpm cache'\n        uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0\n        with:\n          node-version: 20\n          cache: 'pnpm'\n\n      - run: pnpm install\n      - run: pnpm build\n      - name: 'Save build output'\n        uses: actions/cache/save@9255dc7a253b0ccc959486e2bca901246202afeb # v5.0.1\n        with:\n          path: '${{ github.workspace }}'\n          key: '${{ runner.os }}-build-${{ github.sha }}-${{ github.run_id }}'\n\n  test-integration:\n    needs: build\n    runs-on: ubuntu-latest\n    strategy:\n      matrix:\n        shard: [ 1, 2, 3, 4, 5 ]\n    services:\n      postgres:\n        image: postgres:16.0\n        env:\n          POSTGRES_USER: postgres\n          POSTGRES_PASSWORD: test123\n        ports:\n          - 5432:5432\n        options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5\n    steps:\n      - uses: pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061 # v4.2.0\n        with:\n          version: 10\n      - name: 'Restore build output'\n        uses: actions/cache/restore@9255dc7a253b0ccc959486e2bca901246202afeb # v5.0.1\n        with:\n          path: '${{ github.workspace }}'\n          key: '${{ runner.os }}-build-${{ github.sha }}-${{ github.run_id }}'\n          restore-keys: '${{ runner.os }}-build-${{ github.sha }}'\n          fail-on-cache-miss: true\n      - name: 'Setup Node.js with pnpm cache'\n        uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0\n        with:\n          node-version: 20\n          cache: 'pnpm'\n      - run: pnpm install\n      - run: pnpm rebuild -r\n      - name: 'Run integration tests'\n        env:\n          INCLUDE_POSTGRES_TESTS: true\n          POSTGRES_HOST: localhost\n          POSTGRES_USER: postgres\n          POSTGRES_PASSWORD: test123\n          POSTGRES_PORT: 5432\n        run: pnpm test:integration --shard=${{ matrix.shard }}/${{ strategy.job-total }}\n      - run: mv coverage/coverage-final.json coverage/${{matrix.shard}}.json\n      - uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0\n        with:\n          name: coverage-artifacts-${{ matrix.shard }}\n          path: coverage/\n\n  report-coverage:\n    runs-on: ubuntu-latest\n    needs: [ test-integration ]\n    steps:\n      - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1\n        with:\n          fetch-depth: 0\n          persist-credentials: false\n      - uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0\n        with:\n          pattern: coverage-artifacts-*\n          merge-multiple: true\n          path: coverage\n      - name: Merge Code Coverage\n        run: npx nyc merge coverage/ coverage/coverage-final.json\n      - uses: codecov/codecov-action@671740ac38dd9b0130fbe1cec585b89eea48d3de # v5.5.2\n        with:\n          token: ${{ secrets.CODECOV_TOKEN }} # not required for public repos but sometimes fails without :|\n          fail_ci_if_error: false\n\n  test-browser:\n    needs: build\n    runs-on: ubuntu-latest\n    steps:\n      - uses: pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061 # v4.2.0\n        with:\n          version: 10\n      - name: 'Restore build output'\n        uses: actions/cache/restore@9255dc7a253b0ccc959486e2bca901246202afeb # v5.0.1\n        with:\n          path: '${{ github.workspace }}'\n          key: '${{ runner.os }}-build-${{ github.sha }}-${{ github.run_id }}'\n          restore-keys: '${{ runner.os }}-build-${{ github.sha }}'\n          fail-on-cache-miss: true\n      - name: 'Setup Node.js with pnpm cache'\n        uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0\n        with:\n          node-version: 20\n          cache: 'pnpm'\n      - run: pnpm install\n      - run: pnpm rebuild -r\n      - name: 'Run browser tests'\n        run: pnpm test:browser\n\n  lint-and-docs:\n    needs: build\n    runs-on: ubuntu-latest\n    steps:\n      - uses: pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061 # v4.2.0\n        with:\n          version: 10\n      - name: 'Restore build output'\n        uses: actions/cache/restore@9255dc7a253b0ccc959486e2bca901246202afeb # v5.0.1\n        with:\n          path: '${{ github.workspace }}'\n          key: '${{ runner.os }}-build-${{ github.sha }}-${{ github.run_id }}'\n          restore-keys: '${{ runner.os }}-build-${{ github.sha }}'\n          fail-on-cache-miss: true\n      - name: 'Setup Node.js with pnpm cache'\n        uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0\n        with:\n          node-version: 20\n          cache: 'pnpm'\n      - run: pnpm run lint\n      - run: pnpm run docs\n\n  publish:\n    permissions:\n      contents: write\n    needs:\n      - build\n      - test-integration\n      - test-browser\n      - lint-and-docs\n    env:\n      NPM_TOKEN: ${{secrets.NPM_TOKEN}}\n      NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}\n      GH_TOKEN: ${{secrets.GH_TOKEN}}\n      GITHUB_TOKEN: ${{secrets.GH_TOKEN}}\n      GH_USER: ${{secrets.GH_USER}}\n      GH_EMAIL: ${{secrets.GH_EMAIL}}\n    runs-on: ubuntu-latest\n    steps:\n      - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1\n        with:\n          fetch-depth: 0\n          token: ${{secrets.GH_TOKEN}}\n      - uses: pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061 # v4.2.0\n        with:\n          version: 10\n      - name: 'Setup Node.js with pnpm cache'\n        uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0\n        with:\n          node-version: 20\n          cache: 'pnpm'\n\n      - name: 'Restore build output'\n        uses: actions/cache/restore@9255dc7a253b0ccc959486e2bca901246202afeb # v5.0.1\n        with:\n          path: '${{ github.workspace }}'\n          key: '${{ runner.os }}-build-${{ github.sha }}-${{ github.run_id }}'\n          restore-keys: '${{ runner.os }}-build-${{ github.sha }}'\n          fail-on-cache-miss: true\n\n      - name: 'Setup git coordinates'\n        run: |\n          git remote set-url origin https://${{secrets.GH_USER}}:${{secrets.GH_TOKEN}}@github.com/decentralized-identity/veramo.git\n          git config user.name $GH_USER\n          git config user.email $GH_EMAIL\n\n      - name: 'Setup npm registry'\n        run: |\n          echo \"@veramo:registry=https://registry.npmjs.org/\" > .npmrc\n          echo \"registry=https://registry.npmjs.org/\" >> .npmrc\n          echo \"//registry.npmjs.org/:_authToken=$NPM_TOKEN\" >> .npmrc\n          npm whoami\n\n      - name: 'Publish @latest when on main'\n        if: github.ref == 'refs/heads/main'\n        run: pnpm publish:latest\n\n      - name: 'Publish @next when on next'\n        if: github.ref == 'refs/heads/next'\n        run: pnpm publish:next\n\n      - name: 'Publish @unstable when on unstable branch'\n        if: github.ref == 'refs/heads/unstable'\n        run: pnpm publish:unstable\n"
  },
  {
    "path": ".github/workflows/scorecard.yml",
    "content": "# This workflow uses actions that are not certified by GitHub. They are provided\n# by a third-party and are governed by separate terms of service, privacy\n# policy, and support documentation.\n\nname: Scorecard supply-chain security\non:\n  # For Branch-Protection check. Only the default branch is supported. See\n  # https://github.com/ossf/scorecard/blob/main/docs/checks.md#branch-protection\n  branch_protection_rule:\n  # To guarantee Maintained check is occasionally updated. See\n  # https://github.com/ossf/scorecard/blob/main/docs/checks.md#maintained\n  schedule:\n    - cron: '20 9 * * 5'\n  push:\n    branches: [ \"next\" ]\n\n# Declare default permissions as read only.\npermissions: read-all\n\njobs:\n  analysis:\n    name: Scorecard analysis\n    runs-on: ubuntu-latest\n    # `publish_results: true` only works when run from the default branch. conditional can be removed if disabled.\n    if: github.event.repository.default_branch == github.ref_name || github.event_name == 'pull_request'\n    permissions:\n      # Needed to upload the results to code-scanning dashboard.\n      security-events: write\n      # Needed to publish results and get a badge (see publish_results below).\n      id-token: write\n      # Uncomment the permissions below if installing in a private repository.\n      # contents: read\n      # actions: read\n\n    steps:\n      - name: \"Checkout code\"\n        uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1\n        with:\n          persist-credentials: false\n\n      - name: \"Run analysis\"\n        uses: ossf/scorecard-action@4eaacf0543bb3f2c246792bd56e8cdeffafb205a # v2.4.3\n        with:\n          results_file: results.sarif\n          results_format: sarif\n          # (Optional) \"write\" PAT token. Uncomment the `repo_token` line below if:\n          # - you want to enable the Branch-Protection check on a *public* repository, or\n          # - you are installing Scorecard on a *private* repository\n          # To create the PAT, follow the steps in https://github.com/ossf/scorecard-action?tab=readme-ov-file#authentication-with-fine-grained-pat-optional.\n          # repo_token: ${{ secrets.SCORECARD_TOKEN }}\n\n          # Public repositories:\n          #   - Publish results to OpenSSF REST API for easy access by consumers\n          #   - Allows the repository to include the Scorecard badge.\n          #   - See https://github.com/ossf/scorecard-action#publishing-results.\n          # For private repositories:\n          #   - `publish_results` will always be set to `false`, regardless\n          #     of the value entered here.\n          publish_results: true\n\n          # (Optional) Uncomment file_mode if you have a .gitattributes with files marked export-ignore\n          # file_mode: git\n\n      # Upload the results as artifacts (optional). Commenting out will disable uploads of run results in SARIF\n      # format to the repository Actions tab.\n      - name: \"Upload artifact\"\n        uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0\n        with:\n          name: SARIF file\n          path: results.sarif\n          retention-days: 5\n\n      # Upload the results to GitHub's code scanning dashboard (optional).\n      # Commenting out will disable upload of results to your repo's Code Scanning dashboard\n      - name: \"Upload to code-scanning\"\n        uses: github/codeql-action/upload-sarif@cdefb33c0f6224e58673d9004f47f7cb3e328b89 # v4.31.10\n        with:\n          sarif_file: results.sarif\n"
  },
  {
    "path": ".github/workflows/veramo-website.yml",
    "content": "name: Trigger veramo-website build\npermissions:\n  contents: read\non:\n  workflow_dispatch:\n  push:\n    branches:\n      - \"main\"\njobs:\n  dispatch:\n    permissions:\n      contents: write\n      actions: write\n    runs-on: ubuntu-latest\n    steps:\n      - run: |\n          curl -X POST \\\n            -H 'Authorization: token ${{ secrets.GH_TOKEN }}' \\\n            -H \"Accept: application/vnd.github.v3+json\" \\\n            https://api.github.com/repos/veramolabs/veramo-website/dispatches \\\n            -d '{\"event_type\":\"deploy_website\"}'\n"
  },
  {
    "path": ".gitignore",
    "content": ".idea\n.DS_STORE\n.eslintcache\n*.swp\n*~\n/examples/*/node_modules/\n/examples/*/build/\n/docs\n/report\n/node_modules\nwebsite/node_modules\n\n**/build/\n**/*.log\n/packages/*/build/\n/packages/*/api/*.api.json\n/packages/*/api/*.api.md\n/packages/*/coverage/\n/packages/*/node_modules/\ncoverage\n\n.npmrc\n\nnpm-debug.log\nnpm-debug.log*\nlerna-debug.log\n\n*.tsbuildinfo\nidentity-store.json\nkey-store.json\n*.sqlite\n\n.vscode/\nnode_modules\ntemp/\ntmp/\n\nagent.yml\ndata\n.vscode-upload.json\n\nlocal-database*.json\n"
  },
  {
    "path": ".prettierignore",
    "content": "coverage\nexamples\n**/build\ndocs\nreport\n*.json\n*.md"
  },
  {
    "path": ".prettierrc",
    "content": "{\n  \"jsxBracketSameLine\": false,\n  \"trailingComma\": \"all\",\n  \"tabWidth\": 2,\n  \"printWidth\": 110,\n  \"singleQuote\": true,\n  \"semi\": false\n}\n"
  },
  {
    "path": "AWESOME.md",
    "content": "# Awesome list of awesome Veramo projects\n\nThis is a list of projects using or enhancing the Veramo framework. This is meant to help discover interesting projects.\nPlease help us improve the contents or format of this list by creating a pull request.\n\n## Projects\n\n  * [Sphereon SSI SDK](https://github.com/Sphereon-Opensource/ssi-sdk)  \n  * [Data Manager plugin](https://github.com/blockchain-lab-um/masca/tree/develop/packages/datamanager)\n  * [SSI using Metamask snap (Masca)](https://masca.io/)\n  * [SSI using Metamask snap (Identify)](https://github.com/tuum-tech/identify/tree/main/packages/snap)\n  * [OID4VC issuer and verifier](https://github.com/blockchain-lab-um/oid4vc-monorepo)\n  * [Plugin for did:cheqd](https://github.com/cheqd/did-provider-cheqd)\n  * [Spherity VC revocation plugin based on ethereum](https://github.com/spherity/ethr-revocation-registry-veramo-plugin)\n  * [BBS+ issuer](https://github.com/pcibraro/veramo-bls-issuer/tree/main)\n  * [RN app with credential signing](https://github.com/symfoni/identity-wallet)\n  * [ID Pocket digital identity wallet](https://rktechworks.com/idpocket)\n  * [Spherity Aries RFCs Veramo Plugin](https://github.com/spherity/aries-rfcs-veramo-plugin)\n  * add your own project here!\n\n## Disclaimer\n\nThe compatibility of these projects with the latest version of Veramo is not guaranteed.\nThis list does not represent an endorsement of quality or security of these projects.\n"
  },
  {
    "path": "CHANGELOG.md",
    "content": "# Change Log\n\nAll notable changes to this project will be documented in this file.\nSee [Conventional Commits](https://conventionalcommits.org) for commit guidelines.\n\n# [7.0.0](https://github.com/decentralized-identity/veramo/compare/v6.0.2...v7.0.0) (2026-02-11)\n\n\n### Bug Fixes\n\n* **ci:** update jest puppeteer config ([#1437](https://github.com/decentralized-identity/veramo/issues/1437)) ([dbb2880](https://github.com/decentralized-identity/veramo/commit/dbb28800d04fd5cf330318cc678664570682856b))\n* **cli:** update @veramo/cli setup and credential example for ICredentialProvider refactor ([#1489](https://github.com/decentralized-identity/veramo/issues/1489)) ([0fa0bdc](https://github.com/decentralized-identity/veramo/commit/0fa0bdcb8baab0fa8097eb5fa8a112974c998e6b)), closes [#1488](https://github.com/decentralized-identity/veramo/issues/1488) [#1395](https://github.com/decentralized-identity/veramo/issues/1395)\n* **core-types:** regenerate plugin schema ([#1416](https://github.com/decentralized-identity/veramo/issues/1416)) ([01de67d](https://github.com/decentralized-identity/veramo/commit/01de67df220a67fa79584f84ffe58f229a6395b7))\n* **core-types:** regenerate schema ([#1396](https://github.com/decentralized-identity/veramo/issues/1396)) ([925fd81](https://github.com/decentralized-identity/veramo/commit/925fd8116b134da0552585ed3b3de556b10ce9ca))\n* **credential-status:** plugin class missing OpenAPI schema property ([#1427](https://github.com/decentralized-identity/veramo/issues/1427)) ([06882b9](https://github.com/decentralized-identity/veramo/commit/06882b9db64f153f1a7c550bf54b655c70697165))\n* **data-store:** replace typeOrm findOne queries including relations with find ([#1400](https://github.com/decentralized-identity/veramo/issues/1400)) ([034afc4](https://github.com/decentralized-identity/veramo/commit/034afc430225aef98ecdf93214b75d049ebcb9d7))\n* **data-store:** validate sorted queries in data store ([#1482](https://github.com/decentralized-identity/veramo/issues/1482)) ([067e39d](https://github.com/decentralized-identity/veramo/commit/067e39dd76f11ee2d25b99c8361d4f02a4223e3b))\n* **deps:** bump ethr-did-resolver to v11 ([#1422](https://github.com/decentralized-identity/veramo/issues/1422)) ([2f0b06d](https://github.com/decentralized-identity/veramo/commit/2f0b06ddcce87dfeea1d5ab843eb33276dac071d))\n* **deps:** update dependency @noble/ciphers to v1 ([#1419](https://github.com/decentralized-identity/veramo/issues/1419)) ([b6363a1](https://github.com/decentralized-identity/veramo/commit/b6363a169b66b71e5051ebe1029121e3e1ce8f76))\n* **deps:** update dependency @stablelib/aes to v2 ([018e189](https://github.com/decentralized-identity/veramo/commit/018e189f322e713984419666dc92b6cb470ef4a0))\n* **deps:** update dependency @stablelib/aes-kw to v2 ([02f2008](https://github.com/decentralized-identity/veramo/commit/02f200855c61237e724222f3430d20d3e0a878c4))\n* **deps:** update dependency ts-json-schema-generator to v2 ([e690f3c](https://github.com/decentralized-identity/veramo/commit/e690f3c44b6f8e07e64ae612f69c36931b638846))\n* **deps:** update dependency uuid to v11 ([#1431](https://github.com/decentralized-identity/veramo/issues/1431)) ([6ad84d9](https://github.com/decentralized-identity/veramo/commit/6ad84d91f02794e741e4b770e29e1ee9a93edcfb))\n* **deps:** update devdeps and bump typeorm to 0.3.20 ([#1272](https://github.com/decentralized-identity/veramo/issues/1272)) ([7d17f37](https://github.com/decentralized-identity/veramo/commit/7d17f37ea7cc4e73a8cdae028681ae1be5c4d11c))\n* **deps:** Update did-vc-libraries ([cf45ff8](https://github.com/decentralized-identity/veramo/commit/cf45ff8c7e017bf1c1d3a223faded851fde2ae30))\n* **deps:** Update did-vc-libraries ([#1439](https://github.com/decentralized-identity/veramo/issues/1439)) ([0056388](https://github.com/decentralized-identity/veramo/commit/00563885b5086787d69ff6d289e93d5556f0c989))\n* **deps:** update react monorepo to v19 ([#1443](https://github.com/decentralized-identity/veramo/issues/1443)) ([3fab85f](https://github.com/decentralized-identity/veramo/commit/3fab85f5189301d29b24feea5772ec022a9a8329))\n* **did-comm:** remove isomorphic-webcrypto dependency ([#1401](https://github.com/decentralized-identity/veramo/issues/1401)) ([85cc1ce](https://github.com/decentralized-identity/veramo/commit/85cc1ce1d567afcbc42e0fd89eb2515505044c83)), closes [#1381](https://github.com/decentralized-identity/veramo/issues/1381) [#1387](https://github.com/decentralized-identity/veramo/issues/1387)\n* **key-manager:** handling of `kid` param when creating keys ([#1492](https://github.com/decentralized-identity/veramo/issues/1492)) ([4c52549](https://github.com/decentralized-identity/veramo/commit/4c52549daa215fe3b791d56a156f88144d11733e))\n* **remote-server:** fix for code scanning alert [#17](https://github.com/decentralized-identity/veramo/issues/17): Information exposure through a stack trace ([#1467](https://github.com/decentralized-identity/veramo/issues/1467)) ([833c580](https://github.com/decentralized-identity/veramo/commit/833c5809e0db3001d4195a99015f82deaa740d23))\n* **utils:** fix inconsistent DID parameter handling ([#1466](https://github.com/decentralized-identity/veramo/issues/1466)) ([0bb103f](https://github.com/decentralized-identity/veramo/commit/0bb103f0c8c16bcbaace68b34bbb33c424b6b2ce))\n\n\n### Features\n\n* **core-types:** allow key type and algorithm extension with loose autocomplete ([#1464](https://github.com/decentralized-identity/veramo/issues/1464)) ([43d8dbf](https://github.com/decentralized-identity/veramo/commit/43d8dbf4d2fb146acf9c4d2b5578e9b8e74b4045))\n* **credential-w3c:** added support bbs proofformat ([#1383](https://github.com/decentralized-identity/veramo/issues/1383)) ([83cc115](https://github.com/decentralized-identity/veramo/commit/83cc1156cb37cafd8489aa24cff690dca741d3d7))\n* **credential-w3c:** refactor the ICredentialProvider API ([#1488](https://github.com/decentralized-identity/veramo/issues/1488)) ([cbd848d](https://github.com/decentralized-identity/veramo/commit/cbd848d4ce2b52497d99d335f1c93bd8b005cdb2))\n* **credential-w3c:** remove hardcoded proof formats ([#1395](https://github.com/decentralized-identity/veramo/issues/1395)) ([5b7d3fa](https://github.com/decentralized-identity/veramo/commit/5b7d3fad7d2ada4954f8020a6474df13d9fe51dc))\n* **did-manager:** add 'isLocal' in 'options' to only modify DIDStore ([#1452](https://github.com/decentralized-identity/veramo/issues/1452)) ([94da414](https://github.com/decentralized-identity/veramo/commit/94da414f0b1a9fe7b837faf01749191176826af1))\n* **did-provider-ethr:** add signOnly flag and logic for add/remove key/service ([#1389](https://github.com/decentralized-identity/veramo/issues/1389)) ([2110590](https://github.com/decentralized-identity/veramo/commit/211059019f8bb3b282c4ca5f59117970cfdd9b0a))\n* improve key creation/import options when creating identifiers ([#1423](https://github.com/decentralized-identity/veramo/issues/1423)) ([12aa854](https://github.com/decentralized-identity/veramo/commit/12aa854baa384805f4cae6360720f2e9a5a484aa))\n* **key-manager:** allow user defined kid on keyManagerCreate ([#1426](https://github.com/decentralized-identity/veramo/issues/1426)) ([0784df0](https://github.com/decentralized-identity/veramo/commit/0784df09a38a10cd66a83485e047770b427d8648)), closes [#1353](https://github.com/decentralized-identity/veramo/issues/1353)\n\n\n### Reverts\n\n* Revert \"chore(ci): fix jest call on GH workflow\" ([f5e14b0](https://github.com/decentralized-identity/veramo/commit/f5e14b0b4523771b9018bce9b229217bfe505135))\n* Revert \"chore(ci): npx install puppeteer browsers before test\" ([d5ff2e3](https://github.com/decentralized-identity/veramo/commit/d5ff2e37c61f816b1e98a9ded110bb416518bd1f))\n\n\n### BREAKING CHANGES\n\n* **credential-w3c:** This changeset, along with the previous changes in #1395 modify the CredentialPlugin to support extensibility without modifications to the veramo repository. This plugin now acts as an orchestrator for other ICredentialProvider implementations that provide the actual support for various verifiable data formats. ICredentialProvider implementations can be implemented externally and used with this plugin.\n* **credential-w3c:** The credential plugins specializing in JSON-LD / EIP712 are no longer top level veramo plugins but are now managed by the `@veramo/credential-w3c` plugin which will be able to use multiple proof formats and multiplex accordingly. The constructor for the `CredentialPlugin` has changed to accept different implementations of proof formats.\n\n\n\n\n\n## [6.0.2](https://github.com/decentralized-identity/veramo/compare/v6.0.1...v6.0.2) (2026-01-16)\n\n\n### Bug Fixes\n\n* **data-store:** validate sorted queries in data store ([#1482](https://github.com/decentralized-identity/veramo/issues/1482)) ([0807612](https://github.com/decentralized-identity/veramo/commit/080761254fba065c30989793dc14aec68eb5e677))\n\n\n\n\n\n## [6.0.1](https://github.com/decentralized-identity/veramo/compare/v6.0.0...v6.0.1) (2026-01-16)\n\n\n### Bug Fixes\n\n* **ci:** update jest puppeteer config ([#1437](https://github.com/decentralized-identity/veramo/issues/1437)) ([437ecc5](https://github.com/decentralized-identity/veramo/commit/437ecc5e04a16d7eb0407b4e7b749461eaa52e6c))\n\n\n\n\n\n# [6.0.0](https://github.com/decentralized-identity/veramo/compare/v5.6.0...v6.0.0) (2024-04-02)\n\n\n### Bug Fixes\n\n* address edge case when getting DIDDoc component ([#1365](https://github.com/decentralized-identity/veramo/issues/1365)) ([1694de1](https://github.com/decentralized-identity/veramo/commit/1694de11ba2f84a5d396f0a1256c4b18ab66b41a))\n* **cli:** remove `revocable` and `send` options from credential create command ([#1345](https://github.com/decentralized-identity/veramo/issues/1345)) ([e1beeaf](https://github.com/decentralized-identity/veramo/commit/e1beeafb289946ee46ce4bacfbd44544b1a5d3d5)), closes [#1342](https://github.com/decentralized-identity/veramo/issues/1342)\n* **cli:** remove interactive prompting on CLI execute command ([#1347](https://github.com/decentralized-identity/veramo/issues/1347)) ([5accc6b](https://github.com/decentralized-identity/veramo/commit/5accc6b60f8a69155842eaeb5aed80fb65d154a1)), closes [#1281](https://github.com/decentralized-identity/veramo/issues/1281)\n* **credential-ld:** let verifiers use all supported verification methods ([#1331](https://github.com/decentralized-identity/veramo/issues/1331)) ([aa95af0](https://github.com/decentralized-identity/veramo/commit/aa95af00ce755ae0022b4b17ae8c996e0b970842)), closes [#1329](https://github.com/decentralized-identity/veramo/issues/1329)\n* **credential-w3c:** forward DID resolution options to the resolver ([#1344](https://github.com/decentralized-identity/veramo/issues/1344)) ([0c22cc6](https://github.com/decentralized-identity/veramo/commit/0c22cc6a79e974214500e4440b0ea2977012377d)), closes [#1343](https://github.com/decentralized-identity/veramo/issues/1343)\n* **data-store-json:** order credentials with weird issuanceDate ([#1273](https://github.com/decentralized-identity/veramo/issues/1273)) ([28c65f7](https://github.com/decentralized-identity/veramo/commit/28c65f71b4a4110d422bbc2a13fff32ee923d6ec))\n* **data-store:** return unique credentials for `dataStoreORMGetVerifiableCredentialsByClaims` ([#1299](https://github.com/decentralized-identity/veramo/issues/1299)) ([5aa97a2](https://github.com/decentralized-identity/veramo/commit/5aa97a2dcda2b64989ac178119f00cb0ab213773)), closes [#1285](https://github.com/decentralized-identity/veramo/issues/1285)\n* **deps:** add missing ethers dependency to each relevant modules ([#1304](https://github.com/decentralized-identity/veramo/issues/1304)) ([2157e70](https://github.com/decentralized-identity/veramo/commit/2157e702507d8961263723ff67eaeb88ea1e8621)), closes [#1295](https://github.com/decentralized-identity/veramo/issues/1295)\n* **deps:** bump ethr-did-resolver ([#1278](https://github.com/decentralized-identity/veramo/issues/1278)) ([b6c54cd](https://github.com/decentralized-identity/veramo/commit/b6c54cd988ce0cf2e1604e8dc5379db59013579a))\n* **deps:** update dependency @metamask/eth-sig-util to v7 ([#1258](https://github.com/decentralized-identity/veramo/issues/1258)) ([ba88d6b](https://github.com/decentralized-identity/veramo/commit/ba88d6b3ccfca28a1805906677f151951c3f0fbf))\n* **deps:** Update dependency did-jwt-vc to v3.2.9 ([80272ca](https://github.com/decentralized-identity/veramo/commit/80272ca6d27fbce782bb85a855439273aff491c6))\n* **deps:** update dependency ethr-did-resolver to v10 ([#1291](https://github.com/decentralized-identity/veramo/issues/1291)) ([99c53e5](https://github.com/decentralized-identity/veramo/commit/99c53e52d3e5f5f9c50d7fc20775e519c2e75589)), closes [#1295](https://github.com/decentralized-identity/veramo/issues/1295)\n* **deps:** Update dependency ethr-did-resolver to v10.1.5 ([07c982f](https://github.com/decentralized-identity/veramo/commit/07c982f6f63a1d6e1f51a1be358d7a86100790dc))\n* **deps:** Update dependency ethr-did-resolver to v9 ([533a9e6](https://github.com/decentralized-identity/veramo/commit/533a9e6870d5a3479a3c61d7d5b85386b706a2ef))\n* **deps:** update dependency multiformats to v13 ([c384fb9](https://github.com/decentralized-identity/veramo/commit/c384fb92c628bf700b51f2549532e38aa39e1073))\n* **deps:** Update devDeps ([e674c58](https://github.com/decentralized-identity/veramo/commit/e674c58ebf1b79779ee3da3597dc5dec222f97ac))\n* **deps:** Update did-vc-libraries ([ba966d5](https://github.com/decentralized-identity/veramo/commit/ba966d5fe450145f51e9c9b46f8aa53f74b117d2))\n* **deps:** Update did-vc-libraries ([01c01d5](https://github.com/decentralized-identity/veramo/commit/01c01d5a8fd1c0ce3e065943a37440744a378dc5))\n* **deps:** Update did-vc-libraries ([e2e794f](https://github.com/decentralized-identity/veramo/commit/e2e794f968697ac44744903ae5df73f97cf3bd64))\n* **deps:** upgrade ethers and did-provider-ethr for sepolia support ([#1306](https://github.com/decentralized-identity/veramo/issues/1306)) ([ac1b620](https://github.com/decentralized-identity/veramo/commit/ac1b62073c2f4688faa88f742483a615dc466596))\n* **did-provider-key:** align did:key resolver to spec ([#1332](https://github.com/decentralized-identity/veramo/issues/1332)) ([8e3b94c](https://github.com/decentralized-identity/veramo/commit/8e3b94cf997619d7adcb5cb8827e0f55ff88cdb5)), closes [#1330](https://github.com/decentralized-identity/veramo/issues/1330)\n* export const plugin schemas instead of defaults ([#1327](https://github.com/decentralized-identity/veramo/issues/1327)) ([7896cea](https://github.com/decentralized-identity/veramo/commit/7896ceaf2c79993eee44e46950814bea74bfe647)), closes [#1318](https://github.com/decentralized-identity/veramo/issues/1318) [#1317](https://github.com/decentralized-identity/veramo/issues/1317) [#1315](https://github.com/decentralized-identity/veramo/issues/1315)\n* regenerate schema ([#1260](https://github.com/decentralized-identity/veramo/issues/1260)) ([5b198ec](https://github.com/decentralized-identity/veramo/commit/5b198ec816babd7eee37ca11e83fb0e595bdc759))\n* **selective-disclosure:** deprecate the uPort SelectiveDisclosure plugin ([#1307](https://github.com/decentralized-identity/veramo/issues/1307)) ([71e313f](https://github.com/decentralized-identity/veramo/commit/71e313f894baaad08bf322f56b36d92d7c667ba9))\n* **utils:** bump did-jwt to 7.4.1 and reuse key conversion code from it ([#1261](https://github.com/decentralized-identity/veramo/issues/1261)) ([fb192e7](https://github.com/decentralized-identity/veramo/commit/fb192e72a0bcd38d97b14e9d584c1770961d88df)), closes [#1248](https://github.com/decentralized-identity/veramo/issues/1248) [#1245](https://github.com/decentralized-identity/veramo/issues/1245)\n* **utils:** get chainId for any did method ([#1334](https://github.com/decentralized-identity/veramo/issues/1334)) ([d5375bd](https://github.com/decentralized-identity/veramo/commit/d5375bd03e814a2d3fcd96274607f880db77fbe3))\n* **utils:** use synchronous version of sha256 digest for CID ([#1253](https://github.com/decentralized-identity/veramo/issues/1253)) ([2e3972c](https://github.com/decentralized-identity/veramo/commit/2e3972c757f5226ea92874da4598b75ebd7a269c)), closes [#1239](https://github.com/decentralized-identity/veramo/issues/1239)\n\n\n### chore\n\n* **deps:** bump ethers ([#1242](https://github.com/decentralized-identity/veramo/issues/1242)) ([fbf5c69](https://github.com/decentralized-identity/veramo/commit/fbf5c69b8f747f37e60e98329a0dd0a2ba0b262e))\n\n\n### Code Refactoring\n\n* generate plugin schemas as TS instead of JSON ([#1315](https://github.com/decentralized-identity/veramo/issues/1315)) ([65c2d4b](https://github.com/decentralized-identity/veramo/commit/65c2d4bc814daa9a3a89f4f7b8e8c6973b8ce2f0)), closes [#1254](https://github.com/decentralized-identity/veramo/issues/1254)\n\n\n### Features\n\n* add Multikey support ([#1316](https://github.com/decentralized-identity/veramo/issues/1316)) ([165de35](https://github.com/decentralized-identity/veramo/commit/165de3549ccfd3d7c84514608ac3ea9e56a7b807))\n* **cli:** add support for did:jwk and did:peer to CLI ([#1320](https://github.com/decentralized-identity/veramo/issues/1320)) ([3ac343e](https://github.com/decentralized-identity/veramo/commit/3ac343e52dbd744c137bbe610cba9f5409a6100c))\n* **coordinate-mediation:** implement did-comm coordinate-mediation v3.0 ([#1282](https://github.com/decentralized-identity/veramo/issues/1282)) ([462735d](https://github.com/decentralized-identity/veramo/commit/462735d138bc4984c0fcf3f72ca7d49e3187ceb7))\n* **core-types:** add hash to TCredentialColumns ([#1259](https://github.com/decentralized-identity/veramo/issues/1259)) ([306a398](https://github.com/decentralized-identity/veramo/commit/306a3987a5d5017a9aa78f7f3de71bfceb333401))\n* **credential-w3c:** list usable proof formats for an `IIdentifier` ([#1268](https://github.com/decentralized-identity/veramo/issues/1268)) ([e94aaf2](https://github.com/decentralized-identity/veramo/commit/e94aaf213e518035c72a2bd5eac0495b8659d241))\n* **data-store:** use IPFS CID instead of hex blake2 hashes for credential IDs ([#1239](https://github.com/decentralized-identity/veramo/issues/1239)) ([acc47e6](https://github.com/decentralized-identity/veramo/commit/acc47e615a8758925badeb464392cbbe5a20cbc4))\n* **did-comm:** Improve DIDComm Service compatibility ([#1340](https://github.com/decentralized-identity/veramo/issues/1340)) ([6df704c](https://github.com/decentralized-identity/veramo/commit/6df704c769d49fb399f515f102a41736a678070d))\n* **did-comm:** returnMessage from sendDIDCommMessage() when available ([#1283](https://github.com/decentralized-identity/veramo/issues/1283)) ([f7a3851](https://github.com/decentralized-identity/veramo/commit/f7a385157415e194820c181cf9091243a3f6b131))\n* **did-manager:** matching DIDs by alias should not depend on the provider ([#1218](https://github.com/decentralized-identity/veramo/issues/1218)) ([bfdfc4c](https://github.com/decentralized-identity/veramo/commit/bfdfc4c4aa58f4a182d2f3aad8ea6303efb10f42)), closes [#1215](https://github.com/decentralized-identity/veramo/issues/1215)\n* **utils:** export createJWK ([#1325](https://github.com/decentralized-identity/veramo/issues/1325)) ([610ee66](https://github.com/decentralized-identity/veramo/commit/610ee6603a3ee6c4d37a36eb0f700e803beca786)), closes [#1324](https://github.com/decentralized-identity/veramo/issues/1324)\n* **utils:** move JWK converter to utils package ([#1298](https://github.com/decentralized-identity/veramo/issues/1298)) ([fc94764](https://github.com/decentralized-identity/veramo/commit/fc9476490d06243b9ad77592f3e1406c5b6563ce))\n\n\n### BREAKING CHANGES\n\n* **did-comm:** the DIDComm Message structure has changed. The message can now specify multiple recipients in the `to` property.\n* **utils:** The `getChainIdForDidEthr` method has been renamed to `getChainId`\n* The `plugin.schema.json` files are now generated as `plugin.schema.ts`.\n* **did-comm:** the return type of `IDIDComm.sendDIDCommMessage()` has changed from a string representing the transport ID to an object that may include a `returnMessage` property along with a `transportId` property.\n* **did-manager:** The behavior of `DIDManager` has changed when working with `alias`. It is mostly ignoring `provider` unless it is used to create new identifiers. `AbstractDIDStore` APIs have been adapted and implementations have changed.\n* **deps:** now using ethers v6 as a dependency which may need extra attention when merging. The output of `eth_signTransaction` algorithms may be slightly different as transactions are by default infered as type 1 (EIP1559)\n* **data-store:** going forward credentials and presentations will have a new ID format in the database. If you are relying on the IDs assigned internally by `@veramo/data-store` to work with your credentials, you will have to recompute them using the `@veramo/utils#computeEntryHash` method.\n\n\n\n\n\n# [5.6.0](https://github.com/decentralized-identity/veramo/compare/v5.5.3...v5.6.0) (2024-01-16)\n\n\n### Features\n\n* **remote-client:** allow dynamic headers param for AgentRestClient constructor ([#1314](https://github.com/decentralized-identity/veramo/issues/1314)) ([1b8a0a2](https://github.com/decentralized-identity/veramo/commit/1b8a0a2718dd63492ad3a312a6ebe5f6e7849935)), closes [#1313](https://github.com/decentralized-identity/veramo/issues/1313)\n\n\n\n\n\n## [5.5.3](https://github.com/decentralized-identity/veramo/compare/v5.5.2...v5.5.3) (2023-10-09)\n\n\n### Bug Fixes\n\n* use DIF URLs in packages ([#1271](https://github.com/decentralized-identity/veramo/issues/1271)) ([3dfc601](https://github.com/decentralized-identity/veramo/commit/3dfc6014cdee7902c59d8db76b4c8507b870f227))\n\n\n\n\n\n## [5.5.2](https://github.com/uport-project/veramo/compare/v5.5.1...v5.5.2) (2023-10-06)\n\n\n### Bug Fixes\n\n* **data-store:** match claims by credential hash when deleting credential ([#1270](https://github.com/uport-project/veramo/issues/1270)) ([4ee626d](https://github.com/uport-project/veramo/commit/4ee626d4b16e50cbc9a16055120051b068f177bd)), closes [#1269](https://github.com/uport-project/veramo/issues/1269)\n\n\n\n\n\n## [5.5.1](https://github.com/uport-project/veramo/compare/v5.5.0...v5.5.1) (2023-09-21)\n\n\n### Bug Fixes\n\n* **data-store:** take and skip for postgres ([#1249](https://github.com/uport-project/veramo/issues/1249)) ([fcd2699](https://github.com/uport-project/veramo/commit/fcd269961ba9a5470c9b809f076493db481efaaa))\n\n\n\n\n\n# [5.5.0](https://github.com/uport-project/veramo/compare/v5.4.1...v5.5.0) (2023-09-19)\n\n\n### Bug Fixes\n\n* **data-store:** order skip take in orm and json ([#1243](https://github.com/uport-project/veramo/issues/1243)) ([28c1224](https://github.com/uport-project/veramo/commit/28c12247c4e4b5c94e5e92b481e3ccc71b2c4ec6))\n* **deps:** update dependency @metamask/eth-sig-util to v6 ([c60252c](https://github.com/uport-project/veramo/commit/c60252ce76318fc201580bc39db8775b71ee6d13))\n* **deps:** Update dependency credential-status to v2.0.6 ([423c0ae](https://github.com/uport-project/veramo/commit/423c0aed8690a48f907cd440f26d9d6ac86df425))\n* **deps:** update dependency cross-fetch to v4 ([1c14d34](https://github.com/uport-project/veramo/commit/1c14d34f48a51bef373541e84ed89f2f44711406))\n* **deps:** Update dependency did-jwt-vc to v3.2.5 ([75e66d9](https://github.com/uport-project/veramo/commit/75e66d9e407b901eecf61591fad63a97d188e348))\n* **deps:** update dependency swagger-ui-express to v5 ([7e070cc](https://github.com/uport-project/veramo/commit/7e070cc487f7f671276fee6a5b99f4d517728f29))\n* **deps:** Update did-vc-libraries ([cb5f9d7](https://github.com/uport-project/veramo/commit/cb5f9d73e0878c7ebbaa2bd0debfbf1022d0bfae))\n* **deps:** Update did-vc-libraries ([518cc5a](https://github.com/uport-project/veramo/commit/518cc5a221a5cc368647f2684d9469d0a11df2c3))\n* **did-provider-key:** use compressed keys for creating Secp256k1 did:key ([#1217](https://github.com/uport-project/veramo/issues/1217)) ([ba8f6f5](https://github.com/uport-project/veramo/commit/ba8f6f5b9b701e57af86491504ecd209ca0c1c1d)), closes [#1213](https://github.com/uport-project/veramo/issues/1213)\n\n\n### Features\n\n* **core-types:** export a basic mapping between key types and algorithms ([57b6c58](https://github.com/uport-project/veramo/commit/57b6c583138b0f8f283f4f00b27573529f394a7a))\n* **selective-disclosure:** support multiple key types for generating requests ([3406a04](https://github.com/uport-project/veramo/commit/3406a04d0ee3c2b637abd774d3cd3fda78fd413d)), closes [#946](https://github.com/uport-project/veramo/issues/946)\n\n\n\n\n\n## [5.4.1](https://github.com/uport-project/veramo/compare/v5.4.0...v5.4.1) (2023-08-04)\n\n\n### Bug Fixes\n\n* **ci:** benign change meant to tag all packages for another patch release ([#1211](https://github.com/uport-project/veramo/issues/1211)) ([41b5c90](https://github.com/uport-project/veramo/commit/41b5c90277171b7b38c5cf49ca01db5cf75b6300))\n* **deps:** Update did-vc-libraries ([08d0c39](https://github.com/uport-project/veramo/commit/08d0c39ec179dc7c7f9c5005a6f3eb183849f3e5))\n* **deps:** Update did-vc-libraries to v6 ([3cadd56](https://github.com/uport-project/veramo/commit/3cadd56356a23463acc04f9a8a58239a9475b1c1))\n\n\n\n\n\n# [5.4.0](https://github.com/uport-project/veramo/compare/v5.3.0...v5.4.0) (2023-08-01)\n\n\n### Bug Fixes\n\n* **deps:** Update dependency @aviarytech/did-peer to ^0.0.21 ([1f84ae7](https://github.com/uport-project/veramo/commit/1f84ae7140d3e58e9117ec6969ad118ad2f1d9e5))\n\n\n### Features\n\n* **credential-w3c:** allow issuers with query parameters for credentials and presentations ([#1207](https://github.com/uport-project/veramo/issues/1207)) ([688f59d](https://github.com/uport-project/veramo/commit/688f59d6b492bc25bc51bbe73be969d6c30a958d)), closes [#1201](https://github.com/uport-project/veramo/issues/1201)\n* **did-comm:** add support for the AES based content and key encryption algorithms ([#1180](https://github.com/uport-project/veramo/issues/1180)) ([5294a81](https://github.com/uport-project/veramo/commit/5294a812ee578c0712b54f216416c3ef78c848da))\n\n\n\n\n\n# [5.3.0](https://github.com/uport-project/veramo/compare/v5.2.0...v5.3.0) (2023-07-27)\n\n\n### Bug Fixes\n\n* add missing js extension for json canonicalizer import ([#1175](https://github.com/uport-project/veramo/issues/1175)) ([d6afc3f](https://github.com/uport-project/veramo/commit/d6afc3f6f87fb26e9bbdeb131e2270faf87018de))\n* **cli:** prevent `ExperimentalWarning` messages form being printed ([#1186](https://github.com/uport-project/veramo/issues/1186)) ([a2971aa](https://github.com/uport-project/veramo/commit/a2971aaf0b1f263415e938cc459e55a366075ffb))\n* **credential-eip712:** remove JSON.stringify for string credential ([#1176](https://github.com/uport-project/veramo/issues/1176)) ([469dcd9](https://github.com/uport-project/veramo/commit/469dcd9ba008dc73934335f55e9da80152c40371))\n* **deps:** update dependency @decentralized-identity/ion-sdk to v1 ([6981e68](https://github.com/uport-project/veramo/commit/6981e6845d6f90d7b0c8dd6e0117b73dfd8edfb9))\n* **deps:** update dependency commander to v11 ([e2d7966](https://github.com/uport-project/veramo/commit/e2d79668b0bbd834d462fae867220f6cf44c5282))\n* **deps:** update dependency multiformats to v12 ([11fa7c3](https://github.com/uport-project/veramo/commit/11fa7c340da78101ea5e974e8ae0f90193933976))\n* **deps:** Update dependency web-did-resolver to v2.0.27 ([b5b6f52](https://github.com/uport-project/veramo/commit/b5b6f524cfbdf197e27198170446c3ddbe94c241))\n* **deps:** Update did-vc-libraries ([78b4bfb](https://github.com/uport-project/veramo/commit/78b4bfb5089487e6ed771d691d35367bc3f7805c))\n* **deps:** Update did-vc-libraries ([f92c531](https://github.com/uport-project/veramo/commit/f92c53109638e36612f6971ea1d1c8582337f705))\n* **did-resolver:** send `Accept` header to universal resolver. ([#1203](https://github.com/uport-project/veramo/issues/1203)) ([c86d918](https://github.com/uport-project/veramo/commit/c86d918e05585b10c501e7cbfa495d548c04ca3e))\n* support publicKeyJwk when comparing blockchainAccountId ([#1194](https://github.com/uport-project/veramo/issues/1194)) ([9110688](https://github.com/uport-project/veramo/commit/9110688cc02707d0c5ac06fe52916b7910b2d99c))\n\n\n### Features\n\n* allow secp256r1 key type for JWT VC issuance ([#1192](https://github.com/uport-project/veramo/issues/1192)) ([2ce7056](https://github.com/uport-project/veramo/commit/2ce705680173174e7399c4d0607b67b7303c6c97))\n* **credential-w3c:** support specifying a key when creating credential or presentation ([#1202](https://github.com/uport-project/veramo/issues/1202)) ([70d49f4](https://github.com/uport-project/veramo/commit/70d49f48a71a4db674f793d14711527d539fb975))\n* export didcomm mediator utils ([#1181](https://github.com/uport-project/veramo/issues/1181)) ([264b6a7](https://github.com/uport-project/veramo/commit/264b6a71a8647f456daedcca99efa453f53ab8a1))\n* **kv-store:** add key-value store based on a typescript port of the keyv package ([#1150](https://github.com/uport-project/veramo/issues/1150)) ([e7138d3](https://github.com/uport-project/veramo/commit/e7138d377c4f6ea242cea645cda4d26eb7d7d377))\n\n\n\n\n\n# [5.2.0](https://github.com/uport-project/veramo/compare/v5.1.4...v5.2.0) (2023-05-02)\n\n\n### Bug Fixes\n\n* add did-provider-peer to CLI dependencies ([#1161](https://github.com/uport-project/veramo/issues/1161)) ([38827c3](https://github.com/uport-project/veramo/commit/38827c3a12483f6791fcb3784f2a1ef27a21495f))\n* **cli:** NODE_NO_WARNINGS on windows ([#1164](https://github.com/uport-project/veramo/issues/1164)) ([e9474e2](https://github.com/uport-project/veramo/commit/e9474e2882d9019677f227437702c226c79bbc87))\n* **credential-ld:** external context handling with the `fetchRemoteContexts` option ([#1149](https://github.com/uport-project/veramo/issues/1149)) ([4a63f40](https://github.com/uport-project/veramo/commit/4a63f4009bea31c9111de8b5298b34b70e53fa37))\n* **credential-ld:** fix Ed25519Signature2020 verification ([#1166](https://github.com/uport-project/veramo/issues/1166)) ([c965fd5](https://github.com/uport-project/veramo/commit/c965fd502f652c9929ae4753c56ebbe351447733))\n* **data-store:** fix react-native migrations on older Android installations ([#1152](https://github.com/uport-project/veramo/issues/1152)) ([826b994](https://github.com/uport-project/veramo/commit/826b994c6c86f45ea05a93bfc409cec34e562ec6))\n* **deps:** update dependency canonicalize to v2 ([8368462](https://github.com/uport-project/veramo/commit/8368462c415e316318855f9f762b040dbb251296))\n* **deps:** update dependency express-handlebars to v7 ([2621947](https://github.com/uport-project/veramo/commit/26219471a117d0ec3d7a691e082022253aae6cd6))\n* **deps:** update dependency z-schema to v6 ([0cdd100](https://github.com/uport-project/veramo/commit/0cdd100c810df0e27596a537b07f54f78b0bab6b))\n* plugin schemas ([#1159](https://github.com/uport-project/veramo/issues/1159)) ([4b5f580](https://github.com/uport-project/veramo/commit/4b5f580e993857ae19541673b484b0af34f4e611))\n\n\n### Features\n\n* add did-peer provider and resolver ([#1156](https://github.com/uport-project/veramo/issues/1156)) ([9502063](https://github.com/uport-project/veramo/commit/95020632f741bd4640b3496b7b1bf19f5e6641d0))\n* **did-provider-key:** add option to create the identifier from a given private key ([#1165](https://github.com/uport-project/veramo/issues/1165)) ([ad79a22](https://github.com/uport-project/veramo/commit/ad79a229666d48546c5b7ccb15c638adee44b7a6))\n\n\n\n\n\n## [5.1.4](https://github.com/uport-project/veramo/compare/v5.1.3...v5.1.4) (2023-03-16)\n\n\n### Bug Fixes\n\n* **cli:** fix `credential verify` command for JWT credentials ([#1148](https://github.com/uport-project/veramo/issues/1148)) ([697a14c](https://github.com/uport-project/veramo/commit/697a14c5f0377afb8f836cde9ff3956121247780))\n\n\n\n\n\n## [5.1.3](https://github.com/uport-project/veramo/compare/v5.1.2...v5.1.3) (2023-03-16)\n\n\n### Bug Fixes\n\n* **cli:** load server config asynchronously ([#1145](https://github.com/uport-project/veramo/issues/1145)) ([2a0aef1](https://github.com/uport-project/veramo/commit/2a0aef1e1911ffba85c043a878f60d7bc672e86a)), closes [#1144](https://github.com/uport-project/veramo/issues/1144)\n\n\n\n\n\n## [5.1.2](https://github.com/uport-project/veramo/compare/v5.1.1...v5.1.2) (2023-02-25)\n\n\n### Bug Fixes\n\n* **ci:** minor changes to trigger release alignment ([9db312f](https://github.com/uport-project/veramo/commit/9db312f8f049ec13ef394dc77fe6e2759143790d))\n\n\n\n\n\n## [5.1.1](https://github.com/uport-project/veramo/compare/v5.1.0...v5.1.1) (2023-02-25)\n\n\n### Bug Fixes\n\n* **ci:** add publishConfig for did-provider-jwk ([b8b18e9](https://github.com/uport-project/veramo/commit/b8b18e97b75c709f0b2445324923c8ae3c4c2d74))\n\n\n\n\n\n# [5.1.0](https://github.com/uport-project/veramo/compare/v5.0.0...v5.1.0) (2023-02-24)\n\n\n### Bug Fixes\n\n* add missing `.js` file extension for ESM import ([#1123](https://github.com/uport-project/veramo/issues/1123)) ([6c850ac](https://github.com/uport-project/veramo/commit/6c850ac40f7dd0104c61851eee20551b1bb69ff6)), closes [#1122](https://github.com/uport-project/veramo/issues/1122)\n* **cli:** create veramo instance async in CLI ([#1126](https://github.com/uport-project/veramo/issues/1126)) ([05ab106](https://github.com/uport-project/veramo/commit/05ab10653aac4cb37b00a9be6cc0c7be910f1827)), closes [#1125](https://github.com/uport-project/veramo/issues/1125)\n* **cli:** typo in explore command ([279168d](https://github.com/uport-project/veramo/commit/279168d4fc2b9809090666b6ffb5d4494c9e5cca))\n* correctly export PickupRecipientMessageHandler ([#1121](https://github.com/uport-project/veramo/issues/1121)) ([3a7a086](https://github.com/uport-project/veramo/commit/3a7a0864387f7b56f1bac4cd89a3fd7e6274e644))\n* **credential-eip712:** compatibility improvements for EthereumEIP712Signature2021 ([#1131](https://github.com/uport-project/veramo/issues/1131)) ([672f92b](https://github.com/uport-project/veramo/commit/672f92b1bd3850c369cbef646c8ece8a58fafc16))\n* **did-comm:** correctly export PickupMediatorMessageHandler ([#1120](https://github.com/uport-project/veramo/issues/1120)) ([8de26b0](https://github.com/uport-project/veramo/commit/8de26b0740f68cd6976a7aa5f83ae95ee0dd3dce))\n* **did-provider-ethr:** export KMSEthereumSigner for convenience ([#1124](https://github.com/uport-project/veramo/issues/1124)) ([cee8d2e](https://github.com/uport-project/veramo/commit/cee8d2ea70950f1e1c07ce371bd6eef0de99a122))\n* P256 key parity corrections ([#1137](https://github.com/uport-project/veramo/issues/1137)) ([d0eca2b](https://github.com/uport-project/veramo/commit/d0eca2b3cd9ca6741f7f056e28bb9799910bc5ec)), closes [#1136](https://github.com/uport-project/veramo/issues/1136) [#1135](https://github.com/uport-project/veramo/issues/1135)\n\n\n### Features\n\n* **cli:**  export config methods and adopt `Command` instances instead of global `program`([#1130](https://github.com/uport-project/veramo/issues/1130)) ([9c73d98](https://github.com/uport-project/veramo/commit/9c73d98fd217ed9a612767f49a235cdbf43619cb))\n* **cli:** add did:3 resolver to CLI default config ([#1129](https://github.com/uport-project/veramo/issues/1129)) ([5887e04](https://github.com/uport-project/veramo/commit/5887e04802266bffe71c2a5f7c8d71fbe1f3a158))\n* **cli:** add did:pkh support to the default CLI config ([#1133](https://github.com/uport-project/veramo/issues/1133)) ([19cccc1](https://github.com/uport-project/veramo/commit/19cccc1f394a63505fc40d57a7c1d26d21abc3e5))\n* **core-types:** allow inline [@context](https://github.com/context) for Credentials and Presentations ([#1119](https://github.com/uport-project/veramo/issues/1119)) ([44bb365](https://github.com/uport-project/veramo/commit/44bb36503b635ee1f5431cb4bf28c7a9ba111156)), closes [#1073](https://github.com/uport-project/veramo/issues/1073)\n* **did-provider-jwk:** add did:jwk method support ([#1128](https://github.com/uport-project/veramo/issues/1128)) ([0a22d9c](https://github.com/uport-project/veramo/commit/0a22d9c2426c69c95263b2f0b36617794b59be62))\n\n\n\n\n\n# [5.0.0](https://github.com/uport-project/veramo/compare/v4.3.0...v5.0.0) (2023-02-09)\n\n\n### Bug Fixes\n\n* **did-manager:** rename AbstractDIDStore methods for SES compatibility ([0287340](https://github.com/uport-project/veramo/commit/02873401508a8a7d8c999bc12dc1d107a4a5202f)), closes [#1090](https://github.com/uport-project/veramo/issues/1090)\n* **did-provider-pkh:** add missing caip dependency ([#1112](https://github.com/uport-project/veramo/issues/1112)) ([60bc5fd](https://github.com/uport-project/veramo/commit/60bc5fd6f654236c072f7943494b3e27bd045ce8)), closes [#1111](https://github.com/uport-project/veramo/issues/1111)\n* **did-provider-pkh:** refactor and simplify did:pkh plugin ([#1113](https://github.com/uport-project/veramo/issues/1113)) ([42be48f](https://github.com/uport-project/veramo/commit/42be48ffe2251510f7bd5e10b43362e816655eb9))\n* **key-manager:** rename Abstract[Private]KeyStore methods for SES compatibility ([91631b6](https://github.com/uport-project/veramo/commit/91631b6d2a09d46accff6509f44792d88209b801)), closes [#1090](https://github.com/uport-project/veramo/issues/1090)\n\n\n### Build System\n\n* convert veramo modules to ESM instead of CommonJS ([#1103](https://github.com/uport-project/veramo/issues/1103)) ([b5cea3c](https://github.com/uport-project/veramo/commit/b5cea3c0d80d900a47bd1d9eea68f84b70a35e7b)), closes [#1099](https://github.com/uport-project/veramo/issues/1099)\n\n\n### Features\n\n* increase request limit for express routers ([#1118](https://github.com/uport-project/veramo/issues/1118)) ([2db3149](https://github.com/uport-project/veramo/commit/2db314930e883fc599d5b670088e7be6475346a2)), closes [#1117](https://github.com/uport-project/veramo/issues/1117)\n* isolate `core-types` package from `core` ([#1116](https://github.com/uport-project/veramo/issues/1116)) ([ba7a303](https://github.com/uport-project/veramo/commit/ba7a303de91cf4cc568a3af1ddf8ca98ed022e9f))\n\n\n### BREAKING CHANGES\n\n* **did-manager:** implementations of AbstractDIDStore need to rename their methods to conform to the new API. Functionality remains the same.\n* **key-manager:** implementations of AbstractKeyStore and AbstractPrivateKeyStore need to rename their methods to conform to the new API. Functionality remains the same.\n* this is a breaking change as modules will have to be imported differently: \n* https://www.typescriptlang.org/docs/handbook/esm-node.html\n* https://nodejs.org/api/esm.html\n* https://caniuse.com/?search=modules\n\ntest(did-provider-ion): skip a couple of tests that fail with unreasonable errors\nchore: use ubuntu-latest on CI\nfix: temporarily remove puppeteer tests\nfix: use craco for test-react-app to enable babel config\ntest: fix unit and integration tests (browser tests still broken)\nfix: fix some build issues that prevented tests from working\nfix: missing deps flagged by pnpm\n\n\n\n\n\n# [4.3.0](https://github.com/uport-project/veramo/compare/v4.2.0...v4.3.0) (2023-01-27)\n\n\n### Bug Fixes\n\n* **credential-ld:** fix defaultContexts file extensions ([#1086](https://github.com/uport-project/veramo/issues/1086)) ([2f57cb1](https://github.com/uport-project/veramo/commit/2f57cb1bef265a5930ceaeff6a8e9af987c3958e))\n* **utils:** convert JWK with curv `Ed25519` to `X25519` ([#1078](https://github.com/uport-project/veramo/issues/1078)) ([deb546b](https://github.com/uport-project/veramo/commit/deb546ba94fa1dc51662adddbe303d63a0e7ce12))\n\n\n### Features\n\n* **did-comm:** add trust ping protocol ([#1080](https://github.com/uport-project/veramo/issues/1080)) ([fb22e63](https://github.com/uport-project/veramo/commit/fb22e632ef6dcce6a7dfec9a229c7be4d6d5c894))\n* **did-comm:** support DIDComm Messaging attachments ([#1087](https://github.com/uport-project/veramo/issues/1087)) ([6679574](https://github.com/uport-project/veramo/commit/66795742a01d5390ad083610efd28a8fe59fb3a3)), closes [#612](https://github.com/uport-project/veramo/issues/612)\n* **utils:** add publicKeyJwk as valid verificationMethod in getEthereumAddress ([#1096](https://github.com/uport-project/veramo/issues/1096)) ([a4209f5](https://github.com/uport-project/veramo/commit/a4209f5ffc95d9fde6bbdb9df6d16e8d961341f6))\n\n\n\n\n\n# [4.2.0](https://github.com/uport-project/veramo/compare/v4.1.2...v4.2.0) (2022-12-05)\n\n\n### Bug Fixes\n\n* **cli:** fix bug in schema generator ([d4c63c1](https://github.com/uport-project/veramo/commit/d4c63c1d1c3acb2a2f576450384250163ae7e0a0))\n* **credential-ld:** simplify signature suite use of Uint8Array ([49a10ec](https://github.com/uport-project/veramo/commit/49a10ecc29d56118ac09c5df73fed885fe6988c1))\n* **credential-w3c:** correct verification of credentials given as objects with jwt proofs ([#1071](https://github.com/uport-project/veramo/issues/1071)) ([b0d75e9](https://github.com/uport-project/veramo/commit/b0d75e9af7f28384ce2e5ef744dfbc3c302cd1a8))\n* **deps:** bump dependencies ([701b8ed](https://github.com/uport-project/veramo/commit/701b8edf981ea11c7ddb6a81d2817dbbdbb022f3))\n* **deps:** Update dependency @digitalcredentials/vc to v5 ([1bdc802](https://github.com/uport-project/veramo/commit/1bdc80240578aff13240dfe45b9a12b0720d1d4d))\n* **deps:** Update dependency ethr-did-resolver to v8 ([f475dbc](https://github.com/uport-project/veramo/commit/f475dbc1c2dbb4b7f6b3396c3e6947eac2931736))\n* **did-provider-ion:** await and update deps ([#1074](https://github.com/uport-project/veramo/issues/1074)) ([8cea4c0](https://github.com/uport-project/veramo/commit/8cea4c04746a3ef05e400df51a1b47168b46e45d))\n* didcomm message handler should attempt to pass message to other handlers ([#1064](https://github.com/uport-project/veramo/issues/1064)) ([5e18427](https://github.com/uport-project/veramo/commit/5e18427dc10e3724ca141efe923a789cd0f54688))\n* **utils:** correctly extract publicKeyHex from [Ed/X]25519 2020 keys ([#1076](https://github.com/uport-project/veramo/issues/1076)) ([c73002c](https://github.com/uport-project/veramo/commit/c73002c97d8c688e343aba65efd4c8e857a96522)), closes [#1067](https://github.com/uport-project/veramo/issues/1067)\n\n\n### Features\n\n* add eip712 issuer to CLI and default agent config ([#1065](https://github.com/uport-project/veramo/issues/1065)) ([33c7cee](https://github.com/uport-project/veramo/commit/33c7ceed3b9850cfd6f5677aeeb89aeda2be72e5))\n* **credential-ld:** add `Ed25519Signature2020` & `JsonWebSignature2020` experimental support ([#1030](https://github.com/uport-project/veramo/issues/1030)) ([fbf7d48](https://github.com/uport-project/veramo/commit/fbf7d483c3549ec45df84472824395903128d66e)), closes [#1003](https://github.com/uport-project/veramo/issues/1003)\n* **did-provider-pkh:** implement did:pkh support. ([#1052](https://github.com/uport-project/veramo/issues/1052)) ([5ad0bfb](https://github.com/uport-project/veramo/commit/5ad0bfb713dca8fd24b99ddf053335340a39e7b3)), closes [#1024](https://github.com/uport-project/veramo/issues/1024)\n\n\n\n\n\n## [4.1.2](https://github.com/uport-project/veramo/compare/v4.1.1...v4.1.2) (2022-11-03)\n\n\n### Bug Fixes\n\n* **deps:** bump ethr-did to 2.3.6 and cosmetic changes in CLI config ([#1054](https://github.com/uport-project/veramo/issues/1054)) ([eb03b63](https://github.com/uport-project/veramo/commit/eb03b637ef5aecf57b0ee130d08689094b1956df))\n\n\n\n\n\n## [4.1.1](https://github.com/uport-project/veramo/compare/v4.1.0...v4.1.1) (2022-11-01)\n\n**Note:** Version bump only for package veramo\n\n\n\n\n\n# [4.1.0](https://github.com/uport-project/veramo/compare/v4.0.2...v4.1.0) (2022-10-31)\n\n\n### Bug Fixes\n\n* **deps:** add @veramo/credential-ld to the CLI dependencies ([#1043](https://github.com/uport-project/veramo/issues/1043)) ([0698185](https://github.com/uport-project/veramo/commit/0698185319382a173a3d10c197f785bdadb070c2)), closes [#1042](https://github.com/uport-project/veramo/issues/1042)\n* **deps:** Update dependency ethr-did-resolver to v7 ([#1038](https://github.com/uport-project/veramo/issues/1038)) ([d421c0f](https://github.com/uport-project/veramo/commit/d421c0f9f5934829df2930e58e98bcfce813ce84))\n* **deps:** Update did-vc-libraries ([6fa13ab](https://github.com/uport-project/veramo/commit/6fa13ab7fbab979db2d41e84e445a52cf9319003))\n* **did-provider-ion:** delete new keys if addKey fails([#1045](https://github.com/uport-project/veramo/issues/1045)) ([db02742](https://github.com/uport-project/veramo/commit/db027423d709930dccfb7246738670726a33ab9f))\n* remove deprecated testnets ([#1028](https://github.com/uport-project/veramo/issues/1028)) ([2823738](https://github.com/uport-project/veramo/commit/28237383d0cc2eb20bcf8e10562221ea2ab32f94)), closes [#1025](https://github.com/uport-project/veramo/issues/1025)\n\n\n### Features\n\n* add ION DID Provider implementation ([#987](https://github.com/uport-project/veramo/issues/987)) ([594571c](https://github.com/uport-project/veramo/commit/594571cf378ac59a91e2f93484c37285ec593999)), closes [#336](https://github.com/uport-project/veramo/issues/336) [#440](https://github.com/uport-project/veramo/issues/440)\n* add support for did:ethr signed/meta transactions ([#1031](https://github.com/uport-project/veramo/issues/1031)) ([88f1da9](https://github.com/uport-project/veramo/commit/88f1da9a39f6d249fbed301e2d77ea3cee167e33))\n* add support for NIST Secp256r1 keys and ES256 signatures ([#1039](https://github.com/uport-project/veramo/issues/1039)) ([61eb369](https://github.com/uport-project/veramo/commit/61eb369cfcde7372babf3f68fb65ea2055b5bf70))\n* **did-provider-ethr:** implement TypedDataSigner in KmsEthereumSigner ([#1026](https://github.com/uport-project/veramo/issues/1026)) ([4371cb9](https://github.com/uport-project/veramo/commit/4371cb920ddbafa8dafb73b6bcce1e0408ff3d03))\n\n\n\n\n\n## [4.0.2](https://github.com/uport-project/veramo/compare/v4.0.1...v4.0.2) (2022-10-04)\n\n\n### Bug Fixes\n\n* **credential-eip712:** add support for all did methods that use secp256k ([#1011](https://github.com/uport-project/veramo/issues/1011)) ([9940068](https://github.com/uport-project/veramo/commit/99400689dec9ea00131cf914d1999357b716612c)), closes [#991](https://github.com/uport-project/veramo/issues/991)\n* **data-store:** use looser typeorm version range to fix [#1013](https://github.com/uport-project/veramo/issues/1013) ([#1016](https://github.com/uport-project/veramo/issues/1016)) ([83807f3](https://github.com/uport-project/veramo/commit/83807f31f845c8a0116f0300c51735ec406d9dd4))\n* **deps:** update dependency @metamask/eth-sig-util to v5 ([bf3a406](https://github.com/uport-project/veramo/commit/bf3a406a19f1ab6d57819c1ff3df2b2f3b2f4d03))\n* **deps:** update dependency uuid to v9 ([4ff90a5](https://github.com/uport-project/veramo/commit/4ff90a58f5993880635f2b39c73edadaf3149066))\n\n\n\n\n\n## [4.0.1](https://github.com/uport-project/veramo/compare/v4.0.0...v4.0.1) (2022-09-23)\n\n\n### Bug Fixes\n\n* **ci:** add GH_TOKEN for checkout and auto-release ([#1009](https://github.com/uport-project/veramo/issues/1009)) ([1268bd2](https://github.com/uport-project/veramo/commit/1268bd28e5e6c84255d5f67b46fc88e004dd8fea))\n* **credential-w3c:** manually merge schemas for ICredentialPlugin ([#1008](https://github.com/uport-project/veramo/issues/1008)) ([cff1765](https://github.com/uport-project/veramo/commit/cff1765ea052960d2e0ca88042c4b9a9d4db7fad)), closes [#1007](https://github.com/uport-project/veramo/issues/1007)\n\n\n\n\n\n# [4.0.0](https://github.com/uport-project/veramo/compare/v3.1.5...v4.0.0) (2022-09-22)\n\n\n### Bug Fixes\n\n* **build:** update lockfile and autogen tests ([ea4966a](https://github.com/uport-project/veramo/commit/ea4966a6b79dc4653a2aff9147c096ee22bb47df))\n* **cli:** fix typo in command description ([#913](https://github.com/uport-project/veramo/issues/913)) ([bfc61f3](https://github.com/uport-project/veramo/commit/bfc61f3a52b15e30bae0de681e5782f611900178))\n* **cli:** update default CLI config to account for renamed class ([#919](https://github.com/uport-project/veramo/issues/919)) ([d66c366](https://github.com/uport-project/veramo/commit/d66c36654fbc9ba02ed5914e18359180c0087cf9))\n* **core:** plugin schema ([e5a48ad](https://github.com/uport-project/veramo/commit/e5a48ad85590b21c6256604e2769f19039fe1603))\n* **credential-eip712:** update plugin schema ([#915](https://github.com/uport-project/veramo/issues/915)) ([3a0765e](https://github.com/uport-project/veramo/commit/3a0765ef632aae29701004cbfbeb38a2de7bc847))\n* **credential-ld:** fix EcdsaSecp256k1RecoverySignature2020 suite context ([#909](https://github.com/uport-project/veramo/issues/909)) ([48fbee3](https://github.com/uport-project/veramo/commit/48fbee3e62eab3df4225ae0bdb3a92f5665eb171))\n* **credential-ld:** include credential context and fix context loader Map ([ef7797d](https://github.com/uport-project/veramo/commit/ef7797d4c5f20b22e4e39a5ad60a851fa1c4f2ed))\n* **credential-ld:** include LDDefaultContexts in npm bundle ([3e2cf29](https://github.com/uport-project/veramo/commit/3e2cf29ecc7aecf0a3750beec7490306ceb79dab))\n* **credential-ld:** remove fs dependency for JSON LD default contexts ([#868](https://github.com/uport-project/veramo/issues/868)) ([2f75935](https://github.com/uport-project/veramo/commit/2f75935f049e4545ba77b0038c74668147e5e6de)), closes [#837](https://github.com/uport-project/veramo/issues/837)\n* **credential-status:** check credential status for all credential types ([#949](https://github.com/uport-project/veramo/issues/949)) ([877c513](https://github.com/uport-project/veramo/commit/877c513a5bc253ed30c74ace00ce988197d12a2d)), closes [#934](https://github.com/uport-project/veramo/issues/934)\n* **credential-status:** simplify credential-status scripts ([45b8c1f](https://github.com/uport-project/veramo/commit/45b8c1f1a5ce39f48fb9e093c26b8766d9cd5325))\n* **credential-w3c:** forward domain and challenge args to createVerifiablePresentationJwt ([#887](https://github.com/uport-project/veramo/issues/887)) ([2374c71](https://github.com/uport-project/veramo/commit/2374c71251b94bc178c669b9c0ef3cd98e74a017))\n* **data-store-json:** structuredClone ([5369c28](https://github.com/uport-project/veramo/commit/5369c28517bd6539870fd2f4fafd9e3a357a6cf3))\n* **data-store-json:** structuredClone ([#885](https://github.com/uport-project/veramo/issues/885)) ([cf14cae](https://github.com/uport-project/veramo/commit/cf14caecda1248af431e60841170611bc3d1e3b9)), closes [#857](https://github.com/uport-project/veramo/issues/857)\n* deprecate the `save` parameter ([#975](https://github.com/uport-project/veramo/issues/975)) ([598c0e1](https://github.com/uport-project/veramo/commit/598c0e1e3f37d1b30c865fa01b93b7657f43d795)), closes [#966](https://github.com/uport-project/veramo/issues/966)\n* **deps:** Bump `did-jwt`, `did-jwt-vc` as direct package deps ([#955](https://github.com/uport-project/veramo/issues/955)) ([e57edb3](https://github.com/uport-project/veramo/commit/e57edb34cfbaee6bba1d944497d688104f32c698))\n* **deps:** pin dependencies ([31c517c](https://github.com/uport-project/veramo/commit/31c517cf5fc2df6879c68db50fc47278db5140bd))\n* **deps:** pin dependencies ([f895dee](https://github.com/uport-project/veramo/commit/f895dee9b6e7262d2a8ef3d67bcf718a0c16d234))\n* **deps:** pin dependency typescript to 4.5.5 ([302e5f0](https://github.com/uport-project/veramo/commit/302e5f06f089119802703c1e01af93e5e6f2f443))\n* **deps:** replace @transmute/lds-ecdsa-secp256k1-recovery2020 with fork ([#953](https://github.com/uport-project/veramo/issues/953)) ([573a0ef](https://github.com/uport-project/veramo/commit/573a0efe8d28653bd0389e401c25a2dd9c361a96)), closes [#952](https://github.com/uport-project/veramo/issues/952)\n* **deps:** update all non-major dependencies ([b537187](https://github.com/uport-project/veramo/commit/b537187ba04ba41cd45c18dfb58c92725b65b084))\n* **deps:** update all non-major dependencies ([a7a5b5d](https://github.com/uport-project/veramo/commit/a7a5b5dc3a2d90670927f4367bef2055a6d39f3b))\n* **deps:** update all non-major dependencies ([04c0053](https://github.com/uport-project/veramo/commit/04c00530963b1c4496374532bf74b73f3b22c825))\n* **deps:** update all non-major dependencies ([d8aa16a](https://github.com/uport-project/veramo/commit/d8aa16a36d2e63c65177bbf281f8d15fcc9dcb5a))\n* **deps:** update all non-major dependencies ([183b4bc](https://github.com/uport-project/veramo/commit/183b4bc5ca3dcf11dd111e7e1ae19636909ff4c7))\n* **deps:** update builders-and-testers ([a13f5f8](https://github.com/uport-project/veramo/commit/a13f5f8a01a8bd2d7ec2bb0e19b052b1a108881c))\n* **deps:** update builders-and-testers ([509001f](https://github.com/uport-project/veramo/commit/509001f6853c36dc49f5995508e9eb4167676c11))\n* **deps:** update builders-and-testers ([a72b33c](https://github.com/uport-project/veramo/commit/a72b33cf8dc6215311d7926f622be2d5b9fc516c))\n* **deps:** update builders-and-testers ([ef08c52](https://github.com/uport-project/veramo/commit/ef08c527198df36283b2a2987ea6c8080fd2867d))\n* **deps:** update builders-and-testers ([8a1884b](https://github.com/uport-project/veramo/commit/8a1884ba38f436c3eb7246a04a6c1e387dd71467))\n* **deps:** update builders-and-testers ([60b8f79](https://github.com/uport-project/veramo/commit/60b8f791a3af73bbe7c944bca719f2bdf34e60be))\n* **deps:** update builders-and-testers ([5202ef1](https://github.com/uport-project/veramo/commit/5202ef1dd51fd3b7ad57591fd726fdc571bc8492))\n* **deps:** update builders-and-testers ([4d5e912](https://github.com/uport-project/veramo/commit/4d5e912ee0aefb79e9198cb045cb9106af16a4b1))\n* **deps:** update builders-and-testers ([#930](https://github.com/uport-project/veramo/issues/930)) ([b3a5c52](https://github.com/uport-project/veramo/commit/b3a5c52d05061943e7cc01f06536c1761724017b))\n* **deps:** Update dependency @digitalcredentials/vc to v4 ([9ea90d3](https://github.com/uport-project/veramo/commit/9ea90d38137631d186c042de1fcf855be50f2144))\n* **deps:** update dependency @ethersproject/random to v5.5.1 ([b5fcdb5](https://github.com/uport-project/veramo/commit/b5fcdb5f083e266a1f865b85e805de1a1ef5baa5))\n* **deps:** update dependency @microsoft/api-extractor to v7.23.1 ([4081051](https://github.com/uport-project/veramo/commit/408105191efe63cc8ab5caf8baa8f0cbb349ed63))\n* **deps:** update dependency @types/react to v18 ([c93bdea](https://github.com/uport-project/veramo/commit/c93bdeaf01682b55db64a363cb857e2df7d28b6b))\n* **deps:** update dependency @types/react-dom to v18 ([0712b8c](https://github.com/uport-project/veramo/commit/0712b8c1d1e404efbde23968c144f25b36824a81))\n* **deps:** update dependency @ungap/structured-clone to v1 ([3d2a57b](https://github.com/uport-project/veramo/commit/3d2a57ba10d096af5dea19a59fc790c39fa94a5d))\n* **deps:** update dependency commander to v9 ([28c35e1](https://github.com/uport-project/veramo/commit/28c35e187caa9e5d56e149e5be220f6c9e14e0fb))\n* **deps:** update dependency did-jwt to v5.12.0 ([5b414d7](https://github.com/uport-project/veramo/commit/5b414d7d720e7c59cf3f56c35da5fe247e21bf26))\n* **deps:** update dependency did-jwt-vc to v2.1.8 ([d4520be](https://github.com/uport-project/veramo/commit/d4520be7f8ca140a5c8eafd7effb38812d51f2b4))\n* **deps:** Update dependency did-jwt-vc to v3 ([014c1ab](https://github.com/uport-project/veramo/commit/014c1ab974647d44d7ef1de0f931625348c4c98b))\n* **deps:** update dependency dotenv to v12 ([ea7641e](https://github.com/uport-project/veramo/commit/ea7641e4e21da0fc02535848c40ff81e644c069e))\n* **deps:** update dependency dotenv to v14 ([88bd6dc](https://github.com/uport-project/veramo/commit/88bd6dce4fc364e02c97aff7130c2685640f48cf))\n* **deps:** update dependency dotenv to v16 ([0ee5454](https://github.com/uport-project/veramo/commit/0ee545455deaeeca648c7f1c2266c34f094db053))\n* **deps:** Update dependency ethr-did-resolver to v6.0.2 ([#964](https://github.com/uport-project/veramo/issues/964)) ([48b937e](https://github.com/uport-project/veramo/commit/48b937ee13045736fdc495472847b0b0ee615814))\n* **deps:** update dependency express-handlebars to v6 ([4444828](https://github.com/uport-project/veramo/commit/4444828eddd68b7547cb5160a1970f35af0698b7))\n* **deps:** update dependency inquirer-autocomplete-prompt to v2 ([9bf0d0b](https://github.com/uport-project/veramo/commit/9bf0d0b0c95ad54404f39ffb54fd97880a569352))\n* **deps:** update dependency openapi-types to v10 ([3d9cf88](https://github.com/uport-project/veramo/commit/3d9cf8810cd04dbde394248a818e1e59eb251c67))\n* **deps:** update dependency openapi-types to v11 ([992ad40](https://github.com/uport-project/veramo/commit/992ad4041f54634203bd3017fd984f45a7c92012))\n* **deps:** update dependency openapi-types to v12 ([b8401f5](https://github.com/uport-project/veramo/commit/b8401f526b0771a98ab7987b773b9e9113710e9e))\n* **deps:** update dependency ts-json-schema-generator to v1 ([74d0a66](https://github.com/uport-project/veramo/commit/74d0a66a477ce7d425191a2d3343bc6192ba263a))\n* **deps:** update dependency typeorm to v0.2.41 ([61a8103](https://github.com/uport-project/veramo/commit/61a8103c15849dfd8574dda69692a7d8f7fa534e))\n* **deps:** update dependency typescript to v4.6.3 ([6e54d07](https://github.com/uport-project/veramo/commit/6e54d07288927155931ce949ccc2a10d69bfa9ff))\n* **deps:** update dependency typescript to v4.6.4 ([dddaebd](https://github.com/uport-project/veramo/commit/dddaebdb479fbcbc4fe345ba0316633a83a1af3e))\n* **deps:** update dependency web-did-resolver to v2.0.15 ([c574d05](https://github.com/uport-project/veramo/commit/c574d05904642720cfdead7029e69df51131359e))\n* **deps:** update dependency web-did-resolver to v2.0.16 ([8fd46af](https://github.com/uport-project/veramo/commit/8fd46af173ba18fe07679decc3d312972e0f889b))\n* **deps:** Update dependency web-did-resolver to v2.0.19 ([aec6bea](https://github.com/uport-project/veramo/commit/aec6bea5ed6a9cda0f8d78660750bea719e929f7))\n* **deps:** update dependency yaml to v2 ([9d5ee7c](https://github.com/uport-project/veramo/commit/9d5ee7cb3963cae46c9f0f1fbbfcea20cae415b2))\n* **deps:** update did-libraries ([219cde2](https://github.com/uport-project/veramo/commit/219cde250e8d4f06d7978afcc38a04471342fd21))\n* **deps:** update did-libraries ([42e3d77](https://github.com/uport-project/veramo/commit/42e3d7773a5a93c83a63378b29f498edbe05a8ae))\n* **deps:** update did-libraries ([e28a6b5](https://github.com/uport-project/veramo/commit/e28a6b5e27b482daa4ed50643c59c3a5e881e79e))\n* **deps:** update react monorepo to v18 ([5150b0e](https://github.com/uport-project/veramo/commit/5150b0ece65a924378e2f266ee96b86ca1e6d036))\n* **deps:** use did-jwt v6 and ethr-did-resolver v6 ([#925](https://github.com/uport-project/veramo/issues/925)) ([0c77d03](https://github.com/uport-project/veramo/commit/0c77d03ec5ec9e2091de3f74f67ab86a22cde197)), closes [#923](https://github.com/uport-project/veramo/issues/923) [#848](https://github.com/uport-project/veramo/issues/848)\n* **did-resolver:** use interface `Resolvable` instead of the `Resolver` class ([9c2e59f](https://github.com/uport-project/veramo/commit/9c2e59f3f23f808511c6c0e8e440b4d53ba5cb00))\n* **docs:** fix relevant errors and warnings in TSDoc to enable proper docs generation on `[@next](https://github.com/next)` branch ([79c3872](https://github.com/uport-project/veramo/commit/79c387230219c92c1951d19b8ddf716308a46c5b))\n* fix inquirer prompt for subject DID during SDR ([20d6cab](https://github.com/uport-project/veramo/commit/20d6cabe1a86e0ba4521a9c8867471ea6840bf08)), closes [#790](https://github.com/uport-project/veramo/issues/790)\n* **key-manager:** add missing uuid dependency ([#807](https://github.com/uport-project/veramo/issues/807)) ([b6d9738](https://github.com/uport-project/veramo/commit/b6d973848c0cc3f61eaf4fa9e572d7fe2d522fda))\n* **kms-web3:** use ethers _signTypedData ([#939](https://github.com/uport-project/veramo/issues/939)) ([f198997](https://github.com/uport-project/veramo/commit/f198997d08f65b758bd9471bd4cf170ac8620e82)), closes [#938](https://github.com/uport-project/veramo/issues/938)\n* **remote-server:** api-key-auth ([#772](https://github.com/uport-project/veramo/issues/772)) ([cbe6f35](https://github.com/uport-project/veramo/commit/cbe6f35e31c3a9e062d7f9c593253cb53b988e46)), closes [#771](https://github.com/uport-project/veramo/issues/771)\n* **remote-server:** web-did-doc-router options ([#777](https://github.com/uport-project/veramo/issues/777)) ([cc1ec7a](https://github.com/uport-project/veramo/commit/cc1ec7a0c510fcc2329bffcb33ee91fe8739ae5a))\n* update and fix inline documentation of all exported types ([#921](https://github.com/uport-project/veramo/issues/921)) ([63e64e0](https://github.com/uport-project/veramo/commit/63e64e0e2693808c4704dca8cc511dc0bab3f3b1))\n\n\n### Features\n\n* add key type definitions: 'Bls12381G1Key2020' and 'Bls12381G2Key2020' ([#839](https://github.com/uport-project/veramo/issues/839)) ([0f0f517](https://github.com/uport-project/veramo/commit/0f0f517d97230fd5334d604d4f20d575a14f8670))\n* add partial match for dids and aliases in did discovery provider for data store ([92b793e](https://github.com/uport-project/veramo/commit/92b793e8b45f005b87717393419cf5f84a5ca0ec))\n* add support for serviceEndpoint property as defined in latest DID Spec ([#988](https://github.com/uport-project/veramo/issues/988)) ([9bed70b](https://github.com/uport-project/veramo/commit/9bed70ba658aed34a97944e0dee27bca6c81d700))\n* **cli:** add choices when selecting credential Subject in CLI ([#898](https://github.com/uport-project/veramo/issues/898)) ([c47c08e](https://github.com/uport-project/veramo/commit/c47c08e2ce9ef676cc429bcaf063bbe8e38a352c))\n* **cli:** in explore, allow copy to clipboard the text of identifier or credential or presentation ([#902](https://github.com/uport-project/veramo/issues/902)) ([d3b87f5](https://github.com/uport-project/veramo/commit/d3b87f52f2707253449867d3a872ec60aa3fbc35))\n* create DIDComm JWE with multiple recipients ([#888](https://github.com/uport-project/veramo/issues/888)) ([06acacb](https://github.com/uport-project/veramo/commit/06acacb400264d0e7f83fe31935a8ff52593f21f))\n* **credential-ld:** add option to fetch remote contexts ([60226a1](https://github.com/uport-project/veramo/commit/60226a1a64d7f06e3869ff0087f4773376b4160e))\n* **credential-ld:** add support for browser environments ([#916](https://github.com/uport-project/veramo/issues/916)) ([435e4d2](https://github.com/uport-project/veramo/commit/435e4d260b1774f96b182c1a75ab2f1c993f2291))\n* **credential-status:** add credential status check plugin for Veramo ([#874](https://github.com/uport-project/veramo/issues/874)) ([cf62dfe](https://github.com/uport-project/veramo/commit/cf62dfe21ebc76bc95e98fc55bfe1113e80c138b))\n* **credential-status:** expect revoked boolean property from StatusMethods ([e00daa4](https://github.com/uport-project/veramo/commit/e00daa47865ea42d7bd8667f37c6e12fc21fd4b9))\n* **credential-status:** rename plugin interfaces and methods ([a5adaba](https://github.com/uport-project/veramo/commit/a5adaba21a97f525bf69d156df991afc234896ab)), closes [#981](https://github.com/uport-project/veramo/issues/981)\n* **credential-w3c:** add ICredentialPlugin interface in core package ([#1001](https://github.com/uport-project/veramo/issues/1001)) ([7b6d195](https://github.com/uport-project/veramo/commit/7b6d1950364c8b741dd958d29e506b95fa5b1cec)), closes [#941](https://github.com/uport-project/veramo/issues/941)\n* **credential-w3c:** add override policies to verifyPresentation ([#990](https://github.com/uport-project/veramo/issues/990)) ([06b3147](https://github.com/uport-project/veramo/commit/06b314717cbe35f696e706b1ebf5e54438115493)), closes [#375](https://github.com/uport-project/veramo/issues/375) [#954](https://github.com/uport-project/veramo/issues/954)\n* **credential-w3c:** align verification API between formats ([#996](https://github.com/uport-project/veramo/issues/996)) ([b987fc0](https://github.com/uport-project/veramo/commit/b987fc0903a31d3bbffb43fef872be4d6c62c2ad)), closes [#935](https://github.com/uport-project/veramo/issues/935) [#954](https://github.com/uport-project/veramo/issues/954) [#375](https://github.com/uport-project/veramo/issues/375) [#989](https://github.com/uport-project/veramo/issues/989)\n* CredentialIssuerEIP712 ([#899](https://github.com/uport-project/veramo/issues/899)) ([5d62c52](https://github.com/uport-project/veramo/commit/5d62c52e28a504470f8ba2c2cbd3c38eed7f435f))\n* **data-store-json:** BrowserLocalStorageStore ([#914](https://github.com/uport-project/veramo/issues/914)) ([7b520ab](https://github.com/uport-project/veramo/commit/7b520ab311bf55107bb0b4e6693695337b3fe200))\n* **data-store:** use DataSource instead of Connection ([#970](https://github.com/uport-project/veramo/issues/970)) ([3377930](https://github.com/uport-project/veramo/commit/3377930189bcbd43dfd155992093d2bbeb883335)), closes [#947](https://github.com/uport-project/veramo/issues/947)\n* **date-store-json:** add JSON object storage implementation ([#819](https://github.com/uport-project/veramo/issues/819)) ([934b34a](https://github.com/uport-project/veramo/commit/934b34a18b194928f90e7797289cc6f2243789ec))\n* define an interface for credential status manager ([#956](https://github.com/uport-project/veramo/issues/956)) ([6fbd22f](https://github.com/uport-project/veramo/commit/6fbd22fa6ba7bb1d4092afbded0f95c0d841bd97)), closes [#937](https://github.com/uport-project/veramo/issues/937) [#981](https://github.com/uport-project/veramo/issues/981)\n* **did-manager:** add`didManagerUpdate` method for full DID document updates ([#974](https://github.com/uport-project/veramo/issues/974)) ([5682b25](https://github.com/uport-project/veramo/commit/5682b2566b7c4f8f9bfda10e8d06a8d2624c2a1b)), closes [#971](https://github.com/uport-project/veramo/issues/971) [#960](https://github.com/uport-project/veramo/issues/960) [#948](https://github.com/uport-project/veramo/issues/948)\n* **did-provider-ethr:** use multiple networks per EthrDIDProvider ([#969](https://github.com/uport-project/veramo/issues/969)) ([0a88058](https://github.com/uport-project/veramo/commit/0a88058a5efddfe09f9f35510cc1bbc21149bf18)), closes [#968](https://github.com/uport-project/veramo/issues/968) [#893](https://github.com/uport-project/veramo/issues/893)\n* **did-provider-ethr:** Using meta account ([994e5af](https://github.com/uport-project/veramo/commit/994e5afb2789840bfb550cb00f5e9e3152669b94))\n* **did-resolver:** simplify DIDResolverPlugin constructor ([#986](https://github.com/uport-project/veramo/issues/986)) ([3a7eb0c](https://github.com/uport-project/veramo/commit/3a7eb0cccb1ed51dde19ae31602971ac930f24ae)), closes [#976](https://github.com/uport-project/veramo/issues/976)\n* **kms-web3:** add a KMS implementation backed by a web3 provider ([#924](https://github.com/uport-project/veramo/issues/924)) ([14f71af](https://github.com/uport-project/veramo/commit/14f71afbb72dca8274790d3b20b518ddfe4f2585)), closes [#688](https://github.com/uport-project/veramo/issues/688)\n* **kms-web3:** add ability to list provider accounts as keys ([#965](https://github.com/uport-project/veramo/issues/965)) ([31e3946](https://github.com/uport-project/veramo/commit/31e3946af3e281f823b41ee3f1c389d6cbc88c29)), closes [#933](https://github.com/uport-project/veramo/issues/933)\n* update did-discover-provider to search by DID likeness in addition to name ([3696a7a](https://github.com/uport-project/veramo/commit/3696a7aa275e97de0cd1048a7d32ead57abf9e7c))\n* **utils:** add 2 utility functions for inspecting ethr dids ([#842](https://github.com/uport-project/veramo/issues/842)) ([473e7fa](https://github.com/uport-project/veramo/commit/473e7fa08e33b3fb643bcc11cd1e3f6094099d7d))\n\n\n### BREAKING CHANGES\n\n* the `did-resolver` and connected libraries change the data-type for `ServiceEndpoint` to `Service` and the previous semantic has changed. Services can have multiple endpoints, not just a single string.\n* **cli:** ProfileDiscoveryProvider has been renamed to DataStoreDiscoveryProvider in #597. Please update your config accordingly\n\n\n\n\n\n## [3.1.5](https://github.com/uport-project/veramo/compare/v3.1.4...v3.1.5) (2022-06-10)\n\n\n### Bug Fixes\n\n* **ci:** improve documentation CI workflows ([#922](https://github.com/uport-project/veramo/issues/922)) ([0579764](https://github.com/uport-project/veramo/commit/057976402f3d7ea64082f500a454546c809d8c50))\n\n\n\n\n\n## [3.1.4](https://github.com/uport-project/veramo/compare/v3.1.3...v3.1.4) (2022-06-02)\n\n\n### Bug Fixes\n\n* **deps:** bump sqlite3 to 5.0.8 to enable build on apple M1 chips ([#911](https://github.com/uport-project/veramo/issues/911)) ([daeadb7](https://github.com/uport-project/veramo/commit/daeadb7ce5a86a5ef01e1b1d507133f11fb35d29))\n\n\n\n\n\n## [3.1.3](https://github.com/uport-project/veramo/compare/v3.1.2...v3.1.3) (2022-06-01)\n\n**Note:** Version bump only for package veramo\n\n\n\n\n\n## [3.1.2](https://github.com/uport-project/veramo/compare/v3.1.1...v3.1.2) (2022-05-30)\n\n\n### Bug Fixes\n\n* **remote-server:** fix error when resolving local did:web ([#905](https://github.com/uport-project/veramo/issues/905)) ([782f64a](https://github.com/uport-project/veramo/commit/782f64ace21c4710185fa80015b6435c8c37d088))\n\n\n\n\n\n## [3.1.1](https://github.com/uport-project/veramo/compare/v3.1.0...v3.1.1) (2022-01-13)\n\n\n### Bug Fixes\n\n* **remote-server:** api-key-auth ([#772](https://github.com/uport-project/veramo/issues/772)) ([6d1916b](https://github.com/uport-project/veramo/commit/6d1916b52f23aa818e023c35e6324ec5153e1a5c)), closes [#771](https://github.com/uport-project/veramo/issues/771)\n* **remote-server:** fix path for web-did-doc-router ([6bb1003](https://github.com/uport-project/veramo/commit/6bb10039434d45de3ffcc22bcfeadf796c774b08))\n\n\n\n\n\n# [3.1.0](https://github.com/uport-project/veramo/compare/v3.0.0...v3.1.0) (2021-11-12)\n\n\n### Bug Fixes\n\n* **data-store:** add support for entityPrefix ([#725](https://github.com/uport-project/veramo/issues/725)) ([801bb95](https://github.com/uport-project/veramo/commit/801bb95ddd22abaa61c938b025834132d4e8d3be)), closes [#724](https://github.com/uport-project/veramo/issues/724)\n* **deps:** update all non-major dependencies ([a6614e8](https://github.com/uport-project/veramo/commit/a6614e8ba9b34c6fdb7a9e3960b6fa20090ce44a))\n* **deps:** update builders-and-testers ([5c4fa9e](https://github.com/uport-project/veramo/commit/5c4fa9e90def0beea9873e647a3bdd1410987e00))\n* **deps:** update builders-and-testers ([828bfa2](https://github.com/uport-project/veramo/commit/828bfa20c6181c2e3a405ab13a06249f5112eb72))\n* **deps:** update builders-and-testers ([e31a4be](https://github.com/uport-project/veramo/commit/e31a4beea645169e468824c26122d69cf5c4050f))\n* **deps:** update builders-and-testers ([ba97cf1](https://github.com/uport-project/veramo/commit/ba97cf139e4379308edefee09f9b1dd7f36bb026))\n* **deps:** update builders-and-testers ([2e4e6e5](https://github.com/uport-project/veramo/commit/2e4e6e56f1cde9213966ed95671d97b529c0f505))\n* **deps:** update dependency commander to v8 ([#587](https://github.com/uport-project/veramo/issues/587)) ([9fc5c50](https://github.com/uport-project/veramo/commit/9fc5c509b6475b19c1f49fdf31cf7d5ed3fcc16a))\n* **deps:** update dependency did-jwt to v5.10.0 ([8424291](https://github.com/uport-project/veramo/commit/842429176b7e3a2433dcb0341cdadb5e5fcd71f0))\n* **deps:** update dependency did-jwt to v5.9.0 ([b9af0af](https://github.com/uport-project/veramo/commit/b9af0af9034297316313ac8f5d41f08e06c5a1ab))\n* **deps:** update dependency jsonpointer to v5 ([5c0ab9f](https://github.com/uport-project/veramo/commit/5c0ab9f2b0f377722abae6b3a175e22e7ad5471a))\n* **deps:** update dependency passport to ^0.5.0 ([a4dae24](https://github.com/uport-project/veramo/commit/a4dae24c8e8b2bf9e061e182076c1b89b71df306))\n* **deps:** update dependency ts-json-schema-generator to ^0.97.0 ([c20a409](https://github.com/uport-project/veramo/commit/c20a409d8bbc84bdd41809a722c1fd599707e46a))\n* **deps:** update did-libraries ([0ea73fc](https://github.com/uport-project/veramo/commit/0ea73fc1dba02c3d4c4df5befef265f7f573b2d1))\n* **deps:** update did-libraries ([417dc5d](https://github.com/uport-project/veramo/commit/417dc5dd157ee259b6f89f4987f1ecca444fb1d4))\n\n\n### Features\n\n* **cli:** add command to verify an agent configuration file ([#729](https://github.com/uport-project/veramo/issues/729)) ([2790ebc](https://github.com/uport-project/veramo/commit/2790ebcc2af72caa2a85f2068cdd832b548a2187))\n* **did-comm:** didcomm messaging using did:ethr ([#744](https://github.com/uport-project/veramo/issues/744)) ([1be5e04](https://github.com/uport-project/veramo/commit/1be5e04e09112c0823d776fe2d55117d71a7b448)), closes [#743](https://github.com/uport-project/veramo/issues/743)\n* **remote-server:** add default services option for WebDidDocRouter ([#715](https://github.com/uport-project/veramo/issues/715)) ([cfa6431](https://github.com/uport-project/veramo/commit/cfa64319a6ca27ec29330ea743104d0fa1a7eba0))\n* **remote-server:** add MessagingRouter `save` option ([#713](https://github.com/uport-project/veramo/issues/713)) ([0ca9b44](https://github.com/uport-project/veramo/commit/0ca9b448db8b467630a14bc64343082af29bc725))\n\n\n\n\n\n# [3.0.0](https://github.com/uport-project/veramo/compare/v2.1.3...v3.0.0) (2021-09-20)\n\n\n### Bug Fixes\n\n* **deps:** update all non-major dependencies ([8fc5312](https://github.com/uport-project/veramo/commit/8fc53120498ce2982e8ec640e00bbb03f6f4204e))\n* **deps:** update builders-and-testers ([acef171](https://github.com/uport-project/veramo/commit/acef171a1845ed4b1022efc5a8cd7a893db4e73a))\n* **deps:** update builders-and-testers ([ca746d2](https://github.com/uport-project/veramo/commit/ca746d2450ca0d08703a219e4f17f3f2966bd0db))\n* **deps:** update dependency @microsoft/api-extractor to v7.18.6 ([80b8f67](https://github.com/uport-project/veramo/commit/80b8f673539c0fa62bc24490d9b09acecbd3e4d1))\n* **deps:** update dependency @microsoft/api-extractor to v7.18.7 ([28d7cf0](https://github.com/uport-project/veramo/commit/28d7cf09afdef1b0905dfbe6520dc953a2da27cd))\n* **deps:** update dependency uint8arrays to v3 ([#669](https://github.com/uport-project/veramo/issues/669)) ([a5f5c42](https://github.com/uport-project/veramo/commit/a5f5c421d307b39d926f2d701ef3b9861c325dea))\n* **did-ethr-provider:** allow initialization with chainId number ([#678](https://github.com/uport-project/veramo/issues/678)) ([38cd0ae](https://github.com/uport-project/veramo/commit/38cd0aeb438ada57eb95464cabe072d02cbebb2b)), closes [#677](https://github.com/uport-project/veramo/issues/677)\n* **did-resolver:** always include didResolutionMetadata in result ([#682](https://github.com/uport-project/veramo/issues/682)) ([aabddb4](https://github.com/uport-project/veramo/commit/aabddb436b8b4dd78378da4704ba00147d074cdb)), closes [#681](https://github.com/uport-project/veramo/issues/681)\n* **key-manager:** handle eth_signTransaction with from field ([#675](https://github.com/uport-project/veramo/issues/675)) ([50f074d](https://github.com/uport-project/veramo/commit/50f074ddcab5dbafe5bad0ebcbfde8a9f91826e4)), closes [#674](https://github.com/uport-project/veramo/issues/674)\n\n\n### Features\n\n* **data-store:** initialize DB using migrations ([#679](https://github.com/uport-project/veramo/issues/679)) ([41f6240](https://github.com/uport-project/veramo/commit/41f6240d68a79338772230cbfff768189ab031ed)), closes [#676](https://github.com/uport-project/veramo/issues/676)\n* **key-manager:** move private key storage to kms-local ([#661](https://github.com/uport-project/veramo/issues/661)) ([6b1d135](https://github.com/uport-project/veramo/commit/6b1d135eedb1c58b715be8941d34312da39facb2)), closes [#539](https://github.com/uport-project/veramo/issues/539) [#540](https://github.com/uport-project/veramo/issues/540) [#680](https://github.com/uport-project/veramo/issues/680)\n\n\n### BREAKING CHANGES\n\n* **key-manager:** `keyManagetGet` no longer returns private key data\n* **key-manager:** `KeyStore` no longer requires a `SecretBox`\n* **key-manager:** `KeyManagementSystem` needs a `PrivateKeyStore`\n* **key-manager:** @veramo/cli configuration version update to 3.0\n\nIf you're already working with Veramo and wish to upgrade existing agents to veramo 3.0, you'll have to make some changes to your configuration, depending on how you're using the framework.\n\nIt boils down to these 3 steps:\n\n1. Update your database connection to use migrations\n2. Remove the `SecretBox` parameter from `KeyManager`\n3. Add a `PrivateKeyStore` parameter to `KeyManagementSystem` with a `SecretBox` that you were using before with `KeyManager` (and keep the same encryption key)\n\n* feat(key-manager): move private key storage to kms-local\n* **data-store:** database needs migrations for initialization. See #679 #676\nThe `@veramo/data-store` package relies on `typeorm` as a database abstraction.\nTypeorm has a connection flag `synchonize` which bootstraps the database along with schema and relations based on a set of `Entities` (annotated typescript classes).\nThis is very handy for fast development iterations but it is **not recommended for production** use because there is too much ambiguity possible when the `Entities` change, and there is a risk of data loss.\nThe recommended way to do things is to use the `migrations` mechanism. It allows you to migrate to new database schemas when necessary, and even customize the database to your own needs.\n\n**Going forward, this is the mechanism we will be recommending for connections.**\n\n\n\n\n\n## [2.1.3](https://github.com/uport-project/veramo/compare/v2.1.2...v2.1.3) (2021-09-01)\n\n**Note:** Version bump only for package veramo\n\n\n\n\n\n## [2.1.2](https://github.com/uport-project/veramo/compare/v2.1.1...v2.1.2) (2021-09-01)\n\n**Note:** Version bump only for package veramo\n\n\n\n\n\n## [2.1.1](https://github.com/uport-project/veramo/compare/v2.1.0...v2.1.1) (2021-08-11)\n\n\n### Bug Fixes\n\n* include tx type in eth_signTransaction ([#660](https://github.com/uport-project/veramo/issues/660)) ([d45129e](https://github.com/uport-project/veramo/commit/d45129ec7106c7fdb0ddfafc22bfa498d4e95d9d)), closes [#641](https://github.com/uport-project/veramo/issues/641)\n\n\n\n\n\n# [2.1.0](https://github.com/uport-project/veramo/compare/v2.0.1...v2.1.0) (2021-08-11)\n\n\n### Bug Fixes\n\n* **cli:** export recent methods from CLI local and remote ([44da085](https://github.com/uport-project/veramo/commit/44da0856bfdeb8f47ad85086e2d600d1e7e7f06a))\n* **credentials-w3c:** accept Presentations without Credentials ([#616](https://github.com/uport-project/veramo/issues/616)) ([2389cd0](https://github.com/uport-project/veramo/commit/2389cd0df080e968ee320d66fabf2e8a7b51ba47))\n* dataStoreDeleteVerifiableCredential ([#652](https://github.com/uport-project/veramo/issues/652)) ([840d89b](https://github.com/uport-project/veramo/commit/840d89ba097b89c061c9206057e05bd2e3d3a630)), closes [#649](https://github.com/uport-project/veramo/issues/649)\n* **deps:** update dependency @microsoft/api-extractor to v7.18.4 ([ec64d56](https://github.com/uport-project/veramo/commit/ec64d56eadf23a01946ad5cec3c4fcbd116ec073))\n* **deps:** update dependency ts-json-schema-generator to ^0.95.0 ([76e0133](https://github.com/uport-project/veramo/commit/76e0133ff818d805fe3ebbfb601073a568d1bd25))\n* **deps:** update dependency ws to v8 ([#643](https://github.com/uport-project/veramo/issues/643)) ([40fae61](https://github.com/uport-project/veramo/commit/40fae6198f427283c0db4db29fde53360deec37b))\n\n\n### Features\n\n* **data-store:** delete verifiable credential ([#634](https://github.com/uport-project/veramo/issues/634)) ([c7b0131](https://github.com/uport-project/veramo/commit/c7b0131c94e21c5c6800990c5743418b6b135a30)), closes [#635](https://github.com/uport-project/veramo/issues/635)\n\n\n\n\n\n## [2.0.1](https://github.com/uport-project/veramo/compare/v2.0.0...v2.0.1) (2021-07-20)\n\n\n### Bug Fixes\n\n* **cli:** export recent methods from CLI local and remote ([#625](https://github.com/uport-project/veramo/issues/625)) ([36bce08](https://github.com/uport-project/veramo/commit/36bce08095104fe7a1cb97f506da857e18fb8dc2))\n\n\n\n\n\n# [2.0.0](https://github.com/uport-project/veramo/compare/v1.2.2...v2.0.0) (2021-07-14)\n\n\n### Bug Fixes\n\n* **credential-w3c:** fixed handling of Ed25519 keys when creating VPs ([#534](https://github.com/uport-project/veramo/issues/534))([#516](https://github.com/uport-project/veramo/issues/516)) ([988c76c](https://github.com/uport-project/veramo/commit/988c76c46d391f3b76499ff141bdefe21e729c4a))\n* **deps:** bump did-jwt to 5.4.0 ([#528](https://github.com/uport-project/veramo/issues/528)) ([65f22cf](https://github.com/uport-project/veramo/commit/65f22cf6dcca48b5bb35331894536a2a567a1189))\n* **deps:** update all non-major dependencies ([9f40f7d](https://github.com/uport-project/veramo/commit/9f40f7d8b2a67e112b7ef2322ba887ee9033646c))\n* **deps:** update dependency @microsoft/api-extractor to v7.18.1 ([502c4c7](https://github.com/uport-project/veramo/commit/502c4c7ee6f674984e04adddcd555444cf6b94db))\n* **deps:** update dependency did-jwt to v5.5.2 ([ae0661f](https://github.com/uport-project/veramo/commit/ae0661fc5b225f80ebb102db60d55822b4786bce))\n* **deps:** update dependency dotenv to v10 ([#530](https://github.com/uport-project/veramo/issues/530)) ([1bd2c3f](https://github.com/uport-project/veramo/commit/1bd2c3fc3b7ce0f6ea8fbee00990eb1f8e7cd39f))\n* **deps:** update dependency dotenv to v9 ([#506](https://github.com/uport-project/veramo/issues/506)) ([4d1b720](https://github.com/uport-project/veramo/commit/4d1b720e1335cca7fc403bb17e6936909b1aaaf3))\n* **deps:** update dependency openapi-types to v9 ([#517](https://github.com/uport-project/veramo/issues/517)) ([3c33265](https://github.com/uport-project/veramo/commit/3c33265d3ebf65d6bc64f1fccda5461a1109b25c))\n* **deps:** update dependency ts-json-schema-generator to v0.92.0 ([a232e3a](https://github.com/uport-project/veramo/commit/a232e3a1481ab18682d96a8b4855f9824341aa12))\n* **did-comm:** avoid double conversion for some keys while packing ([78321a9](https://github.com/uport-project/veramo/commit/78321a9f22abf2c4541a6a4c49898c6aacb5d81f))\n* **did-comm:** fix potential null exception when unpacking message ([584766c](https://github.com/uport-project/veramo/commit/584766c2ed393b4540a4190681ca9c8461d0679d))\n* improve subject selection and verification for SDR ([#512](https://github.com/uport-project/veramo/issues/512)) ([01cb44e](https://github.com/uport-project/veramo/commit/01cb44eee6753f7bd4f5c31c38c6f56a708ff94e)), closes [#415](https://github.com/uport-project/veramo/issues/415)\n* **kms-local:** replace buggy didcomm clone with did jwt implementation ([#548](https://github.com/uport-project/veramo/issues/548)) ([9dea353](https://github.com/uport-project/veramo/commit/9dea3533c1936d53c1d5674c358679b17d623af2)), closes [#538](https://github.com/uport-project/veramo/issues/538)\n* **remote-server:** create an Ed25519 key for the default did:web ([a2f7f8c](https://github.com/uport-project/veramo/commit/a2f7f8c3fc6ab6cc276f6853104386bf9d923424))\n* **remote-server:** list DIDCommMessaging service entry by default for did:web ([339201a](https://github.com/uport-project/veramo/commit/339201a30f2f95f9b92251f233fb426d8290274f))\n* speed up secp256k1 keygen ([#551](https://github.com/uport-project/veramo/issues/551)) ([75e356c](https://github.com/uport-project/veramo/commit/75e356cac06e6eb3827da1789d3b39e6cd4f08f7)), closes [#549](https://github.com/uport-project/veramo/issues/549)\n* use optional chaining in SDR message handler ([#561](https://github.com/uport-project/veramo/issues/561)) ([ab24877](https://github.com/uport-project/veramo/commit/ab24877f941c37f1042fdc23683b1292b7f5bdc7)), closes [#560](https://github.com/uport-project/veramo/issues/560)\n\n\n### Features\n\n* add fake did method usable in tests ([4fc587c](https://github.com/uport-project/veramo/commit/4fc587cf07a56b2065c7c6beec2345001f5a5f40))\n* add support for did-comm over simple HTTP-based transports ([#610](https://github.com/uport-project/veramo/issues/610)) ([78836a4](https://github.com/uport-project/veramo/commit/78836a46d3ce71b568acaa98558b64f9c2b98167)), closes [#552](https://github.com/uport-project/veramo/issues/552) [#469](https://github.com/uport-project/veramo/issues/469)\n* **cli:** add DID discovery plugin to @veramo/cli ([#600](https://github.com/uport-project/veramo/issues/600)) ([a484f4c](https://github.com/uport-project/veramo/commit/a484f4c67e044d7c0299f128e15631cc8ae16f60))\n* **cli:** export new agent methods and request LD DIDDocument by default ([#617](https://github.com/uport-project/veramo/issues/617)) ([26d088b](https://github.com/uport-project/veramo/commit/26d088b86ecfd66a00cdef7c7bb926148f46fbc9))\n* **did-discovery:** implement a DID discovery plugin with simple providers ([#597](https://github.com/uport-project/veramo/issues/597)) ([6f01df3](https://github.com/uport-project/veramo/commit/6f01df38a732ba314d1e60728d65f511d26bfdcb))\n* implement didcomm v2 packing/unpacking ([#575](https://github.com/uport-project/veramo/issues/575)) ([249b07e](https://github.com/uport-project/veramo/commit/249b07eca8d2de9eb5252d71683d5f1fba319d60)), closes [#559](https://github.com/uport-project/veramo/issues/559) [#558](https://github.com/uport-project/veramo/issues/558)\n* **key-manager:** add generic signing capabilities ([#529](https://github.com/uport-project/veramo/issues/529)) ([5f10a1b](https://github.com/uport-project/veramo/commit/5f10a1bcea214cb593de12fa6ec3a91b3cb712bb)), closes [#522](https://github.com/uport-project/veramo/issues/522)\n* **key-manager:** add method to compute a shared secret ([#555](https://github.com/uport-project/veramo/issues/555)) ([393c316](https://github.com/uport-project/veramo/commit/393c316e27fb31b3c7fa63aae039b8fc6ae963ce)), closes [#541](https://github.com/uport-project/veramo/issues/541)\n* **key-manager:** implement JWE functionality directly in `key-manager` ([#557](https://github.com/uport-project/veramo/issues/557)) ([a030f0a](https://github.com/uport-project/veramo/commit/a030f0a9779e5158d9369d2f81107158fbaeac70)), closes [#556](https://github.com/uport-project/veramo/issues/556)\n* **remote-server:** express keys properly in did:web doc ([c33e39e](https://github.com/uport-project/veramo/commit/c33e39e6e33f5976aa4e5ff27ed3675b22113119)), closes [#618](https://github.com/uport-project/veramo/issues/618)\n* **sdr:** return UniqueVerifiableCredential for selective-disclosure ([#593](https://github.com/uport-project/veramo/issues/593)) ([9c6c090](https://github.com/uport-project/veramo/commit/9c6c0906607bc8f415042d3a855a2dd23a097725)), closes [#496](https://github.com/uport-project/veramo/issues/496)\n\n\n### BREAKING CHANGES\n\n* **sdr:** `getVerifiableCredentialsForSdr` and `validatePresentationAgainstSdr` now returns { hash: string, verifiableCredential: VerifiableCredential} instead of `VerifiableCredential`\n* **kms-local:** `@veramo/kms-local-react-native` is no more. On react-native, please use `@veramo/kms-local` instead, combined with `@ethersproject/shims`\n\n\n\n\n\n## [1.2.2](https://github.com/uport-project/veramo/compare/v1.2.1...v1.2.2) (2021-05-18)\n\n\n### Bug Fixes\n\n* **cli:** print entire JSON tree resulting from DID resolution ([#524](https://github.com/uport-project/veramo/issues/524)) ([e83d33c](https://github.com/uport-project/veramo/commit/e83d33cc0687a100587a439bdc8b8ed1219b9c24)), closes [#523](https://github.com/uport-project/veramo/issues/523)\n\n\n\n\n\n## [1.2.1](https://github.com/uport-project/veramo/compare/v1.2.0...v1.2.1) (2021-05-03)\n\n\n### Bug Fixes\n\n* integration tests and CLI config for did:key ([#498](https://github.com/uport-project/veramo/issues/498)) ([2ec0687](https://github.com/uport-project/veramo/commit/2ec068715d9fd4f2917c05f67755e226713cda1d))\n\n\n\n\n\n# [1.2.0](https://github.com/uport-project/veramo/compare/v1.1.2...v1.2.0) (2021-04-27)\n\n\n### Bug Fixes\n\n* **ci:** explicitly publish to `latest` tag from `main` branch ([#494](https://github.com/uport-project/veramo/issues/494)) ([c7a3b98](https://github.com/uport-project/veramo/commit/c7a3b98eb6ea6a1c25d49928f3bd7beb02d07ad3))\n* **deps:** update all non-major dependencies ([#462](https://github.com/uport-project/veramo/issues/462)) ([4a2b206](https://github.com/uport-project/veramo/commit/4a2b20633810b45a155bf2149cbff57d157bda3c))\n* **deps:** update dependency inquirer to v8 ([#395](https://github.com/uport-project/veramo/issues/395)) ([96c2129](https://github.com/uport-project/veramo/commit/96c21295cbb7bddeb88711e77daadde77d4f1a4d))\n* **deps:** update dependency multibase to v4 ([#396](https://github.com/uport-project/veramo/issues/396)) ([7ea7a8d](https://github.com/uport-project/veramo/commit/7ea7a8d38b36be82f8eb9f025783fd95e9b51508))\n* **deps:** update dependency multicodec to v3 ([#398](https://github.com/uport-project/veramo/issues/398)) ([9e23a10](https://github.com/uport-project/veramo/commit/9e23a102506792d199fed5820a01290de2474392))\n* **deps:** update dependency ngrok to v4 ([#433](https://github.com/uport-project/veramo/issues/433)) ([176e221](https://github.com/uport-project/veramo/commit/176e22144403ab3e2c885dc575394bae42d67a80))\n* **deps:** update dependency openapi-types to v8 ([#446](https://github.com/uport-project/veramo/issues/446)) ([7ab3737](https://github.com/uport-project/veramo/commit/7ab3737094beaf1312336b2ed31764121d59ccf1))\n* **deps:** update dependency ts-json-schema-generator to v0.90.0 ([d806ab5](https://github.com/uport-project/veramo/commit/d806ab5e7e934573796b84ec7adc54791b23efa5))\n* **remote-server:** get alias for request ([#455](https://github.com/uport-project/veramo/issues/455)) ([6ef7e3a](https://github.com/uport-project/veramo/commit/6ef7e3a8b45e5b25961cdadfd6f4026372e9d73f))\n* default CLI config OpenAPI schema ([#429](https://github.com/uport-project/veramo/issues/429)) ([c985d37](https://github.com/uport-project/veramo/commit/c985d37c63d5bfcc490f56ceead8c762c19142f0))\n* open api schema x-methods ([#414](https://github.com/uport-project/veramo/issues/414)) ([faa7940](https://github.com/uport-project/veramo/commit/faa7940c515bbd65dfaf9370594794f627099a38))\n* use URI encoded host in web-did-doc-router ([#384](https://github.com/uport-project/veramo/issues/384)) ([37186d5](https://github.com/uport-project/veramo/commit/37186d5cbdbbdbdccf0b6b9c56b1f78a482d1193)), closes [#383](https://github.com/uport-project/veramo/issues/383)\n* **deps:** update dependency ts-json-schema-generator to v0.84.0 ([#369](https://github.com/uport-project/veramo/issues/369)) ([86ec9b3](https://github.com/uport-project/veramo/commit/86ec9b378248945cb364ec2224235359f3ac9d32))\n\n\n### Features\n\n* adapt to did core spec ([#430](https://github.com/uport-project/veramo/issues/430)) ([9712db0](https://github.com/uport-project/veramo/commit/9712db0eea1a3f48cf0665d66ae715ea0c23cd4a)), closes [#418](https://github.com/uport-project/veramo/issues/418) [#428](https://github.com/uport-project/veramo/issues/428) [#417](https://github.com/uport-project/veramo/issues/417) [#416](https://github.com/uport-project/veramo/issues/416) [#412](https://github.com/uport-project/veramo/issues/412) [#397](https://github.com/uport-project/veramo/issues/397) [#384](https://github.com/uport-project/veramo/issues/384) [#394](https://github.com/uport-project/veramo/issues/394)\n* add MemoryDIDStore and MemoryKeyStore ([#447](https://github.com/uport-project/veramo/issues/447)) ([5ab1792](https://github.com/uport-project/veramo/commit/5ab1792f080cc319a9899e39dc9b634a05aa4f7c))\n* add native resolver for did:key ([#458](https://github.com/uport-project/veramo/issues/458)) ([a026f24](https://github.com/uport-project/veramo/commit/a026f247ad91dcb3a996e0e95b0fe253cf538f8b)), closes [#352](https://github.com/uport-project/veramo/issues/352)\n* add option to keep payload fields when creating JWT VC/VP ([#431](https://github.com/uport-project/veramo/issues/431)) ([43923e1](https://github.com/uport-project/veramo/commit/43923e18b8e0b68c4552489d568ab16748156970)), closes [#394](https://github.com/uport-project/veramo/issues/394)\n* **core:** add ability to define the agent context type ([#350](https://github.com/uport-project/veramo/issues/350)) ([89255b9](https://github.com/uport-project/veramo/commit/89255b9a648c38656aea05131750e68497d04c27))\n* **did-provider-key:** add did:key provider; fixes [#335](https://github.com/uport-project/veramo/issues/335) ([#351](https://github.com/uport-project/veramo/issues/351)) ([42cd2b0](https://github.com/uport-project/veramo/commit/42cd2b08a2fd21b5b5d7bdfa57dd00ccc7184dc7)), closes [decentralized-identity/did-jwt#78](https://github.com/decentralized-identity/did-jwt/issues/78)\n* **url-handler:** allow for URL redirects ([#362](https://github.com/uport-project/veramo/issues/362)) ([#366](https://github.com/uport-project/veramo/issues/366)) ([92a86d6](https://github.com/uport-project/veramo/commit/92a86d6f8cf652e731ca662085efe78aeab198eb))\n\n\n\n\n\n## [1.1.2](https://github.com/uport-project/veramo/compare/v1.1.1...v1.1.2) (2021-04-26)\n\n\n### Bug Fixes\n\n* add names to TypeORM entities ([#480](https://github.com/uport-project/veramo/issues/480)) ([750bfcf](https://github.com/uport-project/veramo/commit/750bfcf825b3d18080f7bf308b3a33a4da71a5eb))\n\n\n\n\n\n## [1.1.1](https://github.com/uport-project/veramo/compare/v1.1.0...v1.1.1) (2021-03-09)\n\n\n### Bug Fixes\n\n* **cli:** validate config file version number ([#413](https://github.com/uport-project/veramo/issues/413)) ([fb5668c](https://github.com/uport-project/veramo/commit/fb5668cb95cee2b26bb06e55b20d0007f57a6a02))\n\n\n\n\n\n# [1.1.0](https://github.com/uport-project/veramo/compare/v1.0.1...v1.1.0) (2021-01-26)\n\n\n### Bug Fixes\n\n* make privateKey property of Key entity nullable ([#342](https://github.com/uport-project/veramo/issues/342)) ([aa48ed9](https://github.com/uport-project/veramo/commit/aa48ed9930395c66aa8f952b8545c9b918e303ae))\n* **deps:** update dependency commander to v7 ([#330](https://github.com/uport-project/veramo/issues/330)) ([f8a7566](https://github.com/uport-project/veramo/commit/f8a75665f02bbee74c89554a67588a6a33968d85))\n* **deps:** update dependency z-schema to v5 ([#323](https://github.com/uport-project/veramo/issues/323)) ([9cadf37](https://github.com/uport-project/veramo/commit/9cadf378dba487b1a664a6277eafffd629c65600))\n\n\n### Features\n\n* **core:** make agent context public readonly ([#347](https://github.com/uport-project/veramo/issues/347)) ([802948e](https://github.com/uport-project/veramo/commit/802948ea72edf8b00c42115f73430720debabed9))\n\n\n\n\n\n## 1.0.1 (2020-12-18)\n\n\n### Bug Fixes\n\n* **core:** Improve identity lookup speed ([#230](https://github.com/uport-project/veramo/issues/230)) ([b2f6332](https://github.com/uport-project/veramo/commit/b2f6332d5b4e6e62235a796fdc43170d58cae63b)), closes [#229](https://github.com/uport-project/veramo/issues/229)\n* **daf-resolver:** import cross-fetch in universal-resolver.ts ([#303](https://github.com/uport-project/veramo/issues/303)) ([57be4ea](https://github.com/uport-project/veramo/commit/57be4ea5d1c1ad5dc9598c035432c4ad874bc44b)), closes [#302](https://github.com/uport-project/veramo/issues/302)\n* OpenAPI name, version and x-methods ([#301](https://github.com/uport-project/veramo/issues/301)) ([cbad7c0](https://github.com/uport-project/veramo/commit/cbad7c0558f4ba515cad995374a4e11d2afdc2e0))\n* **daf-did-jwt:** Fix parsing of JWT with missing `typ` in header ([#293](https://github.com/uport-project/veramo/issues/293)) ([48e4c60](https://github.com/uport-project/veramo/commit/48e4c607f78ac19be2ba83291cb68f414edb5b6b)), closes [#291](https://github.com/uport-project/veramo/issues/291)\n* **daf-did-jwt:** Fix verification of EdDSA JWTs ([#289](https://github.com/uport-project/veramo/issues/289)) ([b97f2a3](https://github.com/uport-project/veramo/commit/b97f2a3bc6bfc5f9df143e7e79840e568d6a9606)), closes [#288](https://github.com/uport-project/veramo/issues/288)\n* **daf-express:** Fix behavior of CLI HTTPS server behind proxy ([#292](https://github.com/uport-project/veramo/issues/292)) ([3c39484](https://github.com/uport-project/veramo/commit/3c394844236fe78d7d9499c35861345dcff5212a))\n* **daf-resolver:** Fixed daf-resolver configuration ([#298](https://github.com/uport-project/veramo/issues/298)) ([dfcf32a](https://github.com/uport-project/veramo/commit/dfcf32a88bfe8353270a567d40bcfab25ddbffe9)), closes [#205](https://github.com/uport-project/veramo/issues/205)\n* **message-handler:** Rewire promise rejections as `Error` objects ([#300](https://github.com/uport-project/veramo/issues/300)) ([04446d4](https://github.com/uport-project/veramo/commit/04446d4e2d2dba8ff2ae5695014686ef49891804)), closes [#294](https://github.com/uport-project/veramo/issues/294)\n* Add replyTo & replyUrl to message ([c6cbd30](https://github.com/uport-project/veramo/commit/c6cbd30e74820f4c9d37c0d333ca9cfff4783b89))\n* Allow empty issuers in sdr credential request ([453a51c](https://github.com/uport-project/veramo/commit/453a51ca0d9e01893eab014ce70f42c2e17afa9d))\n* allow to pass in a custom registry address ([c785167](https://github.com/uport-project/veramo/commit/c785167f6b3bf6b51325e431fba80c242204f590)), closes [/github.com/decentralized-identity/ethr-did-resolver/blob/develop/src/ethr-did-resolver.js#L187](https://github.com//github.com/decentralized-identity/ethr-did-resolver/blob/develop/src/ethr-did-resolver.js/issues/L187)\n* Another missing await ([b924f92](https://github.com/uport-project/veramo/commit/b924f925ad47810aaa43876cef0d49a42e6d126f))\n* babel running out of memory when running jest ([92e285e](https://github.com/uport-project/veramo/commit/92e285e184f56e3ca9441ecbcdc6b287727cb4f9))\n* Big value handling ([#167](https://github.com/uport-project/veramo/issues/167)) ([39a76b6](https://github.com/uport-project/veramo/commit/39a76b60ecc085d7ce0c476b0b20e166b415d408))\n* Changing some copy in CLI ([ed2c044](https://github.com/uport-project/veramo/commit/ed2c0447a6973d55a3be8bfa4acb9439ff7c83c9))\n* Checking if credentialSubject is array ([2f83192](https://github.com/uport-project/veramo/commit/2f83192a47b39369fd1ccad3b0f4a3c70dd4a893))\n* Claim value nullable ([4cb85b2](https://github.com/uport-project/veramo/commit/4cb85b2aa677eab5c39011f0e32bb7ebc86d7b84))\n* CLI ([86b6f9e](https://github.com/uport-project/veramo/commit/86b6f9e7a97ce29cbdffaf167dd568c66996c0ff))\n* CLI graphql typeDefs and resolvers ([88626d3](https://github.com/uport-project/veramo/commit/88626d37621929b3383fdef5849dbea795fbe053))\n* CLI sdr flow ([f630b76](https://github.com/uport-project/veramo/commit/f630b76cda60d6a0b16d51eb779dfd533bd30756))\n* CLI SDR flow ([eb31f43](https://github.com/uport-project/veramo/commit/eb31f434a2cbb7571e8f4d5b6667f08373dfaff2))\n* CLI sqlite and pg deps ([31fc85a](https://github.com/uport-project/veramo/commit/31fc85a16c8edc098fac13c0a96faad151fda208))\n* Create identities from required issuers to resolve gql queries ([b93d7ad](https://github.com/uport-project/veramo/commit/b93d7adf001e71dbf92164cbd4c44e15f939bed2))\n* Creating VC ([f8caa6a](https://github.com/uport-project/veramo/commit/f8caa6a859fdf6838daa489e9f30d74154b41dc7))\n* Credential id type ([39d8d18](https://github.com/uport-project/veramo/commit/39d8d18ce7c87db179a4fcb73fc333c544ce841f))\n* CredentialStatus field type ([40e97a6](https://github.com/uport-project/veramo/commit/40e97a6e6daeb8357332456967799a18434bfbaf))\n* Daf REST headers type ([b22c540](https://github.com/uport-project/veramo/commit/b22c540d20a459ad1b00979be2bd82be90aeb3a4))\n* Daf-elem-did missing peer deps ([747b8f9](https://github.com/uport-project/veramo/commit/747b8f9fb4ec52e82cde519adaae92bc7bd46a0a))\n* Daf-libsodium debug ([babbfe6](https://github.com/uport-project/veramo/commit/babbfe63b51f4b6430d0dcd75ca2a2e599c184af))\n* Daf-rest overrides ([0d6c031](https://github.com/uport-project/veramo/commit/0d6c031df77a4c0f0dd3649e3303998323f4bde5))\n* DataStoreORM claim subject ([e332dcc](https://github.com/uport-project/veramo/commit/e332dcc2bfa261bc43a2c4e2a7ab2bbf13b647df))\n* DataStoreORM interface ([719959a](https://github.com/uport-project/veramo/commit/719959a59ac8877523f36254da71609fd5e222eb))\n* DataStoreORM messagesQuery ([be2badb](https://github.com/uport-project/veramo/commit/be2badbe359e7a5c470f50472d022a87bd3d4c2b))\n* DataStoreORM saving claims ([281b493](https://github.com/uport-project/veramo/commit/281b493374ca3d981a828207f14190dcb95c93a6))\n* DB migrations ([14b578e](https://github.com/uport-project/veramo/commit/14b578e87740cd3d19e5ae728791a192cc50bc4c))\n* Deps for daf-rest ([564f2ba](https://github.com/uport-project/veramo/commit/564f2ba4909636c25cb827706608bcc65b7b54e4))\n* Disable schema validation by default ([#278](https://github.com/uport-project/veramo/issues/278)) ([7bb77cd](https://github.com/uport-project/veramo/commit/7bb77cde56415e8e909cabc235c62188d8147d0e)), closes [#255](https://github.com/uport-project/veramo/issues/255) [#275](https://github.com/uport-project/veramo/issues/275)\n* Disable schemaValidation in CLI default config ([#280](https://github.com/uport-project/veramo/issues/280)) ([8785a5b](https://github.com/uport-project/veramo/commit/8785a5b0193adae6738c23a49eda64c7b2a2a335)), closes [#278](https://github.com/uport-project/veramo/issues/278) [#275](https://github.com/uport-project/veramo/issues/275) [#255](https://github.com/uport-project/veramo/issues/255)\n* Ethr-did debug ([688595f](https://github.com/uport-project/veramo/commit/688595f0dc6f1ec7e06f82a7e33aebe13263c66b))\n* Example queries ([5933e50](https://github.com/uport-project/veramo/commit/5933e5003964935d0e1d39c273b2fe38a639ce1b))\n* Expiration Date ([c7212f9](https://github.com/uport-project/veramo/commit/c7212f97cee76dcb83ee748e934abb4b793b4640))\n* export context ([99fd267](https://github.com/uport-project/veramo/commit/99fd267c70946e24df5dd8b42f8345aadc9366c2))\n* export context ([f6265f9](https://github.com/uport-project/veramo/commit/f6265f9a3b78b3c9ad10ade4e3bd96cc37d1d9d6))\n* Failing CI ([1264b99](https://github.com/uport-project/veramo/commit/1264b99766d5b062f19e99326ed7cc1f5f19de89))\n* Failing CI ([53b114e](https://github.com/uport-project/veramo/commit/53b114e2f0dbb9414317f64af59b15654827e792))\n* Failing CI ([f910731](https://github.com/uport-project/veramo/commit/f910731180b64d1c666cf46bcaa1107f60eb5813))\n* Failing CI ([3f31953](https://github.com/uport-project/veramo/commit/3f3195376a54a4dfd605eea521b0beac8de0e160))\n* fixes failing audience query tests ([40408dc](https://github.com/uport-project/veramo/commit/40408dce03a3c23dff07c89f2455d89c60893ebf))\n* Fixing replyTo types ([bd9d606](https://github.com/uport-project/veramo/commit/bd9d606890060e27b5d236b58e7f404c2c36d613))\n* Generating message.id if not set ([5ce04e5](https://github.com/uport-project/veramo/commit/5ce04e5f8ebbba4368b84dffc563696d79a8fee2))\n* Generating message.id if not set ([fabf5f6](https://github.com/uport-project/veramo/commit/fabf5f64b9f0733a3a533d037203527f26758106))\n* GetIdentityProviders ([d1bdbc2](https://github.com/uport-project/veramo/commit/d1bdbc2cac03012b5573eaf2b531c2b707f5e5e5))\n* GraphQL orderBy ([bb06094](https://github.com/uport-project/veramo/commit/bb060941fab367540d1fd8cdbc4ad6de51fb00ab))\n* handle jwt messages correctly in daf-url in browser environments ([db26132](https://github.com/uport-project/veramo/commit/db261325a606b0077cc333600b844101be1cd009))\n* IdentityController for web-did ([a829991](https://github.com/uport-project/veramo/commit/a829991f0d16b424e756684cbca8d159b8195cac))\n* IdentityManager ([1f2da11](https://github.com/uport-project/veramo/commit/1f2da1150d4895db3f21711bb1d11f619961a321))\n* IdentityManager ([32a1c03](https://github.com/uport-project/veramo/commit/32a1c0335bb66b6055efe851c2e2ac72348b54a3))\n* IdentityProvider WIP ([feec69e](https://github.com/uport-project/veramo/commit/feec69e49f1760884b263feee63fc3e2d833c7e5))\n* IdentityStore ([53eb972](https://github.com/uport-project/veramo/commit/53eb9721f2a64d231955a555dc2465adb2c8c668))\n* IdentityStore saving services ([9a35ee9](https://github.com/uport-project/veramo/commit/9a35ee9e7a5866c106961c0f1cc4dc2fd1fad0c3))\n* IHandleMessage interface ([0ab68fd](https://github.com/uport-project/veramo/commit/0ab68fd945e719dc375757650c52752bba3338a7))\n* IIdentityManager interface ([b6d1e36](https://github.com/uport-project/veramo/commit/b6d1e36252b74c9decd95a46bb371df092fa6479))\n* IKeyManager arg types ([f79967e](https://github.com/uport-project/veramo/commit/f79967e1d9fbed7abbd1648d3f1f259c8f3cd92e))\n* Import DID support for daf-react-native-libsodium ([#257](https://github.com/uport-project/veramo/issues/257)) ([e290482](https://github.com/uport-project/veramo/commit/e290482ec342ecbce1fe48b39082c128e073be23))\n* JSON schema for W3CCredential ([#287](https://github.com/uport-project/veramo/issues/287)) ([543615f](https://github.com/uport-project/veramo/commit/543615f33eecb2aa7472e9f3a63514392d12a4e0))\n* JWT verification with multiple audiences ([dbbb85f](https://github.com/uport-project/veramo/commit/dbbb85f4261ac0d1a0f8080fcb734c66eb311696))\n* Keeping app specific payload fields ([24ad82a](https://github.com/uport-project/veramo/commit/24ad82a9abd1e1a5c3cef91efea7a17637b958c3))\n* KeyManagerSignEthTX ([c936a00](https://github.com/uport-project/veramo/commit/c936a001a270086378e26cf7fa5054dbc8d7d94e))\n* Local copy of W3C types ([29c6b0e](https://github.com/uport-project/veramo/commit/29c6b0efc37f181d40aff560d4d481eb84e0ea9a))\n* Message handler chain ([58b0629](https://github.com/uport-project/veramo/commit/58b062921e02ca4160b1a90efa56e1c5c89ba8bb))\n* MessageHandler ([21a78e3](https://github.com/uport-project/veramo/commit/21a78e3a16257d2c9d956acfc46576955688aed4))\n* MessageHandler chain ([198a33a](https://github.com/uport-project/veramo/commit/198a33a0000181ba83be1c9848f035e1a69c2cd1))\n* Missing await ([9c36f84](https://github.com/uport-project/veramo/commit/9c36f8415f27c91824af97bbc6e2415aba9c5feb))\n* Missing dependency ([773dbb2](https://github.com/uport-project/veramo/commit/773dbb2c890428157ae4c7218b7e29e0853d738c))\n* OpenAPI schema ([2ef0bc7](https://github.com/uport-project/veramo/commit/2ef0bc7ae4a425e29eae4aaad982048314c9ca14))\n* OpenAPI types dep for daf-rest ([63e7565](https://github.com/uport-project/veramo/commit/63e7565d3e2d02e8a170effa67838b9a25c13e22))\n* Optional dependency of daf-elem-did ([8c733b8](https://github.com/uport-project/veramo/commit/8c733b8e06e0ef0a379fa43a534733e37063834b))\n* Pass ethr-did registry param down to the identity controller ([a0a2a98](https://github.com/uport-project/veramo/commit/a0a2a98600f6a0c22105e5f9d7ab2a8d174d57c2))\n* Plugin schemas ([1fedaa5](https://github.com/uport-project/veramo/commit/1fedaa5ed378be30cdcd76a8d241444bd2306af7))\n* React example SDR ([b741e72](https://github.com/uport-project/veramo/commit/b741e72af01cda04202f67bb570d546b0ca029e9))\n* React-graphql using new api ([fe53366](https://github.com/uport-project/veramo/commit/fe533669de3ff882a9c23357ba2eed35e432d493))\n* Remove daf-data-store from packages ([f3bc819](https://github.com/uport-project/veramo/commit/f3bc8192ff7f5418544ea44a8d4d86bff7b8fd1e))\n* Remove dup ([82629e1](https://github.com/uport-project/veramo/commit/82629e13d49385cf7dfb562c7cc9bbe21cfd210c))\n* Remove postinstall ([2577983](https://github.com/uport-project/veramo/commit/257798312edaf4817f906f714e0527bf7c112bc8))\n* Remove postinstall ([9fad446](https://github.com/uport-project/veramo/commit/9fad4468fcedd567cf0e2dd06b319d50cd10a9a0))\n* Remove static Credential.credentialStatus ([f9a06af](https://github.com/uport-project/veramo/commit/f9a06afcd01fc9e0452535d10d32158414490ea4))\n* Remove static Credential.credentialStatus ([719fddc](https://github.com/uport-project/veramo/commit/719fddc558dd7ec2925e3a8d695a5de4c65e91cd))\n* Removing daf-data-store from examples ([7c74e18](https://github.com/uport-project/veramo/commit/7c74e184df6f5d2c1d0872b9db86da51365b5e47))\n* Removing EcdsaSignature type ([3e3a684](https://github.com/uport-project/veramo/commit/3e3a6843a77cf389be9aa6414a2f77ebe26adc62))\n* Removing uuid from id ([df12094](https://github.com/uport-project/veramo/commit/df1209461b4b197b5f19c9d5bf4a71caf0c57f7d))\n* Resolver debug info ([5a32a63](https://github.com/uport-project/veramo/commit/5a32a630884486934530cdb31b3cf8fb887a44da))\n* Resolver tests ([65b3ff0](https://github.com/uport-project/veramo/commit/65b3ff0cb46fdd5913bdca31c31726c2fa9bbe14))\n* resolvers and handlers didn't match schema ([85c38a2](https://github.com/uport-project/veramo/commit/85c38a206a163e3ed601b1ad2ac330f275d7ac4a))\n* Rest client error handling ([b871a39](https://github.com/uport-project/veramo/commit/b871a39fd46930871c6695a4f9e7aa66b886f617))\n* Saving DIDComm message ([7d0201e](https://github.com/uport-project/veramo/commit/7d0201ec584371a6257b651beffbad7776fe5d5c))\n* SDR GQL reason ([ae23c88](https://github.com/uport-project/veramo/commit/ae23c8886b59d07f5891d4c2973abfc90f069e3b))\n* Sdr helper function types ([602a672](https://github.com/uport-project/veramo/commit/602a672ad81d6a9c728dc0968c04847710a181f9))\n* SDR message handler replyTo ([f04920f](https://github.com/uport-project/veramo/commit/f04920fcc7e19839b39038f155d2941fc7163567))\n* SDR only for sdr message type ([b77c5c7](https://github.com/uport-project/veramo/commit/b77c5c740ac96a2bb5fb2ca17348f0ffdedc5d9a))\n* Setting credentialSubject last ([b832b7c](https://github.com/uport-project/veramo/commit/b832b7c0ffcc3c095d2122fce3287328000faefd))\n* TAgent definition ([ce1af94](https://github.com/uport-project/veramo/commit/ce1af94c639b4b98ad54212608d850d2a1833580))\n* Test daf-did-jwt ([d6383c7](https://github.com/uport-project/veramo/commit/d6383c739d40edb55055b13ea9e931b440b629e4))\n* Test daf-url ([12e2c1e](https://github.com/uport-project/veramo/commit/12e2c1e12f450bc2e2ec4240ef037ba1d7de2f74))\n* Throwing errors for non existing entities ([a48e7ef](https://github.com/uport-project/veramo/commit/a48e7ef0afe4e44070a85867eb86bf039a7ae3c8))\n* Translating issuanceDate to nbf ([51f0eff](https://github.com/uport-project/veramo/commit/51f0effa5f911a9432f6d6880d2b23915875001d))\n* Type error and CORS error in react-app example ([#258](https://github.com/uport-project/veramo/issues/258)) ([9f7dac4](https://github.com/uport-project/veramo/commit/9f7dac46d8ed247974778df37b7cf6c9f28a6193))\n* Types ([c35e452](https://github.com/uport-project/veramo/commit/c35e452679ce86378d6a37e6dbace855d8583b84))\n* Types for IW3c ([56cf141](https://github.com/uport-project/veramo/commit/56cf1412e9811f0fec675d9210e82614a6b15ea0))\n* Uniresolver config ([8dbdae1](https://github.com/uport-project/veramo/commit/8dbdae10a623de7ab5304a62075ebfc9f7572b97))\n* Updated examples: pass dbConnection to Agent ([d84872d](https://github.com/uport-project/veramo/commit/d84872d70a5f422b5f6d6eca3db3236d5e671661))\n* Use baseUrl in CLI server ([7b18ac6](https://github.com/uport-project/veramo/commit/7b18ac61559e56ee260e3073a8fcc67d3065f243))\n* Use the first audience did for message.to ([c71eec7](https://github.com/uport-project/veramo/commit/c71eec784526b44f22d76307ac0e83b0e125d965))\n* Using cross-fetch in did-comm ([2a931ff](https://github.com/uport-project/veramo/commit/2a931ff46666ca66da2544266cb0ad0a12e2dada))\n* Valid OpenApi v3 schema ([32175c3](https://github.com/uport-project/veramo/commit/32175c340df69aea0d8fa91f6d962523fbe2dac4))\n* Version takes only two parameters ([5951fe4](https://github.com/uport-project/veramo/commit/5951fe416186d295ccd9fc10aa17f75f47e5bbf0))\n* W3c message createdAt ([59656f8](https://github.com/uport-project/veramo/commit/59656f8d1aee9479f195dd949712032b75c1dd04))\n* W3c tests ([2bc4084](https://github.com/uport-project/veramo/commit/2bc40847e61786b981a6c61afdb66213beaa8496))\n* **deps:** enable verification of ES256K signatures with default did:ethr: docs ([2e1bd33](https://github.com/uport-project/veramo/commit/2e1bd331c3fc054f86380d977a78ec2305029a8e))\n*  Adding sub in sdr gql ([45bb8bf](https://github.com/uport-project/veramo/commit/45bb8bfe0d8ea270e08a0578a8d995d4e04b21c2))\n* Adding id to serviceMessagesSince ([45bb45b](https://github.com/uport-project/veramo/commit/45bb45b8b59034e6f793d486e06efc998c53584e))\n* Adding profileImage ([1063057](https://github.com/uport-project/veramo/commit/1063057a65078f57a9e9493ef2ef4f76f13d177e))\n* Adding tag in VP ([c154015](https://github.com/uport-project/veramo/commit/c154015de13a420a685f2115817bef2774a3cb9d))\n* Adding tag to vc/vp ([3c876a9](https://github.com/uport-project/veramo/commit/3c876a9993c4bb48af2c289a095d4a6144a34f12))\n* Allow version changes ([3096edb](https://github.com/uport-project/veramo/commit/3096edb9b1e7900925e91ca56e051c7d6154ee6c))\n* Await crypto_sign_keypair ([c97ba6b](https://github.com/uport-project/veramo/commit/c97ba6be2bed9644e81b58cd164f012abdde4a16))\n* Await in IdentityProvider and KMS ([a5b36d9](https://github.com/uport-project/veramo/commit/a5b36d9b96cc1ee6a2e0c1cb95f4697c39b1586b))\n* Await in listDids ([94c759c](https://github.com/uport-project/veramo/commit/94c759c10d4a022fb081472058782766792dfecc))\n* Bug in findCredentialsByFields ([e9f263a](https://github.com/uport-project/veramo/commit/e9f263a45a6b121aef4729bdb45a1be39b753af6))\n* Building ([60f3777](https://github.com/uport-project/veramo/commit/60f3777510514051e75822ae8f350e28e1f64e54))\n* Catching edge case ([3c1a935](https://github.com/uport-project/veramo/commit/3c1a9357b36c51f6ee586726008e7e5c00a177d4))\n* Check if file exists ([89f604f](https://github.com/uport-project/veramo/commit/89f604f3243cdae39848827484967be00ff9a4d7))\n* Claim hash ([d00b9c6](https://github.com/uport-project/veramo/commit/d00b9c6ed1fed1c76cb7ed4939e2f017979360a2))\n* CLI defaultPath ([20b70d9](https://github.com/uport-project/veramo/commit/20b70d92d464540a1af938b1a45df3b6d39a733f))\n* Cli VP ([3db8186](https://github.com/uport-project/veramo/commit/3db8186a1d6bbaa9726a8de3499055f872d41380))\n* CLI VP type is VerifiablePresentation ([1558555](https://github.com/uport-project/veramo/commit/1558555252366aa126fde1fe9ecf161de613d72d))\n* Copy ([9cbff8a](https://github.com/uport-project/veramo/commit/9cbff8a47022a2dc3378ff2f2df78a2f0e0656af))\n* Corrected dependency ([5c0768e](https://github.com/uport-project/veramo/commit/5c0768e1086e01563d923eb5718b45d9e6eb24c7))\n* Credential creation ([7ddac1f](https://github.com/uport-project/veramo/commit/7ddac1f3fe602b1b9de1302f67b55c205f6c688a))\n* Data store await for meta data ([5d96401](https://github.com/uport-project/veramo/commit/5d96401530025b76007669e7d28a394378a4fbe9))\n* Debug info ([b49cac9](https://github.com/uport-project/veramo/commit/b49cac9d26f86904cadde231ec4ad50e3bfa1129))\n* Debug info in daf-node-sqlite3 ([b0b5b70](https://github.com/uport-project/veramo/commit/b0b5b704bc8ceda994c9ca4b1e369b28192c1af1))\n* Decoding base64 keys ([04bb839](https://github.com/uport-project/veramo/commit/04bb8392d7b842992f8d65fb826dfbd9188f0ff9))\n* Decrypting ([db07fdb](https://github.com/uport-project/veramo/commit/db07fdbfb2c45e5d169b54f1ca5a1825b610f250))\n* Deduplicating messages ([eda582b](https://github.com/uport-project/veramo/commit/eda582b32923d6cd251fc82023dc18b361122c5e))\n* Default TGE with WebSocket support ([23ebcea](https://github.com/uport-project/veramo/commit/23ebcea0fbc3aa39410b538cb3a08e89916e2232))\n* Dependencies ([531a51f](https://github.com/uport-project/veramo/commit/531a51fa741b3464210059f85d1b543bb3fe07a9))\n* Deps ([0d29fbb](https://github.com/uport-project/veramo/commit/0d29fbb2f3a72fc80b8353c3584831ddb2958541))\n* Deps ([a230eba](https://github.com/uport-project/veramo/commit/a230ebac52b7916ebe75b27ef1c37694e0f601c7))\n* Eager relations ([da07cb2](https://github.com/uport-project/veramo/commit/da07cb21f1bcb6da7a742f28f8a4e3c9dc8ad1ba))\n* Eager relations ([9938384](https://github.com/uport-project/veramo/commit/993838438299cf3d5d71b6d59780bcdb0b4d351e))\n* Ethr-did identity provider web3Provider ([a5d6af2](https://github.com/uport-project/veramo/commit/a5d6af2032130a7eff1722bc47b758a824906be6))\n* Ethr-did toEthereumAddress ([7335390](https://github.com/uport-project/veramo/commit/733539014eb4104bb8a4f82b42fef92cc7f0c067))\n* Ethr-did TTL = 1 year ([fa6b6c5](https://github.com/uport-project/veramo/commit/fa6b6c59dc2caa189fa5675dcf86139945376af9))\n* EventEmmiter ([dc52b55](https://github.com/uport-project/veramo/commit/dc52b55aad6c612266ce136636f6aa65e524b59b))\n* Example ([dcf46d6](https://github.com/uport-project/veramo/commit/dcf46d66a9ff1cc7712b0984843db4c0984ae972))\n* Example deps ([fc01968](https://github.com/uport-project/veramo/commit/fc019680a0a00ce0c3d5608f651e245496ce8a69))\n* Examples ([9887732](https://github.com/uport-project/veramo/commit/988773235ffc6967761c54205a7cc412037fa255))\n* Examples ([e4581e1](https://github.com/uport-project/veramo/commit/e4581e148ee1fdf19efd4f3506a6eb8e2a6789f9))\n* Express example ([1c33310](https://github.com/uport-project/veramo/commit/1c333108accc7feaaaba5a7864db12efac626881))\n* Fetching credentials for SDR ([e91668e](https://github.com/uport-project/veramo/commit/e91668e664fca7d9826fd45e179cafe1b3cbe975))\n* Find Messages ([5234c54](https://github.com/uport-project/veramo/commit/5234c541257271010ebf3e70bb620e3fcc02ff14))\n* Fix credential select ([6c5f9e9](https://github.com/uport-project/veramo/commit/6c5f9e97d4ad7d61ec8dab257ec2a1c5a9166f24))\n* Fix multi query wrapper component ([e2b5056](https://github.com/uport-project/veramo/commit/e2b5056027dc3b4ec439b4be5fbb86d794349515))\n* Fix rendering route sidepanels ([7c10ce9](https://github.com/uport-project/veramo/commit/7c10ce9921734b042c36a62af0fd646cde605f26))\n* GQL export ([63b9c23](https://github.com/uport-project/veramo/commit/63b9c23e21e297347e8b24e1ed0cfdb6bd8d5524))\n* GQL export ([eacc969](https://github.com/uport-project/veramo/commit/eacc9697e87bbf6a91db8d9bd5195aea096a13c4))\n* GQL newMessage data field ([48181b9](https://github.com/uport-project/veramo/commit/48181b93a5504e82373894598a81149f3c529a69))\n* GQL return raw while validating message ([53573bc](https://github.com/uport-project/veramo/commit/53573bc07cbaabc92c34baaa3096acd279aa985f))\n* Handle raw message in cli ([53ffa0d](https://github.com/uport-project/veramo/commit/53ffa0d41bc453ce471be81999b93d98fbf16baa))\n* Hiding explore item ([14211c5](https://github.com/uport-project/veramo/commit/14211c57a55a49440ae8bcb1a707d7d8db7f9b6b))\n* Id-hub example ([7198e23](https://github.com/uport-project/veramo/commit/7198e23b6878654f91c1c0aaa9654743bf853dda))\n* Identity.isManaged ([38ad11e](https://github.com/uport-project/veramo/commit/38ad11ec9abf74143acda726725820c0d6e29e14))\n* IdentityStore provider ([88cdd5a](https://github.com/uport-project/veramo/commit/88cdd5a02ff01dd7a1b4665fefffa062c1c431f4))\n* Initializing DB before any action ([7b5959e](https://github.com/uport-project/veramo/commit/7b5959e9ea8c4e5a93e8aeeb98baf020c0388a9c))\n* IssuanceDate  is mandatory ([38edef6](https://github.com/uport-project/veramo/commit/38edef62201aad6b2efdc9ce5b6e7597f0aa1652))\n* Latest message timestamps ([048974b](https://github.com/uport-project/veramo/commit/048974b7016a1deb990aacf2b84a09a172bd3f6d))\n* Loading URLs that have a hostname ([2e65531](https://github.com/uport-project/veramo/commit/2e655319314ec2aaaef5ef1a9263eb8ee556ece8))\n* Message sub can be null ([6599296](https://github.com/uport-project/veramo/commit/6599296b2560fddbd63aaa4b45bb920e3fcd0b41))\n* Mixup with pk and sk ([e9b912f](https://github.com/uport-project/veramo/commit/e9b912f8e8172ff621afd4e4d0f1a087aa19ac93))\n* Moved did-resolver to devDeps ([3ae8c1c](https://github.com/uport-project/veramo/commit/3ae8c1cec0c0d0b827d627cc181a85935fae2e88))\n* Moving dependency ([3296b23](https://github.com/uport-project/veramo/commit/3296b23f4236f947d8c9b56c4c129c519cb5daac))\n* NewMessage mutation ([3c9428e](https://github.com/uport-project/veramo/commit/3c9428e8e40f9702271aceee8dca4393d0ca7515))\n* Ordering in latestMessageTimestamps ([fca9995](https://github.com/uport-project/veramo/commit/fca9995f1fd9c1fa09ba024f8d0eeb417d97b9ee))\n* React native deps ([bda41bc](https://github.com/uport-project/veramo/commit/bda41bcadaef91cce61f753d07639323c80d34fb))\n* React native peerDependencies ([a18482b](https://github.com/uport-project/veramo/commit/a18482bda54385f67772f60e3ac37a8ee75e096a))\n* Readme ([7b598cb](https://github.com/uport-project/veramo/commit/7b598cb398fd2ea001b0ae07c958ed7274df085e))\n* Readme ([385739c](https://github.com/uport-project/veramo/commit/385739c67da2b18b0b9b0907b51572617264e335))\n* Referenced project ([801d2c6](https://github.com/uport-project/veramo/commit/801d2c6e89062f00737379e629009a8454084350))\n* Remove auto ci beta release ([936b7d1](https://github.com/uport-project/veramo/commit/936b7d13ac145491a2de692eefb57a088d339313))\n* Remove debug info ([a7753dd](https://github.com/uport-project/veramo/commit/a7753ddb1875f5c7d02d1ad4f24b21f4963df338))\n* Remove duplicate JWTs from VP Fixes [#48](https://github.com/uport-project/veramo/issues/48) ([f24ffea](https://github.com/uport-project/veramo/commit/f24ffea078908a394181bb92b93331287c01381d))\n* Remove unused ws ([55e0fcb](https://github.com/uport-project/veramo/commit/55e0fcb1a68e86c7003909fb03f92ee1b357026c)), closes [#91](https://github.com/uport-project/veramo/issues/91)\n* Removing action handler ([4371bcd](https://github.com/uport-project/veramo/commit/4371bcd577d8c7a2f03ad88b6d18165e04881ea1))\n* Removing context entities ([1a5c4c9](https://github.com/uport-project/veramo/commit/1a5c4c9827fdc98338395311d7b176ebd09332f3))\n* Removing daf-sodium-fs and encryptionmanager ([1ea064d](https://github.com/uport-project/veramo/commit/1ea064dabf8d7875c060411283d2d80c04d9c801))\n* Removing dependency ([af5c76a](https://github.com/uport-project/veramo/commit/af5c76a3fe1d583d014fb8f1f7ff5f3f4a3f7dfa))\n* Removing dependency ([4318e80](https://github.com/uport-project/veramo/commit/4318e8020645dd4858c8f895880d94659557acba))\n* Removing deps ([8db9286](https://github.com/uport-project/veramo/commit/8db9286b94ac7060035ab75552e2646820326b70))\n* Removing DIDComm-js ([94f8975](https://github.com/uport-project/veramo/commit/94f8975f50a577a284a1c0076033b0b5fc1ee6d0))\n* Removing duplicate saveMessage ([ab2c6a0](https://github.com/uport-project/veramo/commit/ab2c6a091e79af4f2d62e3a566bf8fc0059261a6))\n* Removing encryption key manager ([65ba8a2](https://github.com/uport-project/veramo/commit/65ba8a212bedd64215cb96c0bf8a6c2245bd5cb0))\n* Removing gql from web-demo ([c3676f0](https://github.com/uport-project/veramo/commit/c3676f0e3913f292b077a4bfaed6d0c70fb5a742))\n* Removing MessageMetaData entity ([353449c](https://github.com/uport-project/veramo/commit/353449c5a2f9a9c0919b4e38a44012fdf98ec8a9))\n* Renaming to sender and receiver ([bf33a2d](https://github.com/uport-project/veramo/commit/bf33a2de268cf07b06faa04283ec066573c37ffc))\n* Resolver config ([2fdba37](https://github.com/uport-project/veramo/commit/2fdba37833c5ad7f40a9bdb70e69eab91ce291ca))\n* Running local cli ([8609019](https://github.com/uport-project/veramo/commit/8609019ddc94f3d5fb1d973228740a6ec4e460cc))\n* SDR findCredentialsByFields iss ([6838d04](https://github.com/uport-project/veramo/commit/6838d04b4c97cf7c11c17f4b8cdfdcebb274161a))\n* Selective disclosure gql resolver ([f4ec808](https://github.com/uport-project/veramo/commit/f4ec808cc73fa6096556e0535482611b46c45656))\n* ServiceManager and AbstractServiceController ([284badc](https://github.com/uport-project/veramo/commit/284badc52b420c637d0c7bc6823b71f1ea5c449d))\n* Sign auth token for every sync query ([2a978cb](https://github.com/uport-project/veramo/commit/2a978cbe349bc1c059c713e6ba1ca7a3c8904d77))\n* TG subscribtion ([5334fc6](https://github.com/uport-project/veramo/commit/5334fc65b8008b3ddd699fa495b2665a4f168a8c))\n* TG subscription ([a389612](https://github.com/uport-project/veramo/commit/a38961238af36277cf1cf8316148cb947aa37f6a))\n* TG subscription connection params ([b7b79d8](https://github.com/uport-project/veramo/commit/b7b79d8de874b6010c0017b66b2e775c76c9d514))\n* Unifying debug messages ([efb4f3b](https://github.com/uport-project/veramo/commit/efb4f3bf9f6d3f0d412eb80da7bb4ae92ce8ca72))\n* Using local version of DIDComm lib ([d09a326](https://github.com/uport-project/veramo/commit/d09a326793c45c2a58c8a30da6263fc7f3ff7668))\n* **package:** SDR query subject ID type ([5867c2d](https://github.com/uport-project/veramo/commit/5867c2d01b1a69d44e4e8f62ed82cb3e0095af5e))\n* Return empty array for empty threads ([fdb1e54](https://github.com/uport-project/veramo/commit/fdb1e54fbd43657dd42180926cc160da7245db31))\n* Returning newMessage sender & receiver ([72bfb60](https://github.com/uport-project/veramo/commit/72bfb60e95e2195b4f17c05b16878bfa4050b427))\n* SDR can have empty to field ([108f22c](https://github.com/uport-project/veramo/commit/108f22c96dd96453fd6f811cf32aeffdcc97b2be))\n* TG findEdges fromDID ([dc63238](https://github.com/uport-project/veramo/commit/dc63238b34d8d448ded854c7635a55750d02f122))\n* TGE subscribtion query ([17863a2](https://github.com/uport-project/veramo/commit/17863a201edd7f561dab7b1831c8ba45a13abe02))\n* Typescript types ([72c1899](https://github.com/uport-project/veramo/commit/72c18993ddba6a7a75ae8397e6549cdd29dccb31))\n* Typo ([0a47c70](https://github.com/uport-project/veramo/commit/0a47c70fac8c9624c73343c8067d11fab3cd2c9d))\n* Unit tests ([d764531](https://github.com/uport-project/veramo/commit/d764531fe022b1cef4abe33c9a434a53cb2fa23f))\n* ValidateMessage can throw an error ([d00dcdd](https://github.com/uport-project/veramo/commit/d00dcddaf69eae26445f7b2ac1fe79b0027e297c)), closes [#10](https://github.com/uport-project/veramo/issues/10)\n* VC / VP hash ([d4fa78f](https://github.com/uport-project/veramo/commit/d4fa78ff0d03d64db6806fde9fdd6c7201ce1969))\n* Version bump ([00f0d2f](https://github.com/uport-project/veramo/commit/00f0d2ff3aea786e1f6c5142e41f387c09f8ef3e))\n* Version bump ([d374d73](https://github.com/uport-project/veramo/commit/d374d739bbf28655ed9cb546d7d785fafad94f4c))\n* Version bump ([2829540](https://github.com/uport-project/veramo/commit/2829540c247255251961415d63e87b28fb7a00a5))\n* Version bump ([b474df8](https://github.com/uport-project/veramo/commit/b474df8441c242a39de00a04b18805a42c13101a))\n* Version bump ([b28e17f](https://github.com/uport-project/veramo/commit/b28e17f19cf2f78c33e5157b7ef498a694c761f2))\n* VP aud ([bc9f498](https://github.com/uport-project/veramo/commit/bc9f4988c66fbeadb7e6ce38aec446fd5d38339d))\n* VP type is VerifiablePresentation ([d59c2b8](https://github.com/uport-project/veramo/commit/d59c2b88b0c44c5efc0f17377967930c5404f769))\n* W3C VP subject is aud ([991e64b](https://github.com/uport-project/veramo/commit/991e64b3189405ddf2c3a43acc15c2ffe652380a))\n* Wait for messages to be validated ([717b285](https://github.com/uport-project/veramo/commit/717b2858b2c96efdfb39f85297f4026585b366be))\n\n\n### Code Refactoring\n\n* Rename Identity to Identifier ([#308](https://github.com/uport-project/veramo/issues/308)) ([7812e51](https://github.com/uport-project/veramo/commit/7812e51ee250265bcc308e7fd4db1ee8b2e408a4))\n* **daf-cli:** Refactor CLI command palette ([#304](https://github.com/uport-project/veramo/issues/304)) ([a5a0670](https://github.com/uport-project/veramo/commit/a5a0670f5162e3f8753fa338ed00e64397c8acc0)), closes [#264](https://github.com/uport-project/veramo/issues/264)\n* Refactor and add inline documentation to daf-w3c package ([f0e2cb9](https://github.com/uport-project/veramo/commit/f0e2cb9748dc04b0d46ac1d80bac9a0b7f7546cd))\n\n\n### Features\n\n* ActionSendDIDComm ([49e6841](https://github.com/uport-project/veramo/commit/49e68412478b6bada8d524c719cb3ff86987015a))\n* Add event system to agent ([#262](https://github.com/uport-project/veramo/issues/262)) ([9a6747e](https://github.com/uport-project/veramo/commit/9a6747e84037613d396e14a6f68cb2de8275ddca))\n* Add GraphQL IdentityManager methods ([189a218](https://github.com/uport-project/veramo/commit/189a21843feb25a075f693377573f2b031c0de02))\n* Add port option to cli server ([4f66a38](https://github.com/uport-project/veramo/commit/4f66a388eaafd3657882569c60e5f3d9edf6b4b3))\n* add removeKey, removeService methods to ethr-did-provider ([#310](https://github.com/uport-project/veramo/issues/310)) ([faccca6](https://github.com/uport-project/veramo/commit/faccca6abd5edfda633414daba6694a78bc80ec2)), closes [#144](https://github.com/uport-project/veramo/issues/144)\n* Add version cmd to cli ([64069e9](https://github.com/uport-project/veramo/commit/64069e9d60008007a801f127280430538b23b553))\n* Added credentialType to the Claim ([45a4da2](https://github.com/uport-project/veramo/commit/45a4da2a76c4bb7ccb6c2d89cfce4c6e56d2cca0))\n* Added id and tag fields ([0b62eaa](https://github.com/uport-project/veramo/commit/0b62eaa30ceb2f79192a476ff9f6809cbe5b1ccf))\n* Added identityManagerGetIdentityByAlias ([43d0817](https://github.com/uport-project/veramo/commit/43d081761f68015b92554224e458853070f12be2))\n* Added identityManagerImportIdentity ([ea7ba3a](https://github.com/uport-project/veramo/commit/ea7ba3a8e827423748e5e350cdcf4103560fb8f0))\n* Added identityManagerSetAlias ([a2bd513](https://github.com/uport-project/veramo/commit/a2bd5134e9f6c58a619f63e8f3523e24e27d530e))\n* Added IIdentityManagerGetIdentitiesArgs ([1e0c9aa](https://github.com/uport-project/veramo/commit/1e0c9aa5ca7247007abc930b214c98610578fb71))\n* Added keyManagerGetKeyManagementSystems ([9741462](https://github.com/uport-project/veramo/commit/974146281b400fa9d3108a8428d0d9da09dd2292))\n* Added save to GQL handleMessage ([be23418](https://github.com/uport-project/veramo/commit/be234186f5b2fc10881a9963bb269c48d960efa2))\n* Adding createProfilePresentation ([ae5e73f](https://github.com/uport-project/veramo/commit/ae5e73fab9c21a7a2ed485be88d9f0b7cfab51c4))\n* Adding ethr-did gas and ttl config ([d910b14](https://github.com/uport-project/veramo/commit/d910b140f78efc69b80adffacd00058b9477fc94))\n* Adding some key manager methods ([ec6645d](https://github.com/uport-project/veramo/commit/ec6645dbfffd509b7e721dd18bad593b68edd6ab))\n* Agent dbConnection constructor option ([e3dfc2f](https://github.com/uport-project/veramo/commit/e3dfc2f9a76fbe15ebb4cd2741d8ff580836408f))\n* API key / Bearer token support in CLI ([45e7591](https://github.com/uport-project/veramo/commit/45e7591dc70a862e40ac3c8ab3536ad5d80632b7))\n* Authorized agent methods ([53f9454](https://github.com/uport-project/veramo/commit/53f9454b6ec7495d2cfc0e2e9f34ccb0845c8a39))\n* Beta of daf-elem-did ([fe286e3](https://github.com/uport-project/veramo/commit/fe286e347107cfc29a93cfaff085e524f4e2cff5))\n* Bump version ([63dd12d](https://github.com/uport-project/veramo/commit/63dd12da63b2245d32379b435a7a774a56a1f019))\n* Bump version ([cf659c0](https://github.com/uport-project/veramo/commit/cf659c09768325031fe66adc0228eb1d976f2932))\n* Changed DID type from ID to String ([55ccdd4](https://github.com/uport-project/veramo/commit/55ccdd42f104bc93df4621a854719cb4723b3d89))\n* CLI config ([5a3391e](https://github.com/uport-project/veramo/commit/5a3391e77790e0b10268c4e189f34c5f20246616))\n* CLI create-config ([ec96204](https://github.com/uport-project/veramo/commit/ec96204c9d175456a8a9ce83991bceedd2a81369))\n* CLI Data explorer ([fb7d155](https://github.com/uport-project/veramo/commit/fb7d1554794860e71a941cdcb8e991b18609e608))\n* CLI execute object type ([e04b0ee](https://github.com/uport-project/veramo/commit/e04b0ee97a0796c9b24d1d378d4f1e8da8b1028b))\n* CLI execute uses OpenApi (mvp) ([cb310dd](https://github.com/uport-project/veramo/commit/cb310dd194677f42e2d054d27859d99ecae63696))\n* CLI handling ngrok errors ([eed46d4](https://github.com/uport-project/veramo/commit/eed46d4b21ae7aebd94f515e27bfb67dc3bd9efa))\n* CLI server homepage template ([ac9cf52](https://github.com/uport-project/veramo/commit/ac9cf526bbbc210de15e933970b5eac3ab646c17))\n* CLI upgraded to the latest API ([b440dd1](https://github.com/uport-project/veramo/commit/b440dd10badc03d71d59f23eddd80d93a680efe0))\n* Constructing agent from YAML config ([7a2498f](https://github.com/uport-project/veramo/commit/7a2498fd8e3a9b4a2591cb644205f5afe62ba776))\n* Credential Status in data model ([24e2d5d](https://github.com/uport-project/veramo/commit/24e2d5d1e46a33dde96e7a519b171c0453d34401))\n* daf-elem-did ([62776c2](https://github.com/uport-project/veramo/commit/62776c274838b686f954e66482ae99e336bb2e16))\n* Daf-express overrides ([31a0970](https://github.com/uport-project/veramo/commit/31a09708000f2c505c4d2a71201d3739da2f713e))\n* Daf-react-native-libsodium ([dbec780](https://github.com/uport-project/veramo/commit/dbec78036118587e7a86dc1826d5c3c91e534069))\n* Daf-rest & daf-express ([9c9a597](https://github.com/uport-project/veramo/commit/9c9a597d40059a11fe64780c459233490cb1a5ef))\n* DB Migration CredentialStatus ([44fd36d](https://github.com/uport-project/veramo/commit/44fd36d0a97af96bfca74d1a9953293c00003dcc))\n* Debug agent.execute ([fb58ddc](https://github.com/uport-project/veramo/commit/fb58ddce18cb99e4aeb1f7eb7604e4a65fa293f3))\n* Default IdentityProvider ([39f2e39](https://github.com/uport-project/veramo/commit/39f2e39685a58d647822aea73a8bb3f7fb76fe25))\n* Default IdentityProvider ([3334f6e](https://github.com/uport-project/veramo/commit/3334f6edea1ebd51dde1b416b153294f4b945e4b))\n* Docker image and docker-compose example ([84ddcad](https://github.com/uport-project/veramo/commit/84ddcad8b54fec0b53297cbfe11275af06922cd6))\n* Dynamic OpenAPI schema ([f12236b](https://github.com/uport-project/veramo/commit/f12236beeabd408cbc1d3a47848add82cbd52050))\n* enable CORS in daf-cli server by default ([#284](https://github.com/uport-project/veramo/issues/284)) ([aca46b3](https://github.com/uport-project/veramo/commit/aca46b3fdf4e9ca4af620fbd7938aeb87c1f9e95))\n* Enable setting headers to DAF DID Comm ([#239](https://github.com/uport-project/veramo/issues/239)) ([03f3dbb](https://github.com/uport-project/veramo/commit/03f3dbb9c1f8a2b061234cdddf4d70953209c1b3))\n* Encrypting private keys with SecretBox ([8833931](https://github.com/uport-project/veramo/commit/883393192cc830534cfec892b4ce271a09bff99d))\n* Encrypting private keys with SecretBox ([b8cbdd4](https://github.com/uport-project/veramo/commit/b8cbdd4f96e51ea15786328b2821509cc59e4ba3))\n* ENV support in yml config ([1dee7b2](https://github.com/uport-project/veramo/commit/1dee7b2b45716b9d2f5e0560228166ab59ce8f60))\n* Exporting findCredentialsForSdr ([ef1c973](https://github.com/uport-project/veramo/commit/ef1c9735bb718197c92c1f920a978eadf1318ef6))\n* Express router ([4b8c3d6](https://github.com/uport-project/veramo/commit/4b8c3d6747a6797500468ba907a37a231fd929a4))\n* Generate plugin schema ([#277](https://github.com/uport-project/veramo/issues/277)) ([c90473a](https://github.com/uport-project/veramo/commit/c90473a67731eb0cfcaf545afe0d64dfee77809c))\n* Generating OpenAPI schema (broken) ([e319c41](https://github.com/uport-project/veramo/commit/e319c41d3d9a5f4beb8dfdd17221fb9ef5dc04ef))\n* Generating plugin schemas ([d4450cd](https://github.com/uport-project/veramo/commit/d4450cd30e27ebc8bf961400b871757662e202c3))\n* GQL count queries ([9e859c1](https://github.com/uport-project/veramo/commit/9e859c10c945a26c0a63b69acfbeee62f0bfaac3))\n* Gql Not operator ([dd624c2](https://github.com/uport-project/veramo/commit/dd624c29a103b6f2e279d1b853a26a040ba7d6a9))\n* GraphQL client settings: apiUrl, apiKey ([9b1fd12](https://github.com/uport-project/veramo/commit/9b1fd128a287667c7007e2acb534f5969e0d5711))\n* GraphQL KeyManager ([2b092e9](https://github.com/uport-project/veramo/commit/2b092e99d1c4f8b7609257a990b76754c6e351ca))\n* GraphQL message handler ([10d31cc](https://github.com/uport-project/veramo/commit/10d31cc96b293ca0c2f48fa3e39cb94612146e55))\n* GraphQL methods ([6446f2d](https://github.com/uport-project/veramo/commit/6446f2d1dd1d39cc6b308d7a4b9646b1c7d6e2fa))\n* GraphQL w3c ([967b916](https://github.com/uport-project/veramo/commit/967b9168536e5c5a2ba484e3f912ba4661952f8f))\n* Handling credentials in SDR message ([32d4a2c](https://github.com/uport-project/veramo/commit/32d4a2c95bde9ec9f4f99679f00ef71f00aa1896))\n* Identity provider for did:web ([9b20fb1](https://github.com/uport-project/veramo/commit/9b20fb13da21865d50f6e0680e0d7da040a3d75c))\n* Identity provider for did:web ([ba030bf](https://github.com/uport-project/veramo/commit/ba030bf708e8e79dcf117685ace2286bff6ea69d))\n* Identity saveDate updateDate ([e845a84](https://github.com/uport-project/veramo/commit/e845a841684fa092152bccc91cc1e582bae456c9))\n* Multiple audience dids ([eaa1a40](https://github.com/uport-project/veramo/commit/eaa1a40d9d3728533be63660ad4cdef6bdbdeded))\n* Network config for daf-resolver ([5efd82c](https://github.com/uport-project/veramo/commit/5efd82c5343dd99dc644a49774210b31bb2a717a))\n* Query credentials for did ([a39f956](https://github.com/uport-project/veramo/commit/a39f9568e2b4ef3e8b0ee62f23c96451ca427cd4))\n* Remote methods example ([9e61006](https://github.com/uport-project/veramo/commit/9e610067343c3363b7eadec2b0ef75644fa62bd4))\n* **release:** Fix package descriptions and trigger new minor release ([#233](https://github.com/uport-project/veramo/issues/233)) ([e67f4da](https://github.com/uport-project/veramo/commit/e67f4da055d1f0b1b0ba4205726b79979d234a06))\n* **release:** Trigger a new minor release ([#234](https://github.com/uport-project/veramo/issues/234)) ([7c905e1](https://github.com/uport-project/veramo/commit/7c905e1ea7c4851f7f06e87e06efe34d4eac7b0f))\n*  REST api handling incoming msg ([372cd25](https://github.com/uport-project/veramo/commit/372cd25de7030228bd12ea62eeaff824c7f6526c))\n* Activity feed ([50bc5d5](https://github.com/uport-project/veramo/commit/50bc5d51788e39e18ad64b0470d62852835cfbf2))\n* Add JWT output for credential.ts and sdr.ts in cli ([c16dea6](https://github.com/uport-project/veramo/commit/c16dea6da130375ecc4e98f116fae54df45d1b9a))\n* Add whitelisted issuers in SDR ([f486f07](https://github.com/uport-project/veramo/commit/f486f071e3e3ccd55e70d01255275d7b2e770169))\n* Added actionSignVc mutation ([4ef9a15](https://github.com/uport-project/veramo/commit/4ef9a15374364b91026f4a0f37ed85dd60c3cb50))\n* Added actionSignVp mutation ([7cedec1](https://github.com/uport-project/veramo/commit/7cedec1d384eeba53012a2cd319c6c0bad0282f6))\n* Added daf-did-jwt ([22898d4](https://github.com/uport-project/veramo/commit/22898d491af031e72059e226e5aa39ccb25b59a6))\n* Added data-explorer to daf-cli ([eebe040](https://github.com/uport-project/veramo/commit/eebe040ca4e8017e2e59072047c0f479811b2004))\n* Added react-native-async-storage ([1270740](https://github.com/uport-project/veramo/commit/127074033bef2cebc1e31d477f5b9f71ffa024d5))\n* Adding daf-ethr-did-local-storage ([f73b435](https://github.com/uport-project/veramo/commit/f73b4358be5407634c37f89dc21ad9f145629284))\n* Adding daf-random ([f362f6b](https://github.com/uport-project/veramo/commit/f362f6bc6f5c8c9c820c0b1551515543ec17cb51))\n* Adding daf-react-native-libsodium ([6446411](https://github.com/uport-project/veramo/commit/6446411d2acdd52b75242e56ab5428f80f8ba261))\n* Adding list of messages ([72dca61](https://github.com/uport-project/veramo/commit/72dca619b99ea2afcc216df07ef789043998702e))\n* All ethr Identity Providers updated ([552c967](https://github.com/uport-project/veramo/commit/552c967d0efac27149ea8e1a329163bdf24f8a11))\n* Breaking. New did management interfaces ([c384159](https://github.com/uport-project/veramo/commit/c3841591189dc307ba281a72186dbb878d9aa5be))\n* Bump minor version (npm conflicts) ([67b77af](https://github.com/uport-project/veramo/commit/67b77af9c33684a19ed3e34a740c776f0f419d06))\n* Bump minor version (npm conflicts) ([34cefc2](https://github.com/uport-project/veramo/commit/34cefc2370c6b207d4b7d490571c0df0653b1d8f))\n* cli identity management improvements ([489b5e9](https://github.com/uport-project/veramo/commit/489b5e927151f6913ad9fcbaf67c0359d88a6341))\n* Create + Send SDR request ([d87127b](https://github.com/uport-project/veramo/commit/d87127b97283a9fdcc8f9ac5b244f23b0a187cd8))\n* Create and send VP from CLI ([c7e1360](https://github.com/uport-project/veramo/commit/c7e1360ad5fb8c788635ad33d084c67feec0f7e6))\n* daf-cli credential sending, receiving ([7ca187e](https://github.com/uport-project/veramo/commit/7ca187e63b264a59ddfe0805410d56e317d2dbae))\n* daf-cli identity-manager ([8f89979](https://github.com/uport-project/veramo/commit/8f8997953c8e7e64bd0e76240b51460d40d00f28))\n* daf-debug ([ff8d66b](https://github.com/uport-project/veramo/commit/ff8d66b735d2f29d48077ad9ff07305a778ef38e))\n* daf-did-comm ([2ee986f](https://github.com/uport-project/veramo/commit/2ee986fcb5b8cb235ac18e421e6e430980948481))\n* daf-ethr-did-fs ([c2e8024](https://github.com/uport-project/veramo/commit/c2e80246b694cb9f55b9c9116c2aac8d0257927d))\n* Daf-ethr-did-fs using experimental interface ([cecffd8](https://github.com/uport-project/veramo/commit/cecffd8de4fe161abe0013ab7b715860a591c365))\n* daf-ethr-did-react-native ([20a47d5](https://github.com/uport-project/veramo/commit/20a47d581aed0c2aed7d5c19ae79603010a0a859))\n* daf-react-native-sqlite3 ([cdcb5ac](https://github.com/uport-project/veramo/commit/cdcb5ac9a8e151abbc6adfdbd1b048908b58f573))\n* daf-resolver, daf-resolver-universal ([2b2c00f](https://github.com/uport-project/veramo/commit/2b2c00f9312ae67cdeca4a5f15b729391226500e))\n* daf-selective-disclosure ([7bbcf12](https://github.com/uport-project/veramo/commit/7bbcf12952fa7a1fa726b944f09e84e416560a40))\n* daf-sodium-fs ([42b5d19](https://github.com/uport-project/veramo/commit/42b5d1975e8970e3ecb26cdc54731a1cd618fa35))\n* daf-trust-graph ([2ba3c4f](https://github.com/uport-project/veramo/commit/2ba3c4fb4346c0522a56855dbeb3631ddea356b5))\n* daf-w3c ([b0da9ae](https://github.com/uport-project/veramo/commit/b0da9aea42be9fb84e6d65d157c6815ef4a91758))\n* Data deduplication ([c5c10b1](https://github.com/uport-project/veramo/commit/c5c10b17eebd1d6f82a43f0d5cc46da9b9270c3e))\n* Data-store upgrade ([c4c0810](https://github.com/uport-project/veramo/commit/c4c081023fb331bf7cb8c19ca2e5c79e8db6b506))\n* Delet identity and conditions ([37ca91e](https://github.com/uport-project/veramo/commit/37ca91e223f25ef1ca14cea8cc61531643571650))\n* Entities ([7f1c85f](https://github.com/uport-project/veramo/commit/7f1c85f84c64d49435ee1c8049b00559f3863442))\n* Ethr-did export/import ([0f8ab11](https://github.com/uport-project/veramo/commit/0f8ab111a5e96d3a687b318605ab2ff607c7bf23)), closes [#105](https://github.com/uport-project/veramo/issues/105)\n* Example expressjs ([3b79989](https://github.com/uport-project/veramo/commit/3b79989a25e9740cc477c8428182a78346e80d7c))\n* Example id-hub ([9187906](https://github.com/uport-project/veramo/commit/9187906f0e63bbf68bb92eeb54950288fcf3c62e))\n* Experimentation ([134a812](https://github.com/uport-project/veramo/commit/134a81227e6abb132d8d216dec7dee36d34b9710))\n* Experiments with KeyStore IdentityStore ([cca8825](https://github.com/uport-project/veramo/commit/cca88254f14414771c9f1d3523cfb72a4954c080))\n* Fetching URL to get the message payload ([72596e4](https://github.com/uport-project/veramo/commit/72596e4fd71d66a395c109c88ae2419187459269))\n* FS dids backed by jwk ([7a93f7c](https://github.com/uport-project/veramo/commit/7a93f7c86b29805a4718f78038c372ef563a850a))\n* FS IdentityStore ([a2521e0](https://github.com/uport-project/veramo/commit/a2521e0e36a9531478910815d17409bc749658c2))\n* FS KMS ([1bcf4c1](https://github.com/uport-project/veramo/commit/1bcf4c1ecc29c674c9525946eb5b9bacecd2c550))\n* Global state for identity ([06ff655](https://github.com/uport-project/veramo/commit/06ff6555fc0ca2f99ea2f3fbf1a1c688242ad819))\n* GQL queries WIP ([b581061](https://github.com/uport-project/veramo/commit/b58106161056e54522e66711f54a879a04e547ff))\n* GQL queries WIP ([698aca4](https://github.com/uport-project/veramo/commit/698aca4d006a395a63577b49f7e739b4bdd645b4))\n* GQL query to get latest service messages ([8061fbe](https://github.com/uport-project/veramo/commit/8061fbed8fc3626b165b8c03dee79901682f60a2))\n* GraphQL queries for entities ([9faa883](https://github.com/uport-project/veramo/commit/9faa883c616892f85e924dd8747a0ad42aeb5bf0))\n* GraphQL queries for entities ([0581795](https://github.com/uport-project/veramo/commit/058179501da5475e3826b8d64f160556c0595832))\n* Graphql server in CLI ([70890bd](https://github.com/uport-project/veramo/commit/70890bd6ecf687fee8534312a2888a91552e3a5e))\n* IdentityController, KeyStore ([e86fec4](https://github.com/uport-project/veramo/commit/e86fec425aba3c80dc49520f205e9317deea43bc))\n* IdentityStore and KeyStore in daf-core ([238539c](https://github.com/uport-project/veramo/commit/238539c59c328baf4a4f84c0fe86520bfefdd680))\n* IdentityStore docs ([190b505](https://github.com/uport-project/veramo/commit/190b5052a800c9893c27fe57b89c50cce9fc9343))\n* Initial dashboard layout ([31b69a8](https://github.com/uport-project/veramo/commit/31b69a8914cdfcc763df7441187bf4384d89f21c))\n* Issue credential rewired ([1351a56](https://github.com/uport-project/veramo/commit/1351a568dadb0010288a6b28f62badb5e114f410))\n* LatestClaimValue method ([8df54b8](https://github.com/uport-project/veramo/commit/8df54b8ae0f9b7b308c64e3652d0ccd10130b3cc))\n* List known identities in connections view ([784c29b](https://github.com/uport-project/veramo/commit/784c29b9177c23f51e36b856d23107f011384096))\n* Loading indicator ([a463e40](https://github.com/uport-project/veramo/commit/a463e40cc597c8bcbe5e4dbf95cfc19abbb66667))\n* Message object with validation ([8bf6a9d](https://github.com/uport-project/veramo/commit/8bf6a9d47e73d6e2be9003854718b67f59c636dd))\n* Metamask Identity Controller ([720b52c](https://github.com/uport-project/veramo/commit/720b52c7af89e2e54734b296b7bb0c7cf3905e14))\n* Method dataStoreORMGetIdentities ([7952fbb](https://github.com/uport-project/veramo/commit/7952fbbdc6b2030b7fc004f949908860920f93d4))\n* Method identityManagerGetOrCreateIdentity ([0155389](https://github.com/uport-project/veramo/commit/0155389bf8ad3cfe6f4802d1ac5ce655321423c6))\n* More queries ([30ac032](https://github.com/uport-project/veramo/commit/30ac032ef0047e812b220caf9046e3269d7c2e39))\n* More queries ([29bf414](https://github.com/uport-project/veramo/commit/29bf414d907bc4ae8947e777034e35f9f15c3fa5))\n* Moving DID Doc management to the provider ([b6bd930](https://github.com/uport-project/veramo/commit/b6bd9300464923fac6c464d0997216f2cc5faec8))\n* New DID management interfaces ([9599e2a](https://github.com/uport-project/veramo/commit/9599e2a5e75f0d6d0adaa5229e9653c8c3d9fa80))\n* New Identity TS and GraphQL interfaces ([3f8ff1c](https://github.com/uport-project/veramo/commit/3f8ff1c0c8edd9f1f8a25343a265b78eeecb32e3))\n* New Identity TS and GraphQL interfaces ([a36d691](https://github.com/uport-project/veramo/commit/a36d69103cf582d4929a37f8329b03e550a2ea32))\n* Ngrok support in CLI ([56c464d](https://github.com/uport-project/veramo/commit/56c464db7f6681931fa16928351e349344c36cec))\n* OpenAPI server in CLI ([ccdd6a7](https://github.com/uport-project/veramo/commit/ccdd6a790bc219fbaf5b848d91b1181b0050154c))\n* Optional polling interval ([f03aad6](https://github.com/uport-project/veramo/commit/f03aad6dabece3a89727e3fe97aaf761e63d7e94))\n* Optionally add permissions to gql resolvers ([0d5b212](https://github.com/uport-project/veramo/commit/0d5b2126618d81e5f0d1ba5ae30fc33901b8dc94))\n* pass along authentication metadata into handlers ([199426b](https://github.com/uport-project/veramo/commit/199426b4dba9013d34fea92585583487abdae041))\n* Passing keyStore to Identity object ([dafcac2](https://github.com/uport-project/veramo/commit/dafcac2873740cd405b65f377b97813db2be7637))\n* Provide link to DID document ([1578c1c](https://github.com/uport-project/veramo/commit/1578c1c4f7cafffe2ca5b40643a3213dd0ac5c4d))\n* PublicProfile VP in CLI server ([6d6b710](https://github.com/uport-project/veramo/commit/6d6b7107ed31c78bc7beb309b4a7bce44aeed84f))\n* Publishing serviceEndpoint to DID Doc ([a9fb385](https://github.com/uport-project/veramo/commit/a9fb385f098fec49bb659ef4e1bacdfde221c6a4))\n* Query for single credential by id(hash) ([1283ce5](https://github.com/uport-project/veramo/commit/1283ce528695d179b4b1cad7075c3b34e647fdb0))\n* Registry config ([fe2ebc6](https://github.com/uport-project/veramo/commit/fe2ebc6cf5d8146fe0e22bfafcceca44dd5cea44))\n* Reinstate `credentialStatus` as top level attribute ([4b17689](https://github.com/uport-project/veramo/commit/4b1768936a173844e8710993a42600eab4051f9c))\n* Reinstate `credentialStatus` as top level attribute ([8347b1f](https://github.com/uport-project/veramo/commit/8347b1f5e93840ae6f6548609b87720027dc538e))\n* Removing daf-debug ([a1ebe1d](https://github.com/uport-project/veramo/commit/a1ebe1d63fc6dce1c4270cf300acb452fa034c28))\n* Removing examples from workspaces ([5cf7343](https://github.com/uport-project/veramo/commit/5cf7343d99cdad5b6719ae38371f5e8710813979))\n* Removing GraphQL support ([3646aab](https://github.com/uport-project/veramo/commit/3646aaba6bc72db933ceb7ddb4250bf4457902e3))\n* Removing profile service CLI ([dc93089](https://github.com/uport-project/veramo/commit/dc93089eed40e69bf99946a60aed8f19d34e091b))\n* Renamed Core to Agent ([f2c79b6](https://github.com/uport-project/veramo/commit/f2c79b69c59929deaa67a55d5b5b0caf8523ff5b))\n* Renaming MessageValidator to MessageHandler ([586b43c](https://github.com/uport-project/veramo/commit/586b43c628028d5c6d6550a9e87877385fa8c4fc))\n* Respond to SDR request ([8aafc6b](https://github.com/uport-project/veramo/commit/8aafc6b288ec9cdabf9e64fd70d987d080278f13))\n* REST API example ([0102582](https://github.com/uport-project/veramo/commit/0102582e48acfa5e3ff2c6230098b26d16d312c3))\n* Return the txHash in addPublic key ([c56ada2](https://github.com/uport-project/veramo/commit/c56ada29264a3cb77ae8fb4b8f887e00be257838))\n* Sample auth ([ef30a6e](https://github.com/uport-project/veramo/commit/ef30a6e766ddb7048e5a94f99070fb875e8f4da1))\n* Saving message and VC meta data ([1928125](https://github.com/uport-project/veramo/commit/1928125e3c3ff17e86e838a9c84ddfadb2631a48))\n* SDR helper and specs ([c00b5c1](https://github.com/uport-project/veramo/commit/c00b5c186bfb6f87bb2a01d881d2f8ff1200e6f8))\n* SDR validation ([12ff8eb](https://github.com/uport-project/veramo/commit/12ff8ebc0bc297fb0e272432e91a107b6edfc6af))\n* Selective Disclosure Request ([9afe0c5](https://github.com/uport-project/veramo/commit/9afe0c5a2fae7e3f778fe99ff4f88f44f61d3b94))\n* Sending encrypted DIDComm messages ([2f12513](https://github.com/uport-project/veramo/commit/2f125130c46817a3326037984f0d5227cb1c1a54))\n* Server / Client example ([f757b7e](https://github.com/uport-project/veramo/commit/f757b7eaeeecdaa26aaa65c3dcdbdf9b37f1d5fd))\n* Server config ([b3b9639](https://github.com/uport-project/veramo/commit/b3b9639e7f1382110b34bdb26073ed0bd97eb982))\n* Set default did as first ([cc9332c](https://github.com/uport-project/veramo/commit/cc9332cc8be09622b37c8f4a775df0965d310cef))\n* Setup routing and layout templates ([19236cd](https://github.com/uport-project/veramo/commit/19236cd3cbccf1c58ad340a59ca0e6072092e69e))\n* Show credentials on connections ([84abfa0](https://github.com/uport-project/veramo/commit/84abfa0f2ea2c0e009692cf0ccd76a93c968f0ea))\n* Show gravatar for did ([f537372](https://github.com/uport-project/veramo/commit/f537372db8d3c24a4024922f04a8fa8b24560ede))\n* Show Request in sidepanel ([d930b92](https://github.com/uport-project/veramo/commit/d930b92aabc94f1b8e6ecfccc30c28c8b144be90))\n* SignCredentialJwt returns Credential ([8aefe92](https://github.com/uport-project/veramo/commit/8aefe9216f71cc95812b3f60bd40b1187995ff06))\n* Simple login flow ([8d6042a](https://github.com/uport-project/veramo/commit/8d6042aea5f9d35c119c0033d701682f21dfd09a))\n* Simpler create VC/VP ([#309](https://github.com/uport-project/veramo/issues/309)) ([172c908](https://github.com/uport-project/veramo/commit/172c9088fae4b758b79436d9ae11c8c1f1785341))\n* TypeORM wip ([27e4ab2](https://github.com/uport-project/veramo/commit/27e4ab2676042cea96370ba31d5dd7fc1c8cceb5))\n* Unique (with hash) VC/VP in ORM results ([bcfc3e8](https://github.com/uport-project/veramo/commit/bcfc3e843885553abea1e90bc2a833abc6e8e3ec))\n* Universal resolver unit tests ([8b92d1c](https://github.com/uport-project/veramo/commit/8b92d1c032b19124271bff7884ceebace6331a4e))\n* Update readme ([39a3261](https://github.com/uport-project/veramo/commit/39a3261525d319831cf00ae73eb798a9691ceb5a))\n* Updated architecture diagram ([dafa3c0](https://github.com/uport-project/veramo/commit/dafa3c086bf367470e8620ef8b19a8cbf705b5e2))\n* Updated entities ([00db341](https://github.com/uport-project/veramo/commit/00db341ca10ae08d1afa666b880ffd066b5b6bbc))\n* Updated lock file ([c46ecf2](https://github.com/uport-project/veramo/commit/c46ecf2397625bcc4f0f0831d598140e765511ff))\n* Updating docs ([86ba15c](https://github.com/uport-project/veramo/commit/86ba15c70474436bf9a4ac5c043248fed4b3b274))\n* Updating examples to the new API ([13c7e3b](https://github.com/uport-project/veramo/commit/13c7e3b625ed1924f2ff9346ff0ab40337fcc8d4))\n* URL message validator ([7e516e4](https://github.com/uport-project/veramo/commit/7e516e4065251ba7eaa2ab9c32fbfbda7e318bb1))\n* Use handleMessage instead of validateMessage ([75fb74a](https://github.com/uport-project/veramo/commit/75fb74ad1cab8fc6c8ec6c507850d27ef507e9af))\n* Using agent created from YAML config ([ce2960c](https://github.com/uport-project/veramo/commit/ce2960cfe6114f2e6272d5200419930f7042cf12))\n* Using data store ([c2b76fd](https://github.com/uport-project/veramo/commit/c2b76fd3c3db61ba1916e280fd05381c977d6be6))\n* Using DIDComm for encryption ([02fefa9](https://github.com/uport-project/veramo/commit/02fefa9930961618d723ed74d244de932e93ce76))\n* Using EventEmitter instead of pubsub-js ([5d50acf](https://github.com/uport-project/veramo/commit/5d50acf0c9fbdb9ea45f0e90a55b64a1a1e5dfde))\n* Using OpenAPI schema in rest & express ([80d0bad](https://github.com/uport-project/veramo/commit/80d0badb6c4ed17ccf2250d4381b71f08ef3da45))\n* Validating all plugin method arguments ([2c868f7](https://github.com/uport-project/veramo/commit/2c868f77f297d036554ab8b30b77124c57b824da))\n* Validating returnType ([c7d1ef3](https://github.com/uport-project/veramo/commit/c7d1ef3bd77dd4a77cf9dcfa32a2ed8b47fe04e0))\n* Validation in SDR response ([fab06d2](https://github.com/uport-project/veramo/commit/fab06d209e0430869b725f58ff9b68cdaf6d826f))\n* Version bump ([5f8c0fe](https://github.com/uport-project/veramo/commit/5f8c0fe551f9512401ff4f68baa171a8aaeec419))\n* Version bump ([f482187](https://github.com/uport-project/veramo/commit/f482187a776f05f1977d3c01caa8acc2e0e6c08f))\n* Version bump ([c981add](https://github.com/uport-project/veramo/commit/c981addb07b7c200a65324370c4e1a60461f7947))\n* Version bump ([4fd60a9](https://github.com/uport-project/veramo/commit/4fd60a9a73130ee5e11ac9bf87b0c7864458c70b))\n* Web DID path (multi user) support  ([#282](https://github.com/uport-project/veramo/issues/282)) ([08996bd](https://github.com/uport-project/veramo/commit/08996bdc72481df8a7b701b8cd0a4f2eceaa21a0))\n* WIP ([f491371](https://github.com/uport-project/veramo/commit/f4913711ce4f9dc546bbf5ae29689b1d0ee95e14))\n\n\n### BREAKING CHANGES\n\n* This rename affects almost all the Identity management API\nPlease look for `IDIDManager.ts` in `daf-core/src/types` to see the new method names.\nFunctionality is the same but some renaming is required if already in use.\n\n* refactor: Rename Identity to Identifier\n* fix: Integration tests\n* refactor: WebDIDProvider\n* refactor: EthrDIDProvider\n* refactor: DIDStore\n* refactor: Resolver\n* refactor: DidManagerFind\n* refactor: DidManagerFind\n* refactor: DidManagerGet\n* refactor: DidManagerCreate\n* refactor: DidManagerGetOrCreate\n* refactor: DidManagerImport\n* refactor: DidManagerDelete\n* refactor: KeyManager\n* refactor: DefaultDID\n* refactor: IDIDManager\n* refactor: IDIDManager.ts\n* **daf-cli:** This refactor changes the CLI list of commands. Run `daf --help` to get the latest options.\nThe same actions are possible, but under different (simpler) names and subcommands.\n* **daf-resolver:** The configuration for daf-resolver has changed to be less opinionated. It requires a `did-resolver#Resolver` that can be configured with whichever DID methods your agent needs.\n\nCo-authored-by: Mircea Nistor <mirceanis@gmail.com>\n* the `IW3c` type and `W3c` class have been renamed to\n`ICredentialIssuer` and `CredentialIssuer`\n\nfix(deps): update `did-resolver` and `did-jwt` libs for all packages to maintain type consistency\n* database schema change required to accept large claims\n* DB Schema change\n* Introducing TypeORM - support for more databases\nDeprecating some packages.\n* Introducing TypeORM - support for more databases\nDeprecating some packages.\n* new interfaces for IdentityManager\n AbstractIdentityController AbstractIdentityProvider\n AbstractIdentityStore AbstractIdentity\nAbstractKeyManagementSystem AbstractKey AbstractKeyStore\n"
  },
  {
    "path": "CODE_OF_CONDUCT.md",
    "content": "# Code of Conduct\n\nWe are committed to providing a friendly, safe and welcoming environment for all, regardless of the level of experience, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, ethnicity, age, religion, nationality, or other similar characteristics.\n\nExamples of behavior that contributes to creating a positive environment include:\n- Being kind and courteous to others\n- Using welcoming and inclusive language\n- Being respectful of differing viewpoints and experiences\n- Collaborating with other community members\n- Gracefully accepting constructive criticism\n- Focusing on what is best for the community\n- Showing empathy towards other community members\n\nExamples of unacceptable behavior by participants include:\n- The use of sexualized language or imagery and sexual attention or advances\n- The use of inappropriate images, including in a community member's avatar\n- The use of inappropriate language, including in a community member's nickname\n- Any spamming, flaming, baiting, or other attention-stealing behavior\n- Trolling, insulting/derogatory comments, and personal or political attacks\n- Public or private harassment\n- Publishing others' private information, such as a physical or electronic address, without explicit permission\n- Discussing topics that are overly polarizing, sensitive, or incite arguments. This includes the discussion of polarizing political views, violence, suicide, and rape.\n- Responding with “RTFM”, \"just google it” or similar phrases in response to help requests\n- Other conduct which could reasonably be considered inappropriate\n\n## Our Goals\nThe goal of this document is to set the overall tone for our community. This isn’t an exhaustive list of things you can and can't do. Rather, take this document in the spirit in which it’s intended, and try to be your best self.\nWe value many things beyond technical expertise, including collaboration and supporting others within our community. Providing a positive experience for other community members can have a much more significant impact than simply providing the correct answer.\n\n\n## Scope\n\nThis Code of Conduct applies to all spaces managed by Veramo. This includes, but is not limited to, the Discord server, our repositories on GitHub, and meet-ups. In addition, violations of this code outside these spaces may affect a person's ability to participate within them.\nThe Veramo Code of Conduct applies equally to all members of the community, including staff.\n\n\n## Code of Conduct Policies\n\n### Moderation Policies\nThese are the policies for upholding our community’s rules and the code of conduct. If you want to report a situation that needs to be reviewed by our team, please see our reporting guide below.\n\n\n### Reporting Guide\nInstances of behaviors that violate the Veramo Code of Conduct or rules may be reported by any member of the community. Community members are encouraged to report these situations, including situations they witness involving other community members.\nYou may report in the following ways:\n* By tagging the @veramoteam role on the Discord server in situations that require immediate attention.\n* By sending a direct message (DM) to the community manager [@emmanuellar](https://github.com/emmanuellar).\n* By sending an email to [hello@veramo.io](mailto:hello@veramo.io).\n\n## Attribution\nThis Code of Conduct and parts of the policies are adapted from the [Adafruit Community Code of Conduct](https://github.com/adafruit/Adafruit_Community_Code_of_Conduct/blob/master/code-of-conduct.md) and [Django Code of Conduct](https://www.djangoproject.com/conduct/)\n"
  },
  {
    "path": "CONTRIBUTING.md",
    "content": "# How to contribute\n\nWe love your input! We want to make contributing to this project as easy and transparent as possible, whether it's:\n\n- Reporting a bug\n- Discussing the current state of the code\n- Submitting a fix\n- Proposing new features\n\n## Report a bug with detail, background and sample code\n\n**Great Bug Reports** tend to have:\n\n- A quick summary and/or background\n- Steps to reproduce\n  - Be very specific!\n  - Give sample code if you can.\n- What you expected would happen\n- What actually happens\n- What you have tried so far to fix it but didn't work\n- Notes (possibly including why you think this might be happening)\n- You get extra kudos if you attach a failing test demonstrating that bug\n\n## Submitting improvements\n\n### Commit messages\n\nWe use github to host code, to track issues and feature requests, as well as accept pull requests.\nWe Use [semantic-release](https://github.com/semantic-release/semantic-release) and\n[commitlint](https://github.com/conventional-changelog/commitlint) to automate our release process.\nVersioning, changelogs and publication is all covered by this automation.\nPlease see some [commit message examples](https://github.com/semantic-release/semantic-release#commit-message-format)\n\nCommit messages are really important in this process, and your PR will fail if your commit messages don't adhere to this convention.\n\n### Submitting a fix\n\n- Branch off of `master`\n- Wherever possible, commit at least one test to demonstrate the bug\n- Commit your code to fix that bug. Here's an example commit message for that fix:\n  >     fix: Add null checks on DID Document result\n  >\n  >     Closes #17\n- Create a PR for it\n  - Mention the issue you're fixing in the PR (Example: **Closes #17**)\n\n### Submitting a proposal\n\nWe prefer to discuss proposals before accepting them into the codebase.\nOpen an issue with as much detail and background as possible to make your case.\nSmall proposals can come in directly as PRs, but it's generally better to discuss before starting work.\n\nAny contributions you make will be under the Apache-2.0 License\n\n### Posting PRs\n\n- Describe your changes in the PR description.\n- Mention issues that are being fixed by the PR.\n- Make sure any new code has tests associated!\n- Make sure the documentation is still valid if your changes get included.\n\nThank you for your contribution!\n"
  },
  {
    "path": "LICENSE",
    "content": "                                 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 2019 Consensys AG\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"
  },
  {
    "path": "README.md",
    "content": "[![Discord](https://img.shields.io/discord/878293684620234752?logo=discord&logoColor=white&style=flat-square)](https://discord.gg/huwyNfVkhe)\n[![Build, Test and Publish](https://github.com/decentralized-identity/veramo/actions/workflows/build-test-publish-on-push.yml/badge.svg)](https://github.com/decentralized-identity/veramo/actions/workflows/build-test-publish-on-push.yml)\n[![codecov](https://codecov.io/gh/decentralized-identity/veramo/branch/next/graph/badge.svg)](https://codecov.io/gh/decentralized-identity/veramo)\n\n# Veramo\n\nVeramo is a JavaScript Framework for Verifiable Data that was designed to be flexible and modular which makes it an easy\nfit for a lot of complex workflows.\n\nCreate an agent, add plugins, run on a server or a frontend or mobile, or all of them combined. Veramo runs on Node,\nBrowsers, and React Native straight out of the box. Save time by using the same API across all platforms.\n\nVeramo is a core + some plugins. The core provides an entry point into the API, glues the plugins together and allows\nthem to interoperate. Depending on which plugins you use, your instance of Veramo (your agent) can perform a variety of\nroles:\n\n* Create and manage keys for signing and encryption\n* Create and manage Decentralized Identifiers (DID)\n* Issue Verifiable Credentials (VCs) and Presentations (VPs)\n* Verify such VCs and VPs\n* Present credentials using Selective Disclosure\n* Communicate with other agents using DIDComm (or other protocols)\n* Receive, filter, store and serve data\n* Control other agents remotely, or act as a proxy for them\n* ...whatever else you can think of\n\n## Documentation\n\nSee the full docs on [veramo.io](https://veramo.io)\n\n- Agent\n    - [Intro](https://veramo.io/docs/veramo_agent/introduction)\n    - [Plugins](https://veramo.io/docs/veramo_agent/plugins)\n- Guides\n    - [CLI](https://veramo.io/docs/veramo_agent/cli_tool)\n    - [Node](https://veramo.io/docs/node_tutorials/node_setup_identifiers)\n    - [React](https://veramo.io/docs/react_tutorials/react_setup_resolver)\n    - [React Native](https://veramo.io/docs/react_native_tutorials/react_native_setup_identifers)\n    - [Custom Plugin](https://github.com/uport-project/veramo-plugin) (template repository)\n- Advanced\n    - [Event System](https://veramo.io/docs/veramo_agent/event_system)\n\nAlso, there are a few examples and code samples that you can get from\nthe [integration test suite](https://github.com/decentralized-identity/veramo/tree/next/__tests__/shared).\n\n## Contributing\n\nThis repository contains\nthe [Veramo core package](https://github.com/decentralized-identity/veramo/tree/next/packages/core),\nwhich only becomes relevant when you add plugins to it. These plugins can be developed by anyone and Veramo provides is\nthe glue that can make them interoperate.\n\nWe maintain some \"core\" plugins in this monorepo to provide some functionality \"out of the box\", but a lot more can be\ndone than is present in this codebase. We encourage you to contribute feedback and fixes for everything that you see\nhere, as well as posting about your own plugins or projects on\nour [Discussions page](https://github.com/decentralized-identity/veramo/discussions/categories/show-and-tell) or on\nour [Discord server](https://discord.gg/AEtRtyntEC).\n\nOur [documentation site](https://veramo.io/) is also open-source, and we invite you to contribute feedback and\nfixes [there](https://github.com/uport-project/veramo-website) as well.\n\n### Build Veramo locally\n\nThis monorepo uses [pnpm@10](https://pnpm.io/) and [lerna](https://lerna.js.org/)\n\nInstall dependencies\n\n```bash\nnpm -g i pnpm\npnpm install\n```\n\nBuild\n\n```bash\npnpm build\n```\n\nRun the tests\n\n```bash\npnpm test\n```\n\n```bash\npnpm test:watch\n```\n\nIf you are running Visual Studio Code, there are some launch configurations available that can be used as template for\nstep by step debugging.\n\n### Building a plugin\n\nIf you intend to write a plugin, we have made\na [plugin template repository](https://github.com/uport-project/veramo-plugin) that can be used to get you started. It\nis preconfigured with GitHub Actions for checks and automatic updates using renovate-bot so that your plugin can keep in\nsync with the cutting edge versions of Veramo and notify you if upcoming API changes are breaking anything. Of course,\nthis automation will depend on the tests you write for your new plugin.\n\nDepending on what functionality you intend to develop, some code from the template can be safely removed. The embedded\ncomments should guide you, but if something does not make sense, please reach out.\n\n## Who's using Veramo?\n\nCheck out the [awesome list of awesome projects](./AWESOME.md) using or extending Veramo.\n\n## Let's make it better\n\nThis framework can be used to build permissionless collaboration tools for the world. This is not an easy task, and we\nhave a much greater chance of improving the world if we work together.\n\nShare your feedback, your fixes, your plugins and your tools so that others may build better and better stuff based on\nthem.\n"
  },
  {
    "path": "__tests__/data.migration.test.ts",
    "content": "// noinspection ES6PreferShortImport\n\nimport { KeyManagementSystem, SecretBox } from '../packages/kms-local/src'\nimport { Entities, KeyStore, migrations, PrivateKeyStore } from '../packages/data-store/src'\nimport { PrivateKeyStoreJson } from '../packages/data-store-json/src'\n\nimport { DataSource } from 'typeorm'\nimport * as fs from 'fs'\n\nimport { jest } from '@jest/globals'\nimport { fileURLToPath } from 'url'\nimport { dirname } from 'path'\n\n// @ts-ignore TS1343\nconst __filename = fileURLToPath(import.meta.url)\nconst __dirname = dirname(__filename)\n\njest.setTimeout(60000)\n\nconst dbEncryptionKey = '29739248cad1bd1a0fc4d9b75cd4d2990de535baf5caadfdf8d8f86664aa830c'\n\ndescribe('data handling tests', () => {\n  describe('can recompute p256 keys from old database', () => {\n    const fixture = __dirname + '/fixtures/local-database-before-p256key-migration.sqlite'\n    const databaseFile = fixture + '.tmp'\n    // eslint-disable-next-line @typescript-eslint/no-explicit-any\n    let dbConnection: any // typeorm types don't seem to follow semantic release patterns leading to type errors\n\n    beforeAll(async () => {\n      await fs.promises.copyFile(fixture, databaseFile)\n      dbConnection = new DataSource({\n        name: 'test',\n        type: 'sqlite',\n        database: databaseFile,\n        synchronize: false,\n        migrations: migrations,\n        migrationsRun: true,\n        logging: false,\n        entities: Entities,\n      })\n    })\n\n    afterAll(async () => {\n      try {\n        await dbConnection?.destroy()\n      } catch (e: any) {\n        // nop\n      }\n      try {\n        await fs.promises.unlink(databaseFile)\n      } catch (e: any) {\n        // nop\n      }\n    })\n\n    it('should recompute p256 keys', async () => {\n      const kmsLocal = new KeyManagementSystem(\n        new PrivateKeyStore(dbConnection, new SecretBox(dbEncryptionKey)),\n      )\n      const managedKeyStore = new KeyStore(dbConnection)\n      // list known private keys. kms-local will compute the correct public keys\n      const allPrivKeys = await kmsLocal.listKeys()\n      const keyIds: string[] = []\n      for (const privKey of allPrivKeys) {\n        if (privKey.type === 'Secp256r1') {\n          const managedKey = await managedKeyStore.getKey({ kid: privKey.kid })\n          if (managedKey.publicKeyHex.length === 64) {\n            keyIds.push(privKey.kid)\n            managedKey.publicKeyHex = privKey.publicKeyHex\n          }\n          await managedKeyStore.importKey(managedKey)\n        }\n      }\n      for (const kid of keyIds) {\n        const managedKey = await managedKeyStore.getKey({ kid })\n        expect(managedKey.publicKeyHex.length).toEqual(66)\n        expect(managedKey.publicKeyHex).toMatch(/^(02|03).*/)\n      }\n    })\n  })\n  describe('kms-local maintains public key values for listKeys', () => {\n    it('when using data-store-json', async () => {\n      const memoryJsonStore = {\n        notifyUpdate: () => Promise.resolve(),\n      }\n      const kmsLocal = new KeyManagementSystem(\n        new PrivateKeyStoreJson(memoryJsonStore, new SecretBox(dbEncryptionKey)),\n      )\n      const key = await kmsLocal.createKey({ type: 'Secp256r1' })\n      const allPrivKeys = await kmsLocal.listKeys()\n      const foundKey = allPrivKeys.find((k) => k.kid === key.kid)\n      expect(foundKey?.publicKeyHex).toEqual(key.publicKeyHex)\n    })\n\n    it('when using data-store', async () => {\n      // typeorm types don't seem to follow semantic release patterns leading to type errors\n      // eslint-disable-next-line @typescript-eslint/no-explicit-any\n      const dbConnection: any = new DataSource({\n        type: 'sqlite',\n        database: ':memory:',\n        entities: Entities,\n        synchronize: false,\n        migrations: migrations,\n        migrationsRun: true,\n        logging: false,\n      })\n      const kmsLocal = new KeyManagementSystem(\n        new PrivateKeyStore(dbConnection, new SecretBox(dbEncryptionKey)),\n      )\n      const key = await kmsLocal.createKey({ type: 'Secp256r1' })\n      const allPrivKeys = await kmsLocal.listKeys()\n      const foundKey = allPrivKeys.find((k) => k.kid === key.kid)\n      expect(foundKey?.publicKeyHex).toEqual(key.publicKeyHex)\n    })\n  })\n})\n"
  },
  {
    "path": "__tests__/fixtures/cred1.json",
    "content": "{\n  \"id\": \"http://example.com/credentials/3527\",\n  \"name\": \"begd\",\n  \"type\": [\n    \"VerifiableCredential\",\n    \"OpenBadgeCredential\"\n  ],\n  \"proof\": {\n    \"type\": \"Ed25519Signature2020\",\n    \"created\": \"2023-02-11T02:40:43.841Z\",\n    \"@context\": [\n      \"https://w3id.org/security/suites/ed25519-2020/v1\"\n    ],\n    \"proofValue\": \"z3JLZ5fbUY4J4XyaaVhTyHaC5djPHKVgGYKF8necUHJhZi1Z9aNFvittgA5NkQ3obbVj5DiAD4GwfyxtSovBnWVAt\",\n    \"proofPurpose\": \"assertionMethod\",\n    \"verificationMethod\": \"did:key:z6MkqqPLdAy3mL5JFHEBmpuj7NjTEPnMifr2kz83XsbbgkyY#z6MkqqPLdAy3mL5JFHEBmpuj7NjTEPnMifr2kz83XsbbgkyY\"\n  },\n  \"issuer\": \"did:key:z6MkqqPLdAy3mL5JFHEBmpuj7NjTEPnMifr2kz83XsbbgkyY\",\n  \"@context\": [\n    \"https://www.w3.org/2018/credentials/v1\",\n    \"https://purl.imsglobal.org/spec/ob/v3p0/context.json\"\n  ],\n  \"issuanceDate\": \"2023-02-11T02:40:43.832Z\",\n  \"credentialSubject\": {\n    \"id\": \"did:key:z6MkqqPLdAy3mL5JFHEBmpuj7NjTEPnMifr2kz83XsbbgkyY\",\n    \"type\": [\n      \"AchievementSubject\"\n    ],\n    \"achievement\": {\n      \"id\": \"https://example.com/achievements/21st-century-skills/teamwork\",\n      \"name\": \"begd\",\n      \"type\": [\n        \"Achievement\"\n      ],\n      \"criteria\": {\n        \"narrative\": \"hcgij\"\n      },\n      \"description\": \"ghfh\",\n      \"achievementType\": \"License\"\n    }\n  }\n}\n"
  },
  {
    "path": "__tests__/fixtures/cred2.json",
    "content": "{\n  \"id\": \"ceramic://kjzl6cwe1jw14amq2gh9w54p7mqkyvudy8z1bexw1w9b9vw3ikac6ahwhyurrll\",\n  \"_type\": [\n    \"VerifiableCredential\",\n    \"CredScoreGTEGood\",\n    \"Credit\",\n    \"Borrowing\",\n    \"Finance\",\n    \"DeFi\",\n    \"WorkExperience\"\n  ],\n  \"proof\": {\n    \"type\": \"EthereumEip712Signature2021\",\n    \"eip712\": {\n      \"types\": {\n        \"Issuer\": [\n          {\n            \"name\": \"id\",\n            \"type\": \"string\"\n          },\n          {\n            \"name\": \"ethereumAddress\",\n            \"type\": \"address\"\n          }\n        ],\n        \"EIP712Domain\": [\n          {\n            \"name\": \"name\",\n            \"type\": \"string\"\n          },\n          {\n            \"name\": \"version\",\n            \"type\": \"string\"\n          },\n          {\n            \"name\": \"chainId\",\n            \"type\": \"uint256\"\n          },\n          {\n            \"name\": \"verifyingContract\",\n            \"type\": \"address\"\n          }\n        ],\n        \"CredentialSchema\": [\n          {\n            \"name\": \"id\",\n            \"type\": \"string\"\n          },\n          {\n            \"name\": \"_type\",\n            \"type\": \"string\"\n          }\n        ],\n        \"CredentialSubject\": [\n          {\n            \"name\": \"id\",\n            \"type\": \"string\"\n          },\n          {\n            \"name\": \"ethereumAddress\",\n            \"type\": \"address\"\n          },\n          {\n            \"name\": \"_type\",\n            \"type\": \"string\"\n          },\n          {\n            \"name\": \"typeSchema\",\n            \"type\": \"string\"\n          },\n          {\n            \"name\": \"value\",\n            \"type\": \"string\"\n          },\n          {\n            \"name\": \"encrypted\",\n            \"type\": \"string\"\n          },\n          {\n            \"name\": \"trust\",\n            \"type\": \"uint8\"\n          },\n          {\n            \"name\": \"stake\",\n            \"type\": \"uint256\"\n          },\n          {\n            \"name\": \"price\",\n            \"type\": \"uint256\"\n          },\n          {\n            \"name\": \"nbf\",\n            \"type\": \"uint256\"\n          },\n          {\n            \"name\": \"exp\",\n            \"type\": \"uint256\"\n          }\n        ],\n        \"VerifiableCredential\": [\n          {\n            \"name\": \"_context\",\n            \"type\": \"string\"\n          },\n          {\n            \"name\": \"_type\",\n            \"type\": \"string\"\n          },\n          {\n            \"name\": \"id\",\n            \"type\": \"string\"\n          },\n          {\n            \"name\": \"issuer\",\n            \"type\": \"Issuer\"\n          },\n          {\n            \"name\": \"credentialSubject\",\n            \"type\": \"CredentialSubject\"\n          },\n          {\n            \"name\": \"credentialSchema\",\n            \"type\": \"CredentialSchema\"\n          },\n          {\n            \"name\": \"issuanceDate\",\n            \"type\": \"string\"\n          },\n          {\n            \"name\": \"expirationDate\",\n            \"type\": \"string\"\n          }\n        ]\n      },\n      \"domain\": {\n        \"name\": \"Krebit\",\n        \"chainId\": 137,\n        \"version\": \"1.0\",\n        \"verifyingContract\": \"0xdEb4810c8AB3f9De3F253064A40b1D0c8703fbbf\"\n      },\n      \"primaryType\": \"VerifiableCredential\"\n    },\n    \"created\": \"2023-02-10T19:19:14.884Z\",\n    \"proofValue\": \"0x50af66d10f4754db27218c99cb1026f66da1f1958c4be7fc0e671aa62cce5e360c3f2d9e08807a6dca3802fc6e2151e60293d4d712f7c79b069cce77b52af1721c\",\n    \"proofPurpose\": \"assertionMethod\",\n    \"ethereumAddress\": \"0x5AFd488fe9843E51db54B2262F247572926aea5F\",\n    \"verificationMethod\": \"did:pkh:eip155:1:0x5afd488fe9843e51db54b2262f247572926aea5f#ethereumAddress\"\n  },\n  \"issuer\": {\n    \"id\": \"did:pkh:eip155:1:0x5afd488fe9843e51db54b2262f247572926aea5f\",\n    \"ethereumAddress\": \"0x5AFd488fe9843E51db54B2262F247572926aea5F\"\n  },\n  \"_context\": [\n    \"https://www.w3.org/2018/credentials/v1\",\n    \"https://w3id.org/security/suites/eip712sig-2021\"\n  ],\n  \"issuanceDate\": \"2023-02-10T19:14:14.881Z\",\n  \"expirationDate\": \"2026-02-10T19:19:14.841Z\",\n  \"credentialSchema\": {\n    \"id\": \"https://github.com/KrebitDAO/eip712-vc\",\n    \"type\": \"Eip712SchemaValidator2021\"\n  },\n  \"credentialSubject\": {\n    \"id\": \"did:pkh:eip155:1:0xee55527cf8ea371ac9d574e7e861d28a27b241a4\",\n    \"did\": \"did:pkh:eip155:1:0xee55527cf8ea371ac9d574e7e861d28a27b241a4\",\n    \"exp\": 1770751154,\n    \"nbf\": 1676056454,\n    \"tags\": [\n      \"Credit\",\n      \"Borrowing\",\n      \"Finance\",\n      \"DeFi\",\n      \"WorkExperience\"\n    ],\n    \"type\": \"CredScoreGTEGood\",\n    \"price\": 0,\n    \"stake\": 1,\n    \"trust\": 100,\n    \"value\": \"{\\\"name\\\":\\\"Cred Protocol Score >= Good\\\",\\\"entity\\\":\\\"credprotocol.com\\\",\\\"proof\\\":{\\\"account\\\":\\\"0xEE55527CF8ea371Ac9D574E7e861D28A27b241a4\\\",\\\"creation_date_utc\\\":\\\"2023-02-10 19:19:13\\\",\\\"model_version\\\":\\\"nebula_1.0.6\\\",\\\"value\\\":803,\\\"decile\\\":\\\"4.00\\\",\\\"value_rating\\\":\\\"Good\\\"}}\",\n    \"encrypted\": \"none\",\n    \"typeSchema\": \"krebit://schemas/certificate\",\n    \"expirationDate\": \"2026-02-10T19:19:14.841Z\",\n    \"ethereumAddress\": \"0xee55527cf8ea371ac9d574e7e861d28a27b241a4\"\n  }\n}\n"
  },
  {
    "path": "__tests__/fixtures/cred3.json",
    "content": "{\n  \"id\": \"kjzl6cwe1jw14bn99lu4spvfdvjyxtm4cg2ys5jmd0gqjaov5fqifwlf0af3hbt-did:pkh:eip155:1:0xde695cbb6ec0cf3f4c9564070baeb032552c5111\",\n  \"type\": [\n    \"VerifiableCredential\",\n    \"EventAttendanceCredential\"\n  ],\n  \"proof\": {\n    \"type\": \"EthereumEip712Signature2021\",\n    \"eip712\": {\n      \"types\": {\n        \"Issuer\": [\n          {\n            \"name\": \"id\",\n            \"type\": \"string\"\n          },\n          {\n            \"name\": \"ethereumAddress\",\n            \"type\": \"string\"\n          }\n        ],\n        \"EIP712Domain\": [\n          {\n            \"name\": \"name\",\n            \"type\": \"string\"\n          },\n          {\n            \"name\": \"version\",\n            \"type\": \"string\"\n          },\n          {\n            \"name\": \"chainId\",\n            \"type\": \"uint256\"\n          },\n          {\n            \"name\": \"verifyingContract\",\n            \"type\": \"address\"\n          }\n        ],\n        \"CredentialSchema\": [\n          {\n            \"name\": \"id\",\n            \"type\": \"string\"\n          },\n          {\n            \"name\": \"type\",\n            \"type\": \"string\"\n          }\n        ],\n        \"CredentialSubject\": [\n          {\n            \"name\": \"id\",\n            \"type\": \"string\"\n          },\n          {\n            \"name\": \"eventName\",\n            \"type\": \"string\"\n          },\n          {\n            \"name\": \"eventIcon\",\n            \"type\": \"string\"\n          },\n          {\n            \"name\": \"eventId\",\n            \"type\": \"string\"\n          }\n        ],\n        \"VerifiableCredential\": [\n          {\n            \"name\": \"@context\",\n            \"type\": \"string[]\"\n          },\n          {\n            \"name\": \"type\",\n            \"type\": \"string[]\"\n          },\n          {\n            \"name\": \"id\",\n            \"type\": \"string\"\n          },\n          {\n            \"name\": \"issuer\",\n            \"type\": \"Issuer\"\n          },\n          {\n            \"name\": \"credentialSubject\",\n            \"type\": \"CredentialSubject\"\n          },\n          {\n            \"name\": \"credentialSchema\",\n            \"type\": \"CredentialSchema\"\n          },\n          {\n            \"name\": \"issuanceDate\",\n            \"type\": \"string\"\n          },\n          {\n            \"name\": \"expirationDate\",\n            \"type\": \"string\"\n          }\n        ]\n      },\n      \"domain\": {\n        \"name\": \"Verifiable Event Attendance\",\n        \"chainId\": 1,\n        \"version\": \"1\",\n        \"verifyingContract\": \"0x0000000000000000000000000000000000000000\"\n      },\n      \"primaryType\": \"VerifiableCredential\"\n    },\n    \"created\": \"2023-02-17T02:55:22.601Z\",\n    \"proofValue\": \"0xc8cd38c1ba36b2209a334de8f412a8a7f8bbc20639d981c41806444e7cc2e1396d42264957771823c5f7b3f846d141333486e0c78f88ed2d657cad3f9325a64f1c\",\n    \"proofPurpose\": \"assertionMethod\",\n    \"ethereumAddress\": \"0xf6dcc520f11ad600da7E01da44e0e70D094ea246\",\n    \"verificationMethod\": \"did:pkh:eip155:1:0xf6dcc520f11ad600da7e01da44e0e70d094ea246#ethereumAddress\"\n  },\n  \"issuer\": {\n    \"id\": \"did:pkh:eip155:1:0xf6dcc520f11ad600da7e01da44e0e70d094ea246\",\n    \"ethereumAddress\": \"0xf6dcc520f11ad600da7E01da44e0e70D094ea246\"\n  },\n  \"@context\": [\n    \"https://www.w3.org/2018/credentials/v1\",\n    \"https://raw.githubusercontent.com/w3c-ccg/ethereum-eip712-signature-2021-spec/main/contexts/v1/index.json\"\n  ],\n  \"issuanceDate\": \"2023-02-17T02:55:22.549Z\",\n  \"expirationDate\": \"2123-02-17T02:55:22.549Z\",\n  \"credentialSchema\": {\n    \"id\": \"https://app.vess.id/schemas/EventAttendance.json\",\n    \"type\": \"Eip712SchemaValidator2021\"\n  },\n  \"credentialSubject\": {\n    \"id\": \"did:pkh:eip155:1:0xde695cbb6ec0cf3f4c9564070baeb032552c5111\",\n    \"eventId\": \"kjzl6cwe1jw14bn99lu4spvfdvjyxtm4cg2ys5jmd0gqjaov5fqifwlf0af3hbt\",\n    \"eventIcon\": \"https://bafybeibgqa2kti2c53vq7tajbidclxbjytsgucqjdffmc2yniepejiqs7i.ipfs.w3s.link/nec_preevent.png\",\n    \"eventName\": \"NEC Web3 Community Pre-Event\"\n  }\n}\n"
  },
  {
    "path": "__tests__/initial.migration.test.ts",
    "content": "// noinspection ES6PreferShortImport\n\n/**\n * This suite runs through a few agent operations using data that was created before\n * TypeORM migrations were available (before Veramo 3.0.0)\n */\n\nimport {\n  IDataStore,\n  IDataStoreORM,\n  IDIDManager,\n  IKeyManager,\n  IResolver,\n  TAgent,\n  VerifiableCredential,\n} from '../packages/core-types/src'\nimport { createAgent } from '../packages/core/src'\nimport { DIDResolverPlugin } from '../packages/did-resolver/src'\nimport { WebDIDProvider } from '../packages/did-provider-web/src'\nimport { getDidKeyResolver, KeyDIDProvider } from '../packages/did-provider-key/src'\nimport { DIDComm, IDIDComm } from '../packages/did-comm/src'\nimport { KeyManagementSystem, SecretBox } from '../packages/kms-local/src'\nimport {\n  DataStore,\n  DataStoreORM,\n  DIDStore,\n  Entities,\n  KeyStore,\n  migrations,\n  PrivateKeyStore,\n} from '../packages/data-store/src'\nimport { KeyManager } from '../packages/key-manager/src'\nimport { DIDManager } from '../packages/did-manager/src'\nimport { FakeDidProvider, FakeDidResolver } from '../packages/test-utils/src'\n\nimport { DataSource, DataSourceOptions } from 'typeorm'\nimport { Resolver } from 'did-resolver'\nimport { getResolver as webDidResolver } from 'web-did-resolver'\nimport * as fs from 'fs'\n\nimport { jest } from '@jest/globals'\nimport { fileURLToPath } from 'url'\nimport { dirname } from 'path'\n\n// @ts-ignore TS1343\nconst __filename = fileURLToPath(import.meta.url)\nconst __dirname = dirname(__filename)\n\njest.setTimeout(60000)\n\nconst dbEncryptionKey = '29739248cad1bd1a0fc4d9b75cd4d2990de535baf5caadfdf8d8f86664aa830c'\n\ndescribe('database initial migration tests', () => {\n  describe('simple migrations', () => {\n    const dbFile = __dirname + '/fixtures/local-database-before-migration.sqlite'\n    createTestsUsingOptions(dbFile, {})\n  })\n\n  describe('migrations WITH entityPrefix', () => {\n    const dbFile = __dirname + '/fixtures/local-database-before-migration-with-prefix.sqlite'\n    createTestsUsingOptions(dbFile, {\n      entityPrefix: 'veramo_',\n    })\n  })\n\n  function createTestsUsingOptions(\n    databaseBeforeFile: string,\n    connectionOverrides: Partial<DataSourceOptions>,\n  ) {\n    describe('using pre-migration database fixture', () => {\n      const databaseFile = databaseBeforeFile + '.tmp'\n      type TestingAgentPlugins = IDIDManager & IKeyManager & IDataStore & IDataStoreORM & IResolver & IDIDComm\n      let agent: TAgent<TestingAgentPlugins>\n      // eslint-disable-next-line @typescript-eslint/no-explicit-any\n      let dbConnection: any // typeorm types don't seem to follow semantic release patterns leading to type errors\n\n      beforeAll(async () => {\n        fs.copyFileSync(databaseBeforeFile, databaseFile)\n\n        // intentionally using DataSource instead of Promise<DataSource> to test compatibility\n        dbConnection = new DataSource({\n          name: 'test',\n          type: 'sqlite',\n          database: databaseFile,\n          synchronize: false,\n          migrations: migrations,\n          migrationsRun: true,\n          logging: false,\n          entities: Entities,\n          ...connectionOverrides,\n        } as DataSourceOptions)\n\n        agent = createAgent<TestingAgentPlugins>({\n          context: {\n            // authorizedDID: 'did:example:3456'\n          },\n          plugins: [\n            new KeyManager({\n              store: new KeyStore(dbConnection),\n              kms: {\n                local: new KeyManagementSystem(\n                  new PrivateKeyStore(dbConnection, new SecretBox(dbEncryptionKey)),\n                ),\n              },\n            }),\n            new DIDManager({\n              store: new DIDStore(dbConnection),\n              defaultProvider: 'did:key',\n              providers: {\n                'did:web': new WebDIDProvider({\n                  defaultKms: 'local',\n                }),\n                'did:key': new KeyDIDProvider({\n                  defaultKms: 'local',\n                }),\n                'did:fake': new FakeDidProvider(),\n              },\n            }),\n            new DIDResolverPlugin({\n              resolver: new Resolver({\n                ...webDidResolver(),\n                ...getDidKeyResolver(),\n                ...new FakeDidResolver(() => agent).getDidFakeResolver(),\n              }),\n            }),\n            new DataStore(dbConnection),\n            new DataStoreORM(dbConnection),\n            new DIDComm(),\n          ],\n        })\n        return true\n      })\n      afterAll(async () => {\n        await (await dbConnection).close()\n        fs.unlinkSync(databaseFile)\n      })\n\n      it('loads a migrated key', async () => {\n        // output of agent.keyManagerGet() before migration\n        const key = {\n          kid: '04539ffde912c094bc48b64c9ee71b2baece24c710bcad2c7bacced615f60ae53949cdc95379eb50556d11cb0afab0e5a6ca8cb475d413b2f12307cc2d7f5438de',\n          kms: 'local',\n          type: 'Secp256k1',\n          publicKeyHex:\n            '04539ffde912c094bc48b64c9ee71b2baece24c710bcad2c7bacced615f60ae53949cdc95379eb50556d11cb0afab0e5a6ca8cb475d413b2f12307cc2d7f5438de',\n          privateKeyHex: 'a5e81a8cd50cf5c31d5b87db3e153e2817f86de350a60edc2335f76d5c3b4e0d',\n          meta: {\n            algorithms: ['ES256K', 'ES256K-R', 'eth_signTransaction', 'eth_signTypedData', 'eth_signMessage'],\n          },\n        }\n        const migratedKey = await agent.keyManagerGet({ kid: key.kid })\n        expect(migratedKey.kid).toEqual(key.kid)\n        expect(migratedKey).not.toHaveProperty('privateKeyHex')\n        const signedMessage = await agent.keyManagerSign({\n          data: 'hello world',\n          keyRef: migratedKey.kid,\n          algorithm: 'ES256K',\n          encoding: 'utf-8',\n        })\n        expect(signedMessage).toEqual(\n          'vzDocUViJh7ooOCZ-jBHKZddEsTa4yClHwhIL9SHJwg_QIk9Fsm3jrYoIFmVy-pPjPUP5aNq6QEUfGCm_ZpKAA',\n        )\n      })\n\n      it('unpacks DIDComm message intended for migrated managed key', async () => {\n        const packed = {\n          message:\n            '{\"protected\":\"eyJ0eXAiOiJhcHBsaWNhdGlvbi9kaWRjb21tLWVuY3J5cHRlZCtqc29uIiwiZW5jIjoiWEMyMFAifQ\",\"iv\":\"mBAgYLce2JpmKtmlNQLG6w9lm6kqf4Ne\",\"ciphertext\":\"D9_7Xxj51xn3T9yBU-rZmxSTrR82Pi4G7hWCDSxSpRUlmUh2uJoqeCHixSTFeZvFAfw2ryROjrxbpCh5Arg-wqrW3WwKGpVFHXO_r0jHso5lNMO-vGjxOULN\",\"tag\":\"9Qs-esw1tcnM0jE_Q3LxIQ\",\"recipients\":[{\"encrypted_key\":\"kGNaBfhPS2VETu-_iYaUwy13sC1ZVm3i_qYiYkuEleA\",\"header\":{\"alg\":\"ECDH-ES+XC20PKW\",\"iv\":\"1sK1pyOwy_hNY_WsJPGdoFqE8ken51IA\",\"tag\":\"MplY66h-bHnuSdP1ZGLYyw\",\"epk\":{\"kty\":\"OKP\",\"crv\":\"X25519\",\"x\":\"UZx8Uf3BJ-m3wm7sBjvCp1UXuHA9v0Qu5KvWfWyBNio\"},\"kid\":\"did:key:z6MkiPXoC2uAWPdQpotWxzNMJpaDbfPxaQWcbux5avNwEMfD#z6LSqL9zfeZa53RwpAkjxN7Gizvzv4rjAT7GwhLVYLPXK5dC\"}}]}',\n        }\n        const msg = await agent.unpackDIDCommMessage(packed)\n        expect(msg.message.body).toEqual({ hello: 'world' })\n      })\n\n      it('signs using a migrated key', async () => {\n        expect.assertions(2)\n        // output of agent.keyManagerGet() before migration\n        const key = {\n          kid: '048bb0844ebbcf434048862008991b01cdebb564207f0cea08e5c8d925cec3542bb4c8c1630f38a6b05528ec7460139fe0978bf34a1e4ff32ec210bbaed98dddda',\n          kms: 'local',\n          type: 'Secp256k1',\n          publicKeyHex:\n            '048bb0844ebbcf434048862008991b01cdebb564207f0cea08e5c8d925cec3542bb4c8c1630f38a6b05528ec7460139fe0978bf34a1e4ff32ec210bbaed98dddda',\n          privateKeyHex: 'bb956a5f43283fc4da8ea202ce5ff93e1961d397b98c5871bd6fe420ce56cd53',\n          meta: {\n            algorithms: ['ES256K', 'ES256K-R', 'eth_signTransaction', 'eth_signTypedData', 'eth_signMessage'],\n          },\n        }\n        const migratedKey = await agent.keyManagerGet({ kid: key.kid })\n        expect(migratedKey.kid).toEqual(key.kid)\n        const signedMessage = await agent.keyManagerSign({\n          data: 'hello world',\n          keyRef: migratedKey.kid,\n          algorithm: 'ES256K',\n          encoding: 'utf-8',\n        })\n        expect(signedMessage).toEqual(\n          'JDaZFSC4eWQdau4G9a8l8ml0rhwmzCY4oEDIr-cjWK1Yq9x5mwCH4qI7gkWxAoIjVgsUmfcMi6OqfTH7iz8y1A',\n        )\n      })\n\n      it('reads a credential by hash', async () => {\n        const cred = await agent.dataStoreGetVerifiableCredential({\n          hash: '133b9636e2fe2b7a77b88ca5d81998773b8bc3ebe0b1f3f80dc419dfa0bb797bea779ba0946d603c3ea8611fee5148395894f327661531929294a61589d4d0e7',\n        })\n        expect(cred.credentialSubject.name).toEqual('Alice')\n      })\n\n      it('reads a presentation by hash', async () => {\n        const presentation = await agent.dataStoreGetVerifiablePresentation({\n          hash: '4cfe965596a0d343ff2cc02afd32068bced34caa2b1e7e3f253b23e420de106b58a613f06f55d9d9cbbdbe0b0f051a45d44404020b123c58f0ee48bdaeafdc90',\n        })\n        const cred0: VerifiableCredential = presentation?.verifiableCredential?.[0] as VerifiableCredential\n        expect(cred0.credentialSubject?.name).toEqual('Alice')\n      })\n\n      it('reads existing messages', async () => {\n        const msgs = await agent.dataStoreORMGetMessages()\n        expect(msgs.length).toEqual(3)\n      })\n\n      it('reads existing message with attachments', async () => {\n        const msgs = await agent.dataStoreORMGetMessages({\n          where: [\n            {\n              column: 'id',\n              value: [\n                '13065b8bb97cd37410f4f43cfa878f396aa906701e70c7e2bb86c5de1fe1351a41fb05f445cb68b1ba2805858db619ddd26c71e30a0079c200843d52276213d8',\n              ],\n            },\n          ],\n        })\n        expect(msgs[0]?.presentations?.length).toEqual(1)\n        expect(msgs[0]?.credentials?.length).toEqual(1)\n      })\n\n      it('reads a credential by claim', async () => {\n        const creds = await agent.dataStoreORMGetVerifiableCredentialsByClaims({\n          where: [\n            { column: 'type', value: ['name'] },\n            { column: 'value', value: ['Alice'] },\n          ],\n        })\n        expect(creds.length).toEqual(1)\n      })\n\n      it('unpacks DIDComm message intended for migrated managed key', async () => {\n        const packed = {\n          message:\n            '{\"protected\":\"eyJ0eXAiOiJhcHBsaWNhdGlvbi9kaWRjb21tLWVuY3J5cHRlZCtqc29uIiwiZW5jIjoiWEMyMFAifQ\",\"iv\":\"_lIE23TIaFAPT_YRvlGzZnXhwQh8AqJ2\",\"ciphertext\":\"uinIkbE-D8h-IkHPsNHsI9ni2EmGLo368OO0F_AaZG3KP_IAhfA2F8Bevt-LrWxoQJn2_NDhudXCbTpypK0fAnmY9tUEooLimdLxdxLsXHBBr2oZLiQoiRNxxGCSBc0EmQbek4-9b2M3jUauStoptQ\",\"tag\":\"JbjiNGIYxDPY-_Oj6MHpAA\",\"recipients\":[{\"encrypted_key\":\"y2JT-2YpW4PgNJBRKKQyWzGuC-KGDVc2wvN889tIGoY\",\"header\":{\"alg\":\"ECDH-ES+XC20PKW\",\"iv\":\"8Xy5KfRVkrzY8lbCK5ZAdotp9Idxl0_P\",\"tag\":\"vEzPgqiv3vFc1DppvdVXnA\",\"epk\":{\"kty\":\"OKP\",\"crv\":\"X25519\",\"x\":\"JFD40GD40ywqCyoeQ4jGJz_adfOqUg6ukX0tYU7iFw8\"},\"kid\":\"did:key:z6MktEQbgrewCxg3bXkdKAqHJXSEMJVcxUhcEvkWVqyBpzYn#z6LSpCBthn9h34KEFKPaDjm5Ce7ZQYUtwyqTmwDqTDbAJHBk\"}}]}',\n        }\n        const msg = await agent.unpackDIDCommMessage(packed)\n        expect(msg.message.body).toEqual({ hello: 'world' })\n      })\n    })\n  }\n})\n"
  },
  {
    "path": "__tests__/localAgent.test.ts",
    "content": "// noinspection ES6PreferShortImport\n\n/**\n * This runs a suite of ./shared tests using an agent configured for local operations,\n * using a SQLite db for storage of credentials, presentations, messages as well as keys and DIDs.\n *\n * This suite also runs a ganache local blockchain to run through some examples of DIDComm using did:ethr identifiers.\n */\n\nimport { createAgent } from '../packages/core/src'\nimport {\n  IAgentOptions,\n  ICredentialPlugin,\n  IDataStore,\n  IDataStoreORM,\n  IDIDManager,\n  IKeyManager,\n  IMessageHandler,\n  IResolver,\n  TAgent,\n} from '../packages/core-types/src'\nimport { MessageHandler } from '../packages/message-handler/src'\nimport { KeyManager } from '../packages/key-manager/src'\nimport { AliasDiscoveryProvider, DIDManager } from '../packages/did-manager/src'\nimport { DIDResolverPlugin } from '../packages/did-resolver/src'\nimport { JwtMessageHandler } from '../packages/did-jwt/src'\nimport { CredentialPlugin, W3cMessageHandler } from '../packages/credential-w3c/src'\nimport { CredentialProviderEIP712 } from '../packages/credential-eip712/src'\nimport { CredentialProviderJWT } from '../packages/credential-jwt/src'\nimport {\n  CredentialProviderLD,\n  LdDefaultContexts,\n  VeramoEcdsaSecp256k1RecoverySignature2020,\n  VeramoEd25519Signature2018,\n  VeramoEd25519Signature2020,\n  VeramoJsonWebSignature2020,\n} from '../packages/credential-ld/src'\nimport { EthrDIDProvider } from '../packages/did-provider-ethr/src'\nimport { WebDIDProvider } from '../packages/did-provider-web/src'\nimport { getResolver as getDidPeerResolver, PeerDIDProvider } from '../packages/did-provider-peer/src'\nimport { getDidKeyResolver, KeyDIDProvider } from '../packages/did-provider-key/src'\nimport { getDidPkhResolver, PkhDIDProvider } from '../packages/did-provider-pkh/src'\nimport { getDidJwkResolver, JwkDIDProvider } from '../packages/did-provider-jwk/src'\nimport { DIDComm, DIDCommHttpTransport, DIDCommMessageHandler, IDIDComm } from '../packages/did-comm/src'\nimport {\n  ISelectiveDisclosure,\n  SdrMessageHandler,\n  SelectiveDisclosure,\n} from '../packages/selective-disclosure/src'\nimport { KeyManagementSystem, SecretBox } from '../packages/kms-local/src'\nimport { Web3KeyManagementSystem } from '../packages/kms-web3/src'\nimport { DIDDiscovery, IDIDDiscovery } from '../packages/did-discovery/src'\n\nimport {\n  DataStore,\n  DataStoreDiscoveryProvider,\n  DataStoreORM,\n  DIDStore,\n  Entities,\n  KeyStore,\n  migrations,\n  PrivateKeyStore,\n} from '../packages/data-store/src'\nimport { BrokenDiscoveryProvider, FakeDidProvider, FakeDidResolver } from '../packages/test-utils/src'\n\nimport { DataSource } from 'typeorm'\nimport { createGanacheProvider } from '../packages/test-react-app/src/test-utils/ganache-provider'\nimport { createEthersProvider } from '../packages/test-react-app/src/test-utils/ethers-provider'\nimport { getResolver as ethrDidResolver } from 'ethr-did-resolver'\nimport { getResolver as webDidResolver } from 'web-did-resolver'\nimport { contexts as credential_contexts } from '@transmute/credentials-context'\nimport * as fs from 'fs'\nimport { jest } from '@jest/globals'\n\n// Shared tests\nimport verifiableDataJWT from './shared/verifiableDataJWT'\nimport verifiableDataLD from './shared/verifiableDataLD'\nimport verifiableDataEIP712 from './shared/verifiableDataEIP712'\nimport handleSdrMessage from './shared/handleSdrMessage'\nimport resolveDid from './shared/resolveDid'\nimport webDidFlow from './shared/webDidFlow'\nimport saveClaims from './shared/saveClaims'\nimport documentationExamples from './shared/documentationExamples'\nimport keyManager from './shared/keyManager'\nimport didManager from './shared/didManager'\nimport didCommPacking from './shared/didCommPacking'\nimport messageHandler from './shared/messageHandler'\nimport didDiscovery from './shared/didDiscovery'\nimport dbInitOptions from './shared/dbInitOptions'\nimport didCommWithEthrDidFlow from './shared/didCommWithEthrDidFlow'\nimport utils from './shared/utils'\nimport web3 from './shared/web3'\nimport credentialStatus from './shared/credentialStatus'\nimport ethrDidFlowSigned from './shared/ethrDidFlowSigned'\nimport didCommWithPeerDidFlow from './shared/didCommWithPeerDidFlow.js'\nimport credentialPluginTests from './shared/credentialPluginTests.js'\n\njest.setTimeout(120000)\n\nconst secretKey = '29739248cad1bd1a0fc4d9b75cd4d2990de535baf5caadfdf8d8f86664aa830c'\n\nlet agent: TAgent<\n  IDIDManager &\n    IKeyManager &\n    IDataStore &\n    IDataStoreORM &\n    IResolver &\n    IMessageHandler &\n    IDIDComm &\n    ICredentialPlugin &\n    ISelectiveDisclosure &\n    IDIDDiscovery\n>\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nlet dbConnection: any // typeorm types don't seem to follow semantic release patterns leading to type errors\nlet databaseFile: string\n\nconst setup = async (options?: IAgentOptions): Promise<boolean> => {\n  databaseFile = options?.context?.databaseFile || ':memory:'\n  dbConnection = new DataSource({\n    name: options?.context?.['dbName'] || 'test',\n    type: 'sqlite',\n    database: databaseFile,\n    synchronize: false,\n    migrations: migrations,\n    migrationsRun: true,\n    logging: false,\n    entities: Entities,\n    // allow shared tests to override connection options\n    ...options?.context?.dbConnectionOptions,\n  }).initialize()\n\n  const { provider, registry } = await createGanacheProvider()\n  const ethersProvider = createEthersProvider()\n\n  const eip712 = new CredentialProviderEIP712()\n  const jwt = new CredentialProviderJWT()\n  const ld = new CredentialProviderLD({\n    contextMaps: [LdDefaultContexts, credential_contexts as any],\n    suites: [\n      new VeramoEcdsaSecp256k1RecoverySignature2020(),\n      new VeramoEd25519Signature2018(),\n      new VeramoJsonWebSignature2020(),\n      new VeramoEd25519Signature2020(),\n    ],\n  })\n  agent = createAgent<\n    IDIDManager &\n      IKeyManager &\n      IDataStore &\n      IDataStoreORM &\n      IResolver &\n      IMessageHandler &\n      IDIDComm &\n      ICredentialPlugin &\n      ISelectiveDisclosure &\n      IDIDDiscovery\n  >({\n    ...options,\n    context: {\n      // authorizedDID: 'did:example:3456'\n    },\n    plugins: [\n      new KeyManager({\n        store: new KeyStore(dbConnection),\n        kms: {\n          local: new KeyManagementSystem(new PrivateKeyStore(dbConnection, new SecretBox(secretKey))),\n          web3: new Web3KeyManagementSystem({\n            ethers: ethersProvider as any, // different versions of ethers complain about a type mismatch here\n          }),\n        },\n      }),\n      new DIDManager({\n        store: new DIDStore(dbConnection),\n        defaultProvider: 'did:ethr:ganache',\n        providers: {\n          'did:ethr': new EthrDIDProvider({\n            defaultKms: 'local',\n            ttl: 60 * 60 * 24 * 30 * 12 + 1,\n            networks: [\n              {\n                chainId: 1337,\n                name: 'ganache',\n                provider: provider as any, // different versions of ethers complain about a type mismatch here\n                registry,\n              },\n            ],\n          }),\n          'did:web': new WebDIDProvider({\n            defaultKms: 'local',\n          }),\n          'did:key': new KeyDIDProvider({\n            defaultKms: 'local',\n          }),\n          'did:peer': new PeerDIDProvider({\n            defaultKms: 'local',\n          }),\n          'did:pkh': new PkhDIDProvider({\n            defaultKms: 'local',\n          }),\n          'did:jwk': new JwkDIDProvider({\n            defaultKms: 'local',\n          }),\n          'did:fake': new FakeDidProvider(),\n        },\n      }),\n      new DIDResolverPlugin({\n        ...ethrDidResolver({\n          networks: [\n            {\n              name: 'ganache',\n              chainId: 1337,\n              provider: provider as any,\n              registry,\n            },\n          ],\n        }),\n        ...webDidResolver(),\n        ...getDidKeyResolver(),\n        ...getDidPkhResolver(),\n        ...getDidJwkResolver(),\n        ...getDidPeerResolver(),\n        ...new FakeDidResolver(() => agent).getDidFakeResolver(),\n      }),\n      new DataStore(dbConnection),\n      new DataStoreORM(dbConnection),\n      new MessageHandler({\n        messageHandlers: [\n          new DIDCommMessageHandler(),\n          new JwtMessageHandler(),\n          new W3cMessageHandler(),\n          new SdrMessageHandler(),\n        ],\n      }),\n      new DIDComm({ transports: [new DIDCommHttpTransport()] }),\n      new CredentialPlugin([eip712, jwt, ld]),\n      new SelectiveDisclosure(),\n      new DIDDiscovery({\n        providers: [\n          new AliasDiscoveryProvider(),\n          new DataStoreDiscoveryProvider(),\n          new BrokenDiscoveryProvider(),\n        ],\n      }),\n      ...(options?.plugins || []),\n    ],\n  })\n  return true\n}\n\nconst tearDown = async (): Promise<boolean> => {\n  try {\n    await (await dbConnection).dropDatabase()\n    await (await dbConnection).close()\n  } catch (e) {\n    // nop\n  }\n  try {\n    fs.unlinkSync(databaseFile)\n  } catch (e) {\n    // nop\n  }\n  return true\n}\n\nconst getAgent = () => agent\n\nconst testContext = { getAgent, setup, tearDown }\n\ndescribe('Local integration tests', () => {\n  verifiableDataJWT(testContext)\n  verifiableDataLD(testContext)\n  verifiableDataEIP712(testContext)\n  handleSdrMessage(testContext)\n  resolveDid(testContext)\n  webDidFlow(testContext)\n  saveClaims(testContext)\n  documentationExamples(testContext)\n  keyManager(testContext)\n  didManager(testContext)\n  messageHandler(testContext)\n  didCommPacking(testContext)\n  didDiscovery(testContext)\n  dbInitOptions(testContext)\n  utils(testContext)\n  web3(testContext)\n  didCommWithEthrDidFlow(testContext)\n  didCommWithPeerDidFlow(testContext)\n  credentialStatus(testContext)\n  ethrDidFlowSigned(testContext)\n  credentialPluginTests(testContext)\n})\n"
  },
  {
    "path": "__tests__/localJsonStoreAgent.test.ts",
    "content": "// noinspection ES6PreferShortImport\n\n/**\n * This runs a suite of ./shared tests using an agent configured for local operations,\n * using a JSON db for storage of credentials and an in-memory store for keys and DIDs.\n *\n */\nimport {\n  IAgentOptions,\n  ICredentialPlugin,\n  IDataStore,\n  IDataStoreORM,\n  IDIDManager,\n  IKeyManager,\n  IMessageHandler,\n  IResolver,\n  TAgent,\n} from '../packages/core-types/src'\nimport { createAgent } from '../packages/core/src'\nimport { MessageHandler } from '../packages/message-handler/src'\nimport { KeyManager } from '../packages/key-manager/src'\nimport { DIDManager } from '../packages/did-manager/src'\nimport { DIDResolverPlugin } from '../packages/did-resolver/src'\nimport { JwtMessageHandler } from '../packages/did-jwt/src'\nimport { CredentialPlugin, W3cMessageHandler } from '../packages/credential-w3c/src'\nimport { CredentialProviderEIP712 } from '../packages/credential-eip712/src'\nimport { CredentialProviderJWT } from '../packages/credential-jwt/src'\nimport {\n  CredentialProviderLD,\n  LdDefaultContexts,\n  VeramoEcdsaSecp256k1RecoverySignature2020,\n  VeramoEd25519Signature2018,\n  VeramoEd25519Signature2020,\n  VeramoJsonWebSignature2020,\n} from '../packages/credential-ld/src'\nimport { EthrDIDProvider } from '../packages/did-provider-ethr/src'\nimport { WebDIDProvider } from '../packages/did-provider-web/src'\nimport { getDidKeyResolver, KeyDIDProvider } from '../packages/did-provider-key/src'\nimport { getDidPkhResolver, PkhDIDProvider } from '../packages/did-provider-pkh/src'\nimport { getDidJwkResolver, JwkDIDProvider } from '../packages/did-provider-jwk/src'\nimport { DIDComm, DIDCommMessageHandler, IDIDComm } from '../packages/did-comm/src'\nimport {\n  ISelectiveDisclosure,\n  SdrMessageHandler,\n  SelectiveDisclosure,\n} from '../packages/selective-disclosure/src'\nimport { KeyManagementSystem, SecretBox } from '../packages/kms-local/src'\nimport { Web3KeyManagementSystem } from '../packages/kms-web3/src'\nimport {\n  DataStoreJson,\n  DIDStoreJson,\n  KeyStoreJson,\n  PrivateKeyStoreJson,\n} from '../packages/data-store-json/src'\nimport { FakeDidProvider, FakeDidResolver } from '../packages/test-utils/src'\nimport { getResolver as getDidPeerResolver, PeerDIDProvider } from '../packages/did-provider-peer/src'\n\nimport { Resolver } from 'did-resolver'\nimport { getResolver as ethrDidResolver } from 'ethr-did-resolver'\nimport { getResolver as webDidResolver } from 'web-did-resolver'\nimport { contexts as credential_contexts } from '@transmute/credentials-context'\nimport * as fs from 'fs'\nimport { jest } from '@jest/globals'\n\n// Shared tests\nimport verifiableDataJWT from './shared/verifiableDataJWT'\nimport verifiableDataLD from './shared/verifiableDataLD'\nimport verifiableDataEIP712 from './shared/verifiableDataEIP712'\nimport handleSdrMessage from './shared/handleSdrMessage'\nimport resolveDid from './shared/resolveDid'\nimport webDidFlow from './shared/webDidFlow'\nimport saveClaims from './shared/saveClaims'\nimport documentationExamples from './shared/documentationExamples'\nimport keyManager from './shared/keyManager'\nimport didManager from './shared/didManager'\nimport didCommPacking from './shared/didCommPacking'\nimport messageHandler from './shared/messageHandler'\nimport utils from './shared/utils'\nimport { JsonFileStore } from './utils/json-file-store'\nimport credentialStatus from './shared/credentialStatus'\nimport credentialPluginTests from './shared/credentialPluginTests'\nimport dbInitOptions from './shared/dbInitOptions'\nimport { createGanacheProvider } from '../packages/test-react-app/src/test-utils/ganache-provider'\n\njest.setTimeout(120000)\n\nconst secretKey = '29739248cad1bd1a0fc4d9b75cd4d2990de535baf5caadfdf8d8f86664aa830c'\n\nlet agent: TAgent<\n  IDIDManager &\n    IKeyManager &\n    IDataStore &\n    IDataStoreORM &\n    IResolver &\n    IMessageHandler &\n    IDIDComm &\n    ICredentialPlugin &\n    ISelectiveDisclosure\n>\n\nlet databaseFile: string\n\nconst setup = async (options?: IAgentOptions): Promise<boolean> => {\n  // This test suite uses a plain JSON file for storage for each agent created.\n  // It is important that the same object be used for `DIDStoreJson`/`KeyStoreJson`\n  // and `DataStoreJson` if you want to use all the query capabilities of `DataStoreJson`\n  databaseFile = options?.context?.databaseFile || `./tmp/local-database-${Math.random().toPrecision(5)}.json`\n\n  const { provider, registry } = await createGanacheProvider()\n\n  // manually create the tmp directory\n  await fs.promises.mkdir('./tmp', { recursive: true })\n\n  const jsonFileStore = await JsonFileStore.fromFile(databaseFile)\n\n  agent = createAgent<\n    IDIDManager &\n      IKeyManager &\n      IDataStore &\n      IDataStoreORM &\n      IResolver &\n      IMessageHandler &\n      IDIDComm &\n      ICredentialPlugin &\n      ISelectiveDisclosure\n  >({\n    ...options,\n    context: {\n      // authorizedDID: 'did:example:3456'\n    },\n    plugins: [\n      new KeyManager({\n        store: new KeyStoreJson(jsonFileStore),\n        kms: {\n          local: new KeyManagementSystem(new PrivateKeyStoreJson(jsonFileStore, new SecretBox(secretKey))),\n          web3: new Web3KeyManagementSystem({}),\n        },\n      }),\n      new DIDManager({\n        store: new DIDStoreJson(jsonFileStore),\n        defaultProvider: 'did:ethr',\n        providers: {\n          'did:ethr': new EthrDIDProvider({\n            defaultKms: 'local',\n            ttl: 60 * 60 * 24 * 30 * 12 + 1,\n            networks: [\n              {\n                name: 'ganache',\n                chainId: 1337,\n                provider: provider as any,\n                registry,\n              },\n            ],\n          }),\n          'did:web': new WebDIDProvider({\n            defaultKms: 'local',\n          }),\n          'did:key': new KeyDIDProvider({\n            defaultKms: 'local',\n          }),\n          'did:peer': new PeerDIDProvider({\n            defaultKms: 'local',\n          }),\n          'did:pkh': new PkhDIDProvider({\n            defaultKms: 'local',\n          }),\n          'did:jwk': new JwkDIDProvider({\n            defaultKms: 'local',\n          }),\n          'did:fake': new FakeDidProvider(),\n        },\n      }),\n      new DIDResolverPlugin({\n        resolver: new Resolver({\n          ...ethrDidResolver({\n            networks: [\n              {\n                chainId: 1337,\n                name: 'ganache',\n                provider: provider as any, // different versions of ethers complain about a type mismatch here\n                registry,\n              },\n            ],\n          }),\n          ...webDidResolver(),\n          ...getDidKeyResolver(),\n          ...getDidPeerResolver(),\n          ...getDidPkhResolver(),\n          ...getDidJwkResolver(),\n          ...new FakeDidResolver(() => agent).getDidFakeResolver(),\n        }),\n      }),\n      new DataStoreJson(jsonFileStore),\n      new MessageHandler({\n        messageHandlers: [\n          new DIDCommMessageHandler(),\n          new JwtMessageHandler(),\n          new W3cMessageHandler(),\n          new SdrMessageHandler(),\n        ],\n      }),\n      new DIDComm(),\n      new CredentialPlugin([\n        new CredentialProviderEIP712(),\n        new CredentialProviderJWT(),\n        new CredentialProviderLD({\n          contextMaps: [LdDefaultContexts, credential_contexts as any],\n          suites: [\n            new VeramoEcdsaSecp256k1RecoverySignature2020(),\n            new VeramoEd25519Signature2018(),\n            new VeramoJsonWebSignature2020(),\n            new VeramoEd25519Signature2020(),\n          ],\n        }),\n      ]),\n      new SelectiveDisclosure(),\n      ...(options?.plugins || []),\n    ],\n  })\n  return true\n}\n\nconst tearDown = async (): Promise<boolean> => {\n  try {\n    // await (await dbConnection).dropDatabase()\n    // await (await dbConnection).close()\n  } catch (e) {\n    // nop\n  }\n  try {\n    fs.unlinkSync(databaseFile)\n  } catch (e) {\n    //nop\n  }\n  return true\n}\n\nconst getAgent = () => agent\n\nconst testContext = { getAgent, setup, tearDown }\n\ndescribe('Local json-data-store integration tests', () => {\n  verifiableDataJWT(testContext)\n  verifiableDataLD(testContext)\n  verifiableDataEIP712(testContext)\n  handleSdrMessage(testContext)\n  resolveDid(testContext)\n  webDidFlow(testContext)\n  saveClaims(testContext)\n  documentationExamples(testContext)\n  keyManager(testContext)\n  didManager(testContext)\n  messageHandler(testContext)\n  didCommPacking(testContext)\n  utils(testContext)\n  credentialStatus(testContext)\n  credentialPluginTests(testContext)\n  dbInitOptions(testContext)\n})\n"
  },
  {
    "path": "__tests__/localMemoryStoreAgent.test.ts",
    "content": "// noinspection ES6PreferShortImport\n\n/**\n * This runs a suite of ./shared tests using an agent configured for local operations,\n * using a SQLite db for storage of credentials and an in-memory store for keys and DIDs.\n *\n */\nimport type {\n  IAgentOptions,\n  ICredentialPlugin,\n  IDataStore,\n  IDataStoreORM,\n  IDIDManager,\n  IKeyManager,\n  IMessageHandler,\n  IResolver,\n  TAgent,\n} from '../packages/core-types/src'\nimport { createAgent } from '../packages/core/src'\nimport { MessageHandler } from '../packages/message-handler/src'\nimport { KeyManager, MemoryKeyStore, MemoryPrivateKeyStore } from '../packages/key-manager/src'\nimport { DIDManager, MemoryDIDStore } from '../packages/did-manager/src'\nimport { DataSource } from 'typeorm'\nimport { DIDResolverPlugin } from '../packages/did-resolver/src'\nimport { JwtMessageHandler } from '../packages/did-jwt/src'\nimport { CredentialPlugin, W3cMessageHandler } from '../packages/credential-w3c/src'\nimport { CredentialProviderEIP712 } from '../packages/credential-eip712/src'\nimport { CredentialProviderJWT } from '../packages/credential-jwt/src'\nimport {\n  CredentialProviderLD,\n  LdDefaultContexts,\n  VeramoEcdsaSecp256k1RecoverySignature2020,\n  VeramoEd25519Signature2018,\n  VeramoEd25519Signature2020,\n  VeramoJsonWebSignature2020,\n} from '../packages/credential-ld/src'\nimport { EthrDIDProvider } from '../packages/did-provider-ethr/src'\nimport { WebDIDProvider } from '../packages/did-provider-web/src'\nimport { getDidKeyResolver, KeyDIDProvider } from '../packages/did-provider-key/src'\nimport { getDidPkhResolver, PkhDIDProvider } from '../packages/did-provider-pkh/src'\nimport { getDidJwkResolver, JwkDIDProvider } from '../packages/did-provider-jwk/src'\nimport { DIDComm, DIDCommMessageHandler, IDIDComm } from '../packages/did-comm/src'\nimport {\n  ISelectiveDisclosure,\n  SdrMessageHandler,\n  SelectiveDisclosure,\n} from '../packages/selective-disclosure/src'\nimport { KeyManagementSystem } from '../packages/kms-local/src'\nimport { Web3KeyManagementSystem } from '../packages/kms-web3/src'\nimport { DataStore, DataStoreORM, Entities, migrations } from '../packages/data-store/src'\nimport { FakeDidProvider, FakeDidResolver } from '../packages/test-utils/src'\nimport { PeerDIDProvider, getResolver as getDidPeerResolver } from '../packages/did-provider-peer/src'\n\nimport { getResolver as ethrDidResolver } from 'ethr-did-resolver'\nimport { getResolver as webDidResolver } from 'web-did-resolver'\nimport { contexts as credential_contexts } from '@transmute/credentials-context'\nimport { jest } from '@jest/globals'\n\n// Shared tests\nimport verifiableDataJWT from './shared/verifiableDataJWT.js'\nimport verifiableDataLD from './shared/verifiableDataLD.js'\nimport verifiableDataEIP712 from './shared/verifiableDataEIP712.js'\nimport handleSdrMessage from './shared/handleSdrMessage.js'\nimport resolveDid from './shared/resolveDid.js'\nimport webDidFlow from './shared/webDidFlow.js'\nimport saveClaims from './shared/saveClaims.js'\nimport documentationExamples from './shared/documentationExamples.js'\nimport keyManager from './shared/keyManager.js'\nimport didManager from './shared/didManager.js'\nimport didCommPacking from './shared/didCommPacking.js'\nimport messageHandler from './shared/messageHandler.js'\nimport utils from './shared/utils.js'\nimport credentialStatus from './shared/credentialStatus.js'\nimport credentialInterop from './shared/credentialInterop.js'\nimport credentialPluginTests from './shared/credentialPluginTests.js'\nimport { createGanacheProvider } from '../packages/test-react-app/src/test-utils/ganache-provider'\n\njest.setTimeout(120000)\n\nlet agent: TAgent<\n  IDIDManager &\n    IKeyManager &\n    IDataStore &\n    IDataStoreORM &\n    IResolver &\n    IMessageHandler &\n    IDIDComm &\n    ICredentialPlugin &\n    ISelectiveDisclosure\n>\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nlet dbConnection: any // typeorm types don't seem to follow semantic release patterns leading to type errors\n\nconst setup = async (options?: IAgentOptions): Promise<boolean> => {\n  // intentionally not initializing here to test compatibility\n  dbConnection = new DataSource({\n    name: 'test',\n    type: 'sqlite',\n    database: ':memory:',\n    synchronize: false,\n    migrations: migrations,\n    migrationsRun: true,\n    logging: false,\n    entities: Entities,\n  })\n\n  const eip712 = new CredentialProviderEIP712()\n  const jwt = new CredentialProviderJWT()\n  const ld = new CredentialProviderLD({\n    contextMaps: [LdDefaultContexts, credential_contexts as any],\n    suites: [\n      new VeramoEcdsaSecp256k1RecoverySignature2020(),\n      new VeramoEd25519Signature2018(),\n      new VeramoJsonWebSignature2020(),\n      new VeramoEd25519Signature2020(),\n    ],\n  })\n\n  const { provider, registry } = await createGanacheProvider()\n\n  agent = createAgent<\n    IDIDManager &\n      IKeyManager &\n      IDataStore &\n      IDataStoreORM &\n      IResolver &\n      IMessageHandler &\n      IDIDComm &\n      ICredentialPlugin &\n      ISelectiveDisclosure\n  >({\n    ...options,\n    context: {\n      // authorizedDID: 'did:example:3456'\n    },\n    plugins: [\n      new KeyManager({\n        store: new MemoryKeyStore(),\n        kms: {\n          local: new KeyManagementSystem(new MemoryPrivateKeyStore()),\n          web3: new Web3KeyManagementSystem({}),\n        },\n      }),\n      new DIDManager({\n        store: new MemoryDIDStore(),\n        defaultProvider: 'did:key',\n        providers: {\n          'did:ethr': new EthrDIDProvider({\n            defaultKms: 'local',\n            ttl: 60 * 60 * 24 * 30 * 12 + 1,\n            networks: [\n              {\n                chainId: 1337,\n                name: 'ganache',\n                provider: provider as any, // different versions of ethers complain about a type mismatch here\n                registry,\n              },\n            ],\n          }),\n          'did:web': new WebDIDProvider({\n            defaultKms: 'local',\n          }),\n          'did:key': new KeyDIDProvider({\n            defaultKms: 'local',\n          }),\n          'did:peer': new PeerDIDProvider({\n            defaultKms: 'local',\n          }),\n          'did:pkh': new PkhDIDProvider({\n            defaultKms: 'local',\n          }),\n          'did:jwk': new JwkDIDProvider({\n            defaultKms: 'local',\n          }),\n          'did:fake': new FakeDidProvider(),\n        },\n      }),\n      new DIDResolverPlugin({\n        ...ethrDidResolver({\n          networks: [\n            {\n              chainId: 1337,\n              name: 'ganache',\n              provider: provider as any, // different versions of ethers complain about a type mismatch here\n              registry,\n            },\n          ],\n        }),\n        ...webDidResolver(),\n        ...getDidKeyResolver(),\n        ...getDidPeerResolver(),\n        ...getDidPkhResolver(),\n        ...getDidJwkResolver(),\n        ...new FakeDidResolver(() => agent).getDidFakeResolver(),\n      }),\n      new DataStore(dbConnection),\n      new DataStoreORM(dbConnection),\n      new MessageHandler({\n        messageHandlers: [\n          new DIDCommMessageHandler(),\n          new JwtMessageHandler(),\n          new W3cMessageHandler(),\n          new SdrMessageHandler(),\n        ],\n      }),\n      new DIDComm(),\n      new CredentialPlugin([eip712, jwt, ld]),\n      new SelectiveDisclosure(),\n      ...(options?.plugins || []),\n    ],\n  })\n  return true\n}\n\nconst tearDown = async (): Promise<boolean> => {\n  try {\n    await dbConnection?.destroy()\n  } catch (e) {\n    // nop\n  }\n  return true\n}\n\nconst getAgent = () => agent\n\nconst testContext = { getAgent, setup, tearDown }\n\ndescribe('Local in-memory integration tests', () => {\n  verifiableDataJWT(testContext)\n  verifiableDataLD(testContext)\n  verifiableDataEIP712(testContext)\n  handleSdrMessage(testContext)\n  resolveDid(testContext)\n  webDidFlow(testContext)\n  saveClaims(testContext)\n  documentationExamples(testContext)\n  keyManager(testContext)\n  didManager(testContext)\n  messageHandler(testContext)\n  didCommPacking(testContext)\n  utils(testContext)\n  credentialStatus(testContext)\n  credentialInterop(testContext)\n  credentialPluginTests(testContext)\n})\n"
  },
  {
    "path": "__tests__/mediation.test.ts",
    "content": "import { beforeAll, jest } from '@jest/globals'\n\n// @ts-ignore\nimport express from 'express'\n// import cors from 'cors'\nimport {\n  IDataStore,\n  IDataStoreORM,\n  IDIDManager,\n  IKeyManager,\n  IMessageHandler,\n  IResolver,\n  TAgent,\n} from '../packages/core-types/src'\nimport { MessagingRouter, RequestWithAgentRouter } from '../packages/remote-server/src'\n\nimport { createAgent, IAgentOptions } from '../packages/core/src'\n\nimport { DIDResolverPlugin } from '../packages/did-resolver/src'\nimport { MessageHandler } from '../packages/message-handler/src'\nimport { KeyManager, MemoryKeyStore, MemoryPrivateKeyStore } from '../packages/key-manager/src'\nimport { DIDManager, MemoryDIDStore } from '../packages/did-manager/src'\nimport { getResolver as getDidPeerResolver, PeerDIDProvider } from '../packages/did-provider-peer/src'\nimport {\n  CoordinateMediation,\n  CoordinateMediationV3MediatorMessageHandler,\n  createV3DeliveryRequestMessage,\n  createV3MediateRequestMessage,\n  createV3RecipientQueryMessage,\n  createV3RecipientUpdateMessage,\n  DIDComm,\n  DIDCommMessageHandler,\n  IDIDComm,\n  PickupMediatorMessageHandler,\n  PickupRecipientMessageHandler,\n  RoutingMessageHandler,\n  UpdateAction,\n} from '../packages/did-comm/src'\nimport {\n  IMediationManager,\n  MediationManagerPlugin,\n  MediationResponse,\n  PreMediationRequestPolicy,\n  RequesterDid,\n} from '../packages/mediation-manager/src'\nimport { KeyManagementSystem } from '../packages/kms-local/src'\nimport { DataStoreJson } from '../packages/data-store-json/src'\nimport { KeyValueStore } from '../packages/kv-store/src'\nimport { Server } from 'http'\nimport { DELIVERY_MESSAGE_TYPE } from '../packages/did-comm/src/protocols/messagepickup-message-handler'\n\nconst MEDIATOR_PORT = 3333\njest.fn(() => Promise.resolve())\n// minimum set of plugins for users\ntype UserAgentPlugins = IResolver & IKeyManager & IDIDManager & IMessageHandler & IDIDComm\n\n// minimum set of plugins for mediator\ntype MediatorPlugins = UserAgentPlugins & IMediationManager & IDataStoreORM & IDataStore\n\nconst defaultKms = 'local'\n\nfunction createMediatorAgent(options?: IAgentOptions): TAgent<MediatorPlugins> {\n  let memoryJsonStore = { notifyUpdate: () => Promise.resolve() }\n\n  let policyStore = new KeyValueStore<PreMediationRequestPolicy>({\n    namespace: 'mediation_policy',\n    store: new Map<string, PreMediationRequestPolicy>(),\n  })\n\n  let mediationStore = new KeyValueStore<MediationResponse>({\n    namespace: 'mediation_response',\n    store: new Map<string, MediationResponse>(),\n  })\n\n  let recipientDidStore = new KeyValueStore<RequesterDid>({\n    namespace: 'recipient_did',\n    store: new Map<string, RequesterDid>(),\n  })\n\n  return createAgent<MediatorPlugins>({\n    ...options,\n    plugins: [\n      new DIDResolverPlugin({\n        ...getDidPeerResolver(),\n      }),\n      new KeyManager({\n        store: new MemoryKeyStore(),\n        kms: {\n          [defaultKms]: new KeyManagementSystem(new MemoryPrivateKeyStore()),\n        },\n      }),\n      new DIDManager({\n        store: new MemoryDIDStore(),\n        defaultProvider: 'did:peer',\n        providers: {\n          'did:peer': new PeerDIDProvider({ defaultKms }),\n        },\n      }),\n      new DataStoreJson(memoryJsonStore),\n      new MessageHandler({\n        messageHandlers: [\n          new DIDCommMessageHandler(),\n          // new TrustPingMessageHandler(),\n          new CoordinateMediationV3MediatorMessageHandler(),\n          new RoutingMessageHandler(),\n          new PickupMediatorMessageHandler(),\n        ],\n      }),\n      new DIDComm(),\n      // @ts-ignore\n      new MediationManagerPlugin(true, policyStore, mediationStore, recipientDidStore),\n      ...(options?.plugins || []),\n    ],\n  })\n}\n\nfunction createUserAgent(options?: IAgentOptions): TAgent<UserAgentPlugins> {\n  return createAgent<UserAgentPlugins>({\n    ...options,\n    plugins: [\n      new DIDResolverPlugin({\n        ...getDidPeerResolver(),\n      }),\n      new KeyManager({\n        store: new MemoryKeyStore(),\n        kms: {\n          [defaultKms]: new KeyManagementSystem(new MemoryPrivateKeyStore()),\n        },\n      }),\n      new DIDManager({\n        store: new MemoryDIDStore(),\n        defaultProvider: 'did:peer',\n        providers: {\n          'did:peer': new PeerDIDProvider({ defaultKms }),\n        },\n      }),\n      // new DataStoreJson(memoryJsonStore),\n      new MessageHandler({\n        messageHandlers: [\n          new DIDCommMessageHandler(),\n          // new TrustPingMessageHandler(),\n          // new CoordinateMediationV3RecipientMessageHandler(), // not needed for did:peer:2\n          new PickupRecipientMessageHandler(),\n        ],\n      }),\n      new DIDComm(),\n    ],\n  })\n}\n\n/**\n * This test suite demonstrates how to use the did-comm mediation to send messages between two agents.\n *\n *\n */\ndescribe('did-comm mediation', () => {\n  let didCommEndpointServer: Server\n  let mediatorDID: string\n  let aliceDID: string\n  let aliceAgent: TAgent<UserAgentPlugins>\n  let bobDID: string\n  let bobAgent: TAgent<UserAgentPlugins>\n\n  beforeAll(async () => {\n    const mediator = createMediatorAgent()\n    const messagingPath = '/messaging'\n\n    const mediatorIdentifier = await mediator.didManagerCreate({\n      provider: 'did:peer',\n      options: {\n        num_algo: 2,\n        service: {\n          id: '#messaging1',\n          type: 'DIDCommMessaging',\n          serviceEndpoint: `http://localhost:${MEDIATOR_PORT}${messagingPath}`,\n        },\n      },\n    })\n    mediatorDID = mediatorIdentifier.did\n\n    // start a mediator service\n    await new Promise((resolve) => {\n      const requestWithAgent = RequestWithAgentRouter({ agent: mediator })\n      // set up a server to receive HTTP messages and pipe them to the mediator as DIDComm messages\n      const app = express()\n      // app.use(cors()) // Use this for real servers\n      app.use(\n        messagingPath,\n        requestWithAgent,\n        MessagingRouter({\n          metaData: { type: 'mediator-incoming' },\n          save: false,\n        }),\n      )\n      didCommEndpointServer = app.listen(MEDIATOR_PORT, () => {\n        resolve(true)\n      })\n    })\n\n    aliceAgent = createUserAgent()\n    const aliceIdentifier = await aliceAgent.didManagerCreate({\n      provider: 'did:peer',\n      options: { num_algo: 2, service: { type: 'DIDCommMessaging', serviceEndpoint: mediatorDID } },\n    })\n    aliceDID = aliceIdentifier.did\n\n    bobAgent = createUserAgent()\n    const bobIdentifier = await bobAgent.didManagerCreate({\n      provider: 'did:peer',\n      options: { num_algo: 2 },\n    })\n    bobDID = bobIdentifier.did\n  })\n\n  afterAll(async () => {\n    try {\n      await new Promise((resolve, reject) => didCommEndpointServer?.close(resolve) ?? reject('no server'))\n    } catch (e) {\n      //nop\n    }\n  })\n\n  it('should query for mediation for Alice', async () => {\n    const msg = createV3RecipientQueryMessage(aliceDID, mediatorDID)\n    const packed = await aliceAgent.packDIDCommMessage({ packing: 'anoncrypt', message: msg })\n    const res = await aliceAgent.sendDIDCommMessage({\n      packedMessage: packed,\n      recipientDidUrl: mediatorDID,\n      messageId: msg.id,\n    })\n    expect(res.returnMessage?.type).toBe(CoordinateMediation.RECIPIENT_QUERY_RESPONSE)\n    expect((res.returnMessage?.data as any)?.dids).toEqual([])\n  })\n\n  it('should request for mediation and update the DID for Alice', async () => {\n    const request = createV3MediateRequestMessage(aliceDID, mediatorDID)\n    const packedRequest = await aliceAgent.packDIDCommMessage({ packing: 'anoncrypt', message: request })\n    const mediationResponse = await aliceAgent.sendDIDCommMessage({\n      packedMessage: packedRequest,\n      recipientDidUrl: mediatorDID,\n      messageId: request.id,\n    })\n    expect(mediationResponse.returnMessage?.type).toBe(CoordinateMediation.MEDIATE_GRANT)\n    expect((mediationResponse.returnMessage?.data as any)?.routing_did).toEqual([mediatorDID])\n\n    const update = createV3RecipientUpdateMessage(aliceDID, mediatorDID, [\n      {\n        recipient_did: aliceDID,\n        action: UpdateAction.ADD,\n      },\n    ])\n    const packedUpdate = await aliceAgent.packDIDCommMessage({ packing: 'anoncrypt', message: update })\n    const updateResponse = await aliceAgent.sendDIDCommMessage({\n      packedMessage: packedUpdate,\n      recipientDidUrl: mediatorDID,\n      messageId: update.id,\n    })\n    expect(updateResponse.returnMessage?.type).toBe(CoordinateMediation.RECIPIENT_UPDATE_RESPONSE)\n    expect((updateResponse.returnMessage?.data as any)?.updates).toEqual([\n      {\n        recipient_did: aliceDID,\n        action: UpdateAction.ADD,\n        result: 'success',\n      },\n    ])\n\n    const query = createV3RecipientQueryMessage(aliceDID, mediatorDID)\n    const packedQuery = await aliceAgent.packDIDCommMessage({ packing: 'anoncrypt', message: query })\n    const queryResponse = await aliceAgent.sendDIDCommMessage({\n      packedMessage: packedQuery,\n      recipientDidUrl: mediatorDID,\n      messageId: query.id,\n    })\n    expect(queryResponse.returnMessage?.type).toBe(CoordinateMediation.RECIPIENT_QUERY_RESPONSE)\n    // mediator is finally aware of the mediation. Alice can now tell everyone about her new inbox\n    expect((queryResponse.returnMessage?.data as any)?.dids).toEqual([{ recipient_did: aliceDID }])\n  })\n\n  async function ensureMediationGranted(aliceAgent: TAgent<UserAgentPlugins>, aliceDID: string) {\n    const request = createV3MediateRequestMessage(aliceDID, mediatorDID)\n    const packedRequest = await aliceAgent.packDIDCommMessage({ packing: 'anoncrypt', message: request })\n    const mediationResponse = await aliceAgent.sendDIDCommMessage({\n      packedMessage: packedRequest,\n      recipientDidUrl: mediatorDID,\n      messageId: request.id,\n    })\n    if (mediationResponse.returnMessage?.type !== CoordinateMediation.MEDIATE_GRANT) {\n      throw new Error('mediation not granted')\n    }\n    const update = createV3RecipientUpdateMessage(aliceDID, mediatorDID, [\n      {\n        recipient_did: aliceDID,\n        action: UpdateAction.ADD,\n      },\n    ])\n    const packedUpdate = await aliceAgent.packDIDCommMessage({ packing: 'anoncrypt', message: update })\n    const updateResponse = await aliceAgent.sendDIDCommMessage({\n      packedMessage: packedUpdate,\n      recipientDidUrl: mediatorDID,\n      messageId: update.id,\n    })\n    if (\n      updateResponse.returnMessage?.type !== CoordinateMediation.RECIPIENT_UPDATE_RESPONSE ||\n      (updateResponse.returnMessage?.data as any)?.updates[0].result !== 'success'\n    ) {\n      throw new Error('mediation update failed')\n    }\n  }\n\n  it('should send a message from Bob to Alice', async () => {\n    await ensureMediationGranted(aliceAgent, aliceDID)\n\n    // bob sends the message\n    const msg = {\n      type: 'https://didcomm.org/basicmessage/2.0/message',\n      from: bobDID,\n      to: [aliceDID], // Bob doesn't care that alice is using a mediator\n      id: 'test-message',\n      body: 'Hi Alice, this is Bob!',\n    }\n    const packed = await bobAgent.packDIDCommMessage({ packing: 'anoncrypt', message: msg })\n    const res = await bobAgent.sendDIDCommMessage({\n      packedMessage: packed,\n      recipientDidUrl: aliceDID,\n      messageId: msg.id,\n    })\n    expect(res.transportId).toBeDefined()\n\n    // Alice checks her messages\n    const deliveryRequest = createV3DeliveryRequestMessage(aliceDID, mediatorDID)\n    const packedRequest = await aliceAgent.packDIDCommMessage({\n      packing: 'anoncrypt',\n      message: deliveryRequest,\n    })\n    const deliveryResponse = await aliceAgent.sendDIDCommMessage({\n      packedMessage: packedRequest,\n      recipientDidUrl: mediatorDID,\n      messageId: deliveryRequest.id,\n    })\n\n    expect(deliveryResponse.returnMessage?.type).toBe(DELIVERY_MESSAGE_TYPE)\n    expect(deliveryResponse.returnMessage?.attachments?.length).toBeGreaterThan(0)\n\n    // Alice processes her messages.\n\n    // Technically the messages are already processed by the PickupRecipientMessageHandler,\n    // but that doesn't automatically save them.\n    // You'd need to listen for the DIDCommV2Message-received event and save the messages manually if you need them\n    // later. OR you can use this if you want to process them in-line:\n    for (const attachment of deliveryResponse?.returnMessage?.attachments ?? []) {\n      const msg = await aliceAgent.handleMessage({ raw: JSON.stringify(attachment.data.json) })\n      expect(msg.data).toEqual('Hi Alice, this is Bob!')\n    }\n  })\n})\n"
  },
  {
    "path": "__tests__/restAgent.test.ts",
    "content": "// noinspection ES6PreferShortImport\n\n/**\n * This runs a suite of ./shared tests using an agent configured for remote operations.\n * There is a local agent that only uses @veramo/remove-client and a remote agent that provides the actual\n * functionality.\n *\n * This suite also runs a messaging server to run through some examples of DIDComm using did:fake identifiers.\n * See didWithFakeDidFlow() for more details.\n */\nimport {\n  IAgent,\n  IAgentOptions,\n  IDataStore,\n  IDataStoreORM,\n  IDIDManager,\n  IKeyManager,\n  IMessageHandler,\n  IResolver,\n  TAgent,\n} from '../packages/core-types/src'\nimport { Agent, createAgent } from '../packages/core/src'\nimport { MessageHandler } from '../packages/message-handler/src'\nimport { KeyManager } from '../packages/key-manager/src'\nimport { AliasDiscoveryProvider, DIDManager } from '../packages/did-manager/src'\nimport { DIDResolverPlugin } from '../packages/did-resolver/src'\nimport { JwtMessageHandler } from '../packages/did-jwt/src'\nimport {\n  CredentialIssuer,\n  ICredentialIssuer,\n  ICredentialVerifier,\n  W3cMessageHandler,\n} from '../packages/credential-w3c/src'\nimport { CredentialProviderEIP712 } from '../packages/credential-eip712/src'\nimport { CredentialProviderJWT } from '../packages/credential-jwt/src'\nimport {\n  CredentialProviderLD,\n  LdDefaultContexts,\n  VeramoEcdsaSecp256k1RecoverySignature2020,\n  VeramoEd25519Signature2018,\n  VeramoEd25519Signature2020,\n  VeramoJsonWebSignature2020,\n} from '../packages/credential-ld/src'\nimport { EthrDIDProvider } from '../packages/did-provider-ethr/src'\nimport { WebDIDProvider } from '../packages/did-provider-web/src'\nimport { getDidKeyResolver, KeyDIDProvider } from '../packages/did-provider-key/src'\nimport { getDidPkhResolver, PkhDIDProvider } from '../packages/did-provider-pkh/src'\nimport { getDidJwkResolver, JwkDIDProvider } from '../packages/did-provider-jwk/src'\nimport { getResolver as getDidPeerResolver, PeerDIDProvider } from '../packages/did-provider-peer/src'\nimport { DIDComm, DIDCommHttpTransport, DIDCommMessageHandler, IDIDComm } from '../packages/did-comm/src'\nimport {\n  ISelectiveDisclosure,\n  SdrMessageHandler,\n  SelectiveDisclosure,\n} from '../packages/selective-disclosure/src'\nimport { KeyManagementSystem, SecretBox } from '../packages/kms-local/src'\nimport { Web3KeyManagementSystem } from '../packages/kms-web3/src'\nimport {\n  DataStore,\n  DataStoreDiscoveryProvider,\n  DataStoreORM,\n  DIDStore,\n  Entities,\n  KeyStore,\n  migrations,\n  PrivateKeyStore,\n} from '../packages/data-store/src'\nimport { AgentRestClient } from '../packages/remote-client/src'\nimport { AgentRouter, MessagingRouter, RequestWithAgentRouter } from '../packages/remote-server/src'\nimport { DIDDiscovery, IDIDDiscovery } from '../packages/did-discovery/src'\nimport { BrokenDiscoveryProvider, FakeDidProvider, FakeDidResolver } from '../packages/test-utils/src'\n\nimport { DataSource } from 'typeorm'\nimport { Resolver } from 'did-resolver'\nimport { getResolver as ethrDidResolver } from 'ethr-did-resolver'\nimport { getResolver as webDidResolver } from 'web-did-resolver'\n// @ts-ignore\nimport express from 'express'\nimport { Server } from 'http'\nimport { contexts as credential_contexts } from '@transmute/credentials-context'\nimport * as fs from 'fs'\nimport { jest } from '@jest/globals'\n\n// Shared tests\nimport verifiableDataJWT from './shared/verifiableDataJWT'\nimport verifiableDataLD from './shared/verifiableDataLD'\nimport verifiableDataEIP712 from './shared/verifiableDataEIP712'\nimport handleSdrMessage from './shared/handleSdrMessage'\nimport resolveDid from './shared/resolveDid'\nimport webDidFlow from './shared/webDidFlow'\nimport documentationExamples from './shared/documentationExamples'\nimport keyManager from './shared/keyManager'\nimport didManager from './shared/didManager'\nimport didCommPacking from './shared/didCommPacking'\nimport didWithFakeDidFlow from './shared/didCommWithFakeDidFlow'\nimport didCommAndDataStoreWithCredentials from './shared/didCommAndDataStoreWithCredentials'\nimport messageHandler from './shared/messageHandler'\nimport didDiscovery from './shared/didDiscovery'\nimport utils from './shared/utils'\nimport credentialStatus from './shared/credentialStatus'\nimport credentialPluginTests from './shared/credentialPluginTests'\nimport { createGanacheProvider } from '../packages/test-react-app/src/test-utils/ganache-provider'\n\njest.setTimeout(120000)\n\nconst databaseFile = `./tmp/rest-database-${Math.random().toPrecision(5)}.sqlite`\nconst secretKey = '29739248cad1bd1a0fc4d9b75cd4d2990de535baf5caadfdf8d8f86664aa830c'\nconst port = 3002\nconst basePath = '/agent'\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nlet dbConnection: any // typeorm types don't seem to follow semantic release patterns leading to type errors\nlet serverAgent: IAgent\nlet restServer: Server\n\nconst getAgent = (options?: IAgentOptions) =>\n  createAgent<\n    IDIDManager &\n      IKeyManager &\n      IDataStore &\n      IDataStoreORM &\n      IResolver &\n      IMessageHandler &\n      IDIDComm &\n      ICredentialIssuer & // import from old package to check compatibility\n      ICredentialVerifier &\n      ISelectiveDisclosure &\n      IDIDDiscovery\n  >({\n    ...options,\n    plugins: [\n      new AgentRestClient({\n        url: 'http://localhost:' + port + basePath,\n        enabledMethods: serverAgent.availableMethods(),\n        schema: serverAgent.getSchema(),\n      }),\n    ],\n  })\n\nconst setup = async (options?: IAgentOptions): Promise<boolean> => {\n  dbConnection = new DataSource({\n    name: options?.context?.['dbName'] || 'sqlite-test',\n    type: 'sqlite',\n    database: databaseFile,\n    synchronize: false,\n    migrations: migrations,\n    migrationsRun: true,\n    logging: false,\n    entities: Entities,\n  }).initialize()\n\n  const eip712 = new CredentialProviderEIP712()\n  const jwt = new CredentialProviderJWT()\n  const ld = new CredentialProviderLD({\n    contextMaps: [LdDefaultContexts, credential_contexts as any],\n    suites: [\n      new VeramoEcdsaSecp256k1RecoverySignature2020(),\n      new VeramoEd25519Signature2018(),\n      new VeramoJsonWebSignature2020(),\n      new VeramoEd25519Signature2020(),\n    ],\n  })\n\n  const { provider, registry } = await createGanacheProvider()\n\n  serverAgent = new Agent({\n    ...options,\n    plugins: [\n      new KeyManager({\n        store: new KeyStore(dbConnection),\n        kms: {\n          local: new KeyManagementSystem(new PrivateKeyStore(dbConnection, new SecretBox(secretKey))),\n          web3: new Web3KeyManagementSystem({}),\n        },\n      }),\n      new DIDManager({\n        store: new DIDStore(dbConnection),\n        defaultProvider: 'did:jwk',\n        providers: {\n          'did:ethr': new EthrDIDProvider({\n            defaultKms: 'local',\n            ttl: 60 * 60 * 24 * 30 * 12 + 1,\n            networks: [\n              {\n                chainId: 1337,\n                name: 'ganache',\n                provider: provider as any, // different versions of ethers complain about a type mismatch here\n                registry,\n              },\n            ],\n          }),\n          'did:web': new WebDIDProvider({\n            defaultKms: 'local',\n          }),\n          'did:key': new KeyDIDProvider({\n            defaultKms: 'local',\n          }),\n          'did:peer': new PeerDIDProvider({\n            defaultKms: 'local',\n          }),\n          'did:pkh': new PkhDIDProvider({\n            defaultKms: 'local',\n          }),\n          'did:jwk': new JwkDIDProvider({\n            defaultKms: 'local',\n          }),\n          'did:fake': new FakeDidProvider(),\n        },\n      }),\n      new DIDResolverPlugin({\n        resolver: new Resolver({\n          ...ethrDidResolver({\n            networks: [\n              {\n                chainId: 1337,\n                name: 'ganache',\n                provider: provider as any, // different versions of ethers complain about a type mismatch here\n                registry,\n              },\n            ],\n          }),\n          ...webDidResolver(),\n          // key: getUniversalResolver(), // resolve using remote resolver... when uniresolver becomes more stable,\n          ...getDidKeyResolver(),\n          ...getDidPeerResolver(),\n          ...getDidPkhResolver(),\n          ...getDidJwkResolver(),\n          ...new FakeDidResolver(() => serverAgent as TAgent<IDIDManager>).getDidFakeResolver(),\n        }),\n      }),\n      new DataStore(dbConnection),\n      new DataStoreORM(dbConnection),\n      new MessageHandler({\n        messageHandlers: [\n          new DIDCommMessageHandler(),\n          new JwtMessageHandler(),\n          new W3cMessageHandler(),\n          new SdrMessageHandler(),\n        ],\n      }),\n      new DIDComm({ transports: [new DIDCommHttpTransport()] }),\n      // intentionally use the deprecated name to test compatibility\n      new CredentialIssuer([eip712, jwt, ld]),\n      new SelectiveDisclosure(),\n      new DIDDiscovery({\n        providers: [\n          new AliasDiscoveryProvider(),\n          new DataStoreDiscoveryProvider(),\n          new BrokenDiscoveryProvider(),\n        ],\n      }),\n      new SelectiveDisclosure(),\n      new DIDDiscovery({\n        providers: [\n          new AliasDiscoveryProvider(),\n          new DataStoreDiscoveryProvider(),\n          new BrokenDiscoveryProvider(),\n        ],\n      }),\n      ...(options?.plugins || []),\n    ],\n  })\n\n  const agentRouter = AgentRouter({\n    exposedMethods: serverAgent.availableMethods(),\n  })\n\n  const requestWithAgent = RequestWithAgentRouter({\n    agent: serverAgent,\n  })\n\n  return new Promise((resolve) => {\n    const app = express()\n    app.use(basePath, requestWithAgent, agentRouter)\n    app.use(\n      '/messaging',\n      requestWithAgent,\n      MessagingRouter({\n        metaData: { type: 'DIDComm', value: 'integration test' },\n      }),\n    )\n    restServer = app.listen(port, () => {\n      resolve(true)\n    })\n  })\n}\n\nconst tearDown = async (): Promise<boolean> => {\n  await new Promise((resolve) => restServer.close(resolve))\n  try {\n    await (await dbConnection).dropDatabase()\n    await (await dbConnection).close()\n  } catch (e) {\n    // nop\n  }\n  try {\n    fs.unlinkSync(databaseFile)\n  } catch (e) {\n    //nop\n  }\n  return true\n}\n\nconst testContext = { getAgent, setup, tearDown }\n\ndescribe('REST integration tests', () => {\n  verifiableDataJWT(testContext)\n  verifiableDataLD(testContext)\n  verifiableDataEIP712(testContext)\n  handleSdrMessage(testContext)\n  resolveDid(testContext)\n  webDidFlow(testContext)\n  documentationExamples(testContext)\n  keyManager(testContext)\n  didManager(testContext)\n  messageHandler(testContext)\n  didCommPacking(testContext)\n  didWithFakeDidFlow(testContext)\n  didCommAndDataStoreWithCredentials(testContext)\n  didDiscovery(testContext)\n  utils(testContext)\n  credentialStatus(testContext)\n  credentialPluginTests(testContext)\n})\n"
  },
  {
    "path": "__tests__/shared/credentialInterop.ts",
    "content": "// noinspection ES6PreferShortImport\n\nimport {\n  ICredentialPlugin,\n  IDataStore,\n  IDataStoreORM,\n  IDIDManager,\n  TAgent,\n} from '../../packages/core-types/src'\n\nimport * as fs from 'fs'\n\ntype ConfiguredAgent = TAgent<IDIDManager & ICredentialPlugin & IDataStore & IDataStoreORM>\n\nexport default (testContext: {\n  getAgent: () => ConfiguredAgent\n  setup: () => Promise<boolean>\n  tearDown: () => Promise<boolean>\n}) => {\n  describe('credential interop', () => {\n    let agent: ConfiguredAgent\n\n    beforeAll(async () => {\n      await testContext.setup()\n      agent = testContext.getAgent()\n    })\n    afterAll(testContext.tearDown)\n\n    test.each([\n      // ['cred1.json'], // problem with context parsing (https://github.com/transmute-industries/verifiable-data/issues/238). Fixing that leads to unsupported key type \"undefined\"\n      // ['cred2.json'], // non-standard EIP712 spec implementation\n      ['cred3.json'],\n      // ['cred4.json'], // expired\n    ])(\"should verify credential from the wild: '%s'\", async (text) => {\n      let credential = (await fs.promises.readFile(`./__tests__/fixtures/${text}`, 'utf8')).toString()\n      credential = JSON.parse(credential)\n\n      const result = await agent.verifyCredential({ credential, fetchRemoteContexts: true })\n      expect(result.verified).toBe(true)\n    })\n  })\n}\n"
  },
  {
    "path": "__tests__/shared/credentialPluginTests.ts",
    "content": "// noinspection ES6PreferShortImport\n\nimport { IAgentOptions, ICredentialPlugin, MinimalImportableKey, TAgent } from '../../packages/core-types/src'\n\ntype ConfiguredAgent = TAgent<ICredentialPlugin>\nexport default (testContext: {\n  getAgent: (options?: IAgentOptions) => ConfiguredAgent\n  setup: (options?: IAgentOptions) => Promise<boolean>\n  tearDown: () => Promise<boolean>\n}) => {\n  describe('credential plugin options', () => {\n    let agent: ConfiguredAgent\n\n    beforeAll(async () => {\n      await testContext.setup()\n      agent = testContext.getAgent()\n      return true\n    })\n    afterAll(testContext.tearDown)\n\n    it('should list signing options for did:key with Ed25519 key', async () => {\n      const iid = await agent.didManagerCreate({\n        provider: 'did:key',\n        kms: 'local',\n        options: {\n          keyType: 'Ed25519',\n        },\n      })\n\n      const options = await agent.listUsableProofFormats(iid)\n      expect(options).toEqual(['jwt', 'lds'])\n    })\n\n    it('should list signing options for did:key with Secp256k1 key', async () => {\n      const iid = await agent.didManagerCreate({\n        provider: 'did:key',\n        kms: 'local',\n        options: {\n          keyType: 'Secp256k1',\n        },\n      })\n\n      const options = await agent.listUsableProofFormats(iid)\n      expect(options).toEqual(['EthereumEip712Signature2021', 'jwt', 'lds'])\n    })\n\n    it('should list signing options for did:key with X25519 key', async () => {\n      const iid = await agent.didManagerCreate({\n        provider: 'did:key',\n        kms: 'local',\n        options: {\n          keyType: 'X25519',\n        },\n      })\n\n      const options = await agent.listUsableProofFormats(iid)\n      expect(options).toEqual([])\n    })\n\n    it('should list signing options for did:ethr with web3 backed keys', async () => {\n      const account = `0x71CB05EE1b1F506fF321Da3dac38f25c0c9ce6E1`\n      const did = `did:ethr:${account}`\n      const controllerKeyId = `ethers-${account}`\n      const iid = await agent.didManagerImport({\n        did,\n        provider: 'did:ethr',\n        controllerKeyId,\n        keys: [\n          {\n            kid: controllerKeyId,\n            type: 'Secp256k1',\n            kms: 'web3',\n            privateKeyHex: '',\n            publicKeyHex: '',\n            meta: {\n              account,\n              provider: 'ethers',\n              algorithms: ['eth_signMessage', 'eth_signTypedData'],\n            },\n          } as MinimalImportableKey,\n        ],\n      })\n\n      const options = await agent.listUsableProofFormats(iid)\n      expect(options).toEqual(['EthereumEip712Signature2021'])\n    })\n  })\n}\n"
  },
  {
    "path": "__tests__/shared/credentialStatus.ts",
    "content": "// noinspection ES6PreferShortImport\n\nimport { CredentialStatus } from 'credential-status'\nimport {\n  CredentialPayload,\n  IAgentOptions,\n  ICredentialPlugin,\n  IDataStore,\n  IDataStoreORM,\n  IDIDManager,\n  IIdentifier,\n  TAgent,\n} from '../../packages/core-types/src'\nimport { CredentialStatusPlugin } from '../../packages/credential-status/src'\nimport { jest } from '@jest/globals'\n\ntype ConfiguredAgent = TAgent<IDIDManager & ICredentialPlugin & IDataStore & IDataStoreORM>\n\n// Constant used to simulate exception flows\nconst simulateStatusVerificationFailure = 'Any_unexpected_failure_during_status_verification.'\n\n// Constant used to simulate revoked credentials\nconst simulateRevokedCredential = 'A_revoked_credential.'\n\n// Constant used to simulate revoked credentials\nconst simulateNotRevokedCredential = 'A_NOT_revoked_credential.'\n\nconst callsCounter = jest.fn()\n\nconst checkStatus = async (credential: any): Promise<CredentialStatus> => {\n  callsCounter()\n\n  if (credential.credentialStatus.id === simulateStatusVerificationFailure) {\n    // Simulates the exception flows where the credential status verification\n    // can't be executed for and unexpected reason, like network failures.\n    throw new Error(simulateStatusVerificationFailure)\n  }\n\n  const revoked = credential.credentialStatus.id === simulateRevokedCredential\n  if (!revoked && credential.credentialStatus.id !== simulateNotRevokedCredential) {\n    throw new Error('Invalid state.')\n  }\n\n  return { revoked }\n}\n\nexport default (testContext: {\n  getAgent: () => ConfiguredAgent\n  setup: (options?: IAgentOptions) => Promise<boolean>\n  tearDown: () => Promise<boolean>\n}) => {\n  describe('Credential status verification (revocation)', () => {\n    let agent: ConfiguredAgent\n    let identifier: IIdentifier\n    let rawCredential: CredentialPayload\n    let rawRevoked: CredentialPayload\n    let rawFailure: CredentialPayload\n    let rawUnknown: CredentialPayload\n\n    // Clean the number of times the methos was called in the previosu test\n    beforeEach(callsCounter.mockReset)\n\n    beforeAll(async () => {\n      await testContext.setup({\n        plugins: [\n          new CredentialStatusPlugin({\n            ExoticStatusMethod2022: checkStatus,\n          }),\n        ],\n      })\n      agent = testContext.getAgent()\n      identifier = await agent.didManagerCreate({\n        kms: 'local',\n        provider: 'did:pkh',\n        options: { keyType: 'Secp256k1' },\n      })\n\n      rawCredential = buildCredential(identifier, {\n        type: 'ExoticStatusMethod2022',\n        id: simulateNotRevokedCredential,\n      })\n\n      rawRevoked = buildCredential(identifier, {\n        type: 'ExoticStatusMethod2022',\n        id: simulateRevokedCredential,\n      })\n\n      rawUnknown = buildCredential(identifier, {\n        type: 'UnknownType',\n        id: 'any',\n      })\n\n      rawFailure = buildCredential(identifier, {\n        type: 'ExoticStatusMethod2022',\n        id: simulateStatusVerificationFailure,\n      })\n\n      return true\n    })\n\n    afterAll(testContext.tearDown)\n\n    it('should check credentialStatus for JWT credential', async () => {\n      const vc = await agent.createVerifiableCredential({\n        credential: rawCredential,\n        proofFormat: 'jwt',\n      })\n      expect(vc).toHaveProperty('proof.jwt')\n\n      const result = await agent.verifyCredential({ credential: vc })\n      expect(callsCounter).toHaveBeenCalledTimes(1)\n      expect(result.verified).toEqual(true)\n    })\n\n    it('should check credentialStatus for revoked JWT credential', async () => {\n      const vc = await agent.createVerifiableCredential({\n        credential: rawRevoked,\n        proofFormat: 'jwt',\n      })\n      expect(vc).toHaveProperty('proof.jwt')\n\n      const result = await agent.verifyCredential({ credential: vc })\n      expect(callsCounter).toHaveBeenCalledTimes(1)\n      expect(result.verified).toEqual(false)\n    })\n\n    it('should fail checking credentialStatus with exception during verification', async () => {\n      const vc = await agent.createVerifiableCredential({\n        credential: rawFailure,\n        proofFormat: 'jwt',\n      })\n      expect(vc).toHaveProperty('proof.jwt')\n\n      await expect(agent.verifyCredential({ credential: vc })).rejects.toThrow(\n        simulateStatusVerificationFailure,\n      )\n      expect(callsCounter).toHaveBeenCalledTimes(1)\n    })\n\n    it('should fail checking credentialStatus when agent doesn`t have the status type', async () => {\n      const vc = await agent.createVerifiableCredential({\n        credential: rawUnknown,\n        proofFormat: 'jwt',\n      })\n      expect(vc).toHaveProperty('proof.jwt')\n\n      await expect(agent.verifyCredential({ credential: vc })).rejects.toThrow(\n        `unknown_method: credentialStatus method UnknownType unknown. Validity can not be determined.`,\n      )\n      expect(callsCounter).toHaveBeenCalledTimes(0)\n    })\n\n    it('should check credentialStatus for JSON-LD credential', async () => {\n      const vc = await agent.createVerifiableCredential({\n        credential: rawCredential,\n        proofFormat: 'lds',\n      })\n      expect(vc).toHaveProperty('proof.jws')\n\n      const result = await agent.verifyCredential({ credential: vc })\n      expect(callsCounter).toHaveBeenCalledTimes(1)\n      expect(result.verified).toEqual(true)\n    })\n\n    it('should check credentialStatus for revoked JSON-LD credential', async () => {\n      const vc = await agent.createVerifiableCredential({\n        credential: rawRevoked,\n        proofFormat: 'lds',\n      })\n      expect(vc).toHaveProperty('proof.jws')\n\n      const result = await agent.verifyCredential({ credential: vc })\n      expect(callsCounter).toHaveBeenCalledTimes(1)\n      expect(result.verified).toEqual(false)\n    })\n\n    it('should check credentialStatus for EIP712 credential', async () => {\n      const vc = await agent.createVerifiableCredential({\n        credential: rawCredential,\n        proofFormat: 'EthereumEip712Signature2021',\n      })\n      expect(vc).toHaveProperty('proof.proofValue')\n\n      const result = await agent.verifyCredential({ credential: vc })\n      expect(callsCounter).toHaveBeenCalledTimes(1)\n      expect(result.verified).toEqual(true)\n    })\n\n    it('should check credentialStatus for revoked EIP712 credential', async () => {\n      const vc = await agent.createVerifiableCredential({\n        credential: rawRevoked,\n        proofFormat: 'EthereumEip712Signature2021',\n      })\n      expect(vc).toHaveProperty('proof.proofValue')\n\n      const result = await agent.verifyCredential({ credential: vc })\n      expect(callsCounter).toHaveBeenCalledTimes(1)\n      expect(result.verified).toEqual(false)\n    })\n  })\n\n  describe('Credential status verification (revocation) without status plugin', () => {\n    let agent: ConfiguredAgent\n    let identifier: IIdentifier\n    let rawCredential: CredentialPayload\n\n    // Clean the number of times the methos was called in the previosu test\n    beforeEach(callsCounter.mockReset)\n\n    beforeAll(async () => {\n      await testContext.setup({\n        plugins: [],\n      })\n      agent = testContext.getAgent()\n      identifier = await agent.didManagerCreate({ kms: 'local', provider: 'did:jwk' })\n\n      rawCredential = {\n        issuer: { id: identifier.did },\n        '@context': ['https://www.w3.org/2018/credentials/v1', 'https://veramo.io/contexts/profile/v1'],\n        type: ['VerifiableCredential', 'Profile'],\n        issuanceDate: new Date().toISOString(),\n        credentialSubject: {\n          name: 'Better trust layers with Veramo!',\n        },\n        credentialStatus: {\n          type: 'ExoticStatusMethod2022',\n          id: simulateNotRevokedCredential,\n        },\n      }\n    })\n\n    afterAll(testContext.tearDown)\n\n    it('should fail on credentialStatus check when agent has no status plugin', async () => {\n      const vc = await agent.createVerifiableCredential({\n        credential: rawCredential,\n        proofFormat: 'jwt',\n      })\n      expect(vc).toHaveProperty('proof.jwt')\n\n      await expect(agent.verifyCredential({ credential: vc })).rejects.toThrow(\n        `invalid_setup: The credential status can't be verified because there is no ICredentialStatusVerifier plugin installed.`,\n      )\n    })\n  })\n}\n\nfunction buildCredential(\n  identifier: IIdentifier,\n  credentialStatus: { type: string; id: string },\n): CredentialPayload {\n  return {\n    issuer: { id: identifier.did },\n    '@context': ['https://www.w3.org/2018/credentials/v1', 'https://veramo.io/contexts/profile/v1'],\n    type: ['VerifiableCredential', 'Profile'],\n    issuanceDate: new Date().toISOString(),\n    credentialSubject: {\n      name: 'Better trust layers with Veramo!',\n    },\n    credentialStatus,\n  }\n}\n"
  },
  {
    "path": "__tests__/shared/dbInitOptions.ts",
    "content": "// noinspection ES6PreferShortImport\n\nimport {\n  IAgentOptions,\n  ICredentialIssuer,\n  IDataStore,\n  IDataStoreORM,\n  IDIDManager,\n  IIdentifier,\n  IKey,\n  IKeyManager,\n  IMessageHandler,\n  IResolver,\n  TAgent,\n} from '../../packages/core-types/src'\nimport { IDIDComm, IPackedDIDCommMessage } from '../../packages/did-comm/src'\nimport { extractIssuer } from '../../packages/utils/src'\n\ntype ConfiguredAgent = TAgent<\n  IDataStoreORM &\n    IDataStore &\n    IDIDManager &\n    IKeyManager &\n    ICredentialIssuer &\n    IDIDComm &\n    IMessageHandler &\n    IResolver\n>\n\nexport default (testContext: {\n  getAgent: () => ConfiguredAgent\n  setup: (agentOptions: IAgentOptions) => Promise<boolean>\n  tearDown: () => Promise<boolean>\n}) => {\n  describe('when database is initialized', () => {\n    describe('using sqlite and synchronize=true', () => {\n      createTestsUsingOptions({\n        context: {\n          databaseFile: 'sqlite-sync-init-test.sqlite',\n          dbConnectionOptions: {\n            name: 'sqlite-sync-init-test',\n            type: 'sqlite',\n            synchronize: true,\n            migrationsRun: false,\n          },\n        },\n      })\n    })\n    describe('using sqlite and migrations', () => {\n      createTestsUsingOptions({\n        context: {\n          databaseFile: 'sqlite-migration-init-test.sqlite',\n          dbConnectionOptions: {\n            name: 'sqlite-migration-init-test',\n            type: 'sqlite',\n            synchronize: false,\n            migrationsRun: true,\n          },\n        },\n      })\n    })\n\n    if (process.env.INCLUDE_POSTGRES_TESTS === 'true') {\n      // //docker run -p 5432:5432 -it --rm -e POSTGRES_PASSWORD=test123 postgres\n      describe('using postgres and migrations', () => {\n        createTestsUsingOptions({\n          context: {\n            dbConnectionOptions: {\n              name: 'postgres-migration-init-test',\n              type: 'postgres',\n              database: undefined,\n              synchronize: false,\n              migrationsRun: true,\n              host: process.env.POSTGRES_HOST || 'localhost',\n              port: process.env.POSTGRES_PORT || 5432,\n              password: process.env.POSTGRES_PASSWORD || 'test123',\n              username: process.env.POSTGRES_USER || 'postgres',\n            },\n          },\n        })\n      })\n\n      describe('using postgres and sync', () => {\n        createTestsUsingOptions({\n          context: {\n            dbConnectionOptions: {\n              name: 'postgres-sync-init-test',\n              type: 'postgres',\n              database: undefined,\n              synchronize: true,\n              migrationsRun: false,\n              host: process.env.POSTGRES_HOST || 'localhost',\n              port: process.env.POSTGRES_PORT || 5432,\n              password: process.env.POSTGRES_PASSWORD || 'test123',\n              username: process.env.POSTGRES_USER || 'postgres',\n            },\n          },\n        })\n      })\n    }\n\n    function createTestsUsingOptions(options: IAgentOptions) {\n      describe('agent', () => {\n        let agent: ConfiguredAgent\n        beforeAll(async () => {\n          await testContext.setup(options)\n          agent = testContext.getAgent()\n          return true\n        })\n        afterAll(testContext.tearDown)\n\n        let identifier: IIdentifier\n        it('should create DID', async () => {\n          identifier = await agent.didManagerGetOrCreate({ provider: 'did:fake', alias: 'migrationDID' })\n          expect(identifier.did).toMatch(/did:fake:.*/)\n        })\n        it('should create and add key', async () => {\n          const key: IKey = await agent.keyManagerCreate({\n            type: 'Ed25519',\n            kms: 'local',\n          })\n\n          await agent.didManagerAddKey({\n            did: identifier.did,\n            key: key,\n          })\n\n          identifier = await agent.didManagerGet({ did: identifier.did })\n          expect(identifier.keys.length).toBeGreaterThanOrEqual(2)\n        })\n\n        it('should add service', async () => {\n          await agent.didManagerAddService({\n            did: identifier.did,\n            service: {\n              id: 'fake-service',\n              type: 'DIDCommMessaging',\n              serviceEndpoint: 'http://localhost:6123',\n            },\n          })\n          identifier = await agent.didManagerGet({ did: identifier.did })\n          expect(identifier.services.length).toBe(1)\n        })\n\n        let credentialRaw: string\n        it('should sign and save credential', async () => {\n          const credential = await agent.createVerifiableCredential({\n            proofFormat: 'jwt',\n            credential: {\n              credentialSubject: { id: identifier.did, pseudonym: 'FakeAlice' },\n              type: ['Example'],\n              issuer: identifier.did,\n            },\n          })\n          const credentialId = await agent.dataStoreSaveVerifiableCredential({\n            verifiableCredential: credential,\n          })\n          const retrieved = await agent.dataStoreGetVerifiableCredential({\n            hash: credentialId,\n          })\n          credentialRaw = retrieved.proof.jwt\n          expect(extractIssuer(retrieved)).toEqual(identifier.did)\n        })\n\n        let packedMessage: IPackedDIDCommMessage\n        it('should pack anon message', async () => {\n          packedMessage = await agent.packDIDCommMessage({\n            packing: 'authcrypt',\n            message: {\n              to: [identifier.did],\n              from: identifier.did,\n              id: 'test-message-123',\n              type: 'w3c.vc',\n              body: credentialRaw,\n            },\n          })\n          expect(packedMessage.message.length).toBeGreaterThan(0)\n        })\n\n        it('should unpack anon message', async () => {\n          const msg = await agent.handleMessage({ raw: packedMessage.message })\n          expect(msg.type).toBe('w3c.vc')\n        })\n\n        it('should get credentials from message by claim', async () => {\n          const incomingCredential = await agent.createVerifiableCredential({\n            proofFormat: 'jwt',\n            credential: {\n              type: ['Example'],\n              credentialSubject: {\n                incoming: 'yes',\n              },\n              issuer: identifier.did,\n            },\n            save: false,\n          })\n          const message = await agent.handleMessage({ raw: incomingCredential.proof.jwt, save: false })\n          const msgId = await agent.dataStoreSaveMessage({ message })\n          const retrievedCredential = await agent.dataStoreORMGetVerifiableCredentialsByClaims({\n            where: [{ column: 'type', value: ['incoming'] }],\n          })\n          expect(retrievedCredential.length).toBeGreaterThan(0)\n        })\n\n        it('should delete credentials without clearing the claims table', async () => {\n          const credA = await agent.createVerifiableCredential({\n            proofFormat: 'jwt',\n            credential: {\n              type: ['Important'],\n              credentialSubject: {\n                important: 'yes',\n                serious: true,\n              },\n              issuer: identifier.did,\n            },\n          })\n          const credB = await agent.createVerifiableCredential({\n            proofFormat: 'jwt',\n            credential: {\n              type: ['Unimportant'],\n              credentialSubject: {\n                bla: 'bla',\n              },\n              issuer: identifier.did,\n            },\n          })\n\n          const credAhash = await agent.dataStoreSaveVerifiableCredential({ verifiableCredential: credA })\n          const credBhash = await agent.dataStoreSaveVerifiableCredential({ verifiableCredential: credB })\n\n          const queryBeforeDelete = await agent.dataStoreORMGetVerifiableCredentialsByClaims({\n            where: [\n              { column: 'type', value: ['important'] },\n              { column: 'value', value: ['yes'] },\n            ],\n          })\n          expect(queryBeforeDelete.length).toBeGreaterThan(0)\n          expect(queryBeforeDelete[0].hash).toEqual(credAhash)\n\n          await agent.dataStoreDeleteVerifiableCredential({ hash: credBhash })\n\n          const queryAfterDelete = await agent.dataStoreORMGetVerifiableCredentialsByClaims({\n            where: [\n              { column: 'type', value: ['important'] },\n              { column: 'value', value: ['yes'] },\n            ],\n          })\n          expect(queryAfterDelete.length).toBeGreaterThan(0)\n          expect(queryAfterDelete[0].hash).toEqual(credAhash)\n        })\n      })\n    }\n  })\n}\n"
  },
  {
    "path": "__tests__/shared/didCommAndDataStoreWithCredentials.ts",
    "content": "// noinspection ES6PreferShortImport\n\nimport {\n  IAgentOptions,\n  IDIDManager,\n  IEventListener,\n  IIdentifier,\n  IKeyManager,\n  IResolver,\n  TAgent,\n} from '../../packages/core-types/src'\nimport { IDIDComm, IPackedDIDCommMessage } from '../../packages/did-comm/src'\nimport { v4 } from 'uuid'\nimport { VerifiableCredential } from '../../packages/core-types/src'\nimport { jest } from '@jest/globals'\n\ntype ConfiguredAgent = TAgent<IDIDManager & IKeyManager & IResolver & IDIDComm>\n\nconst DIDCommEventSniffer: IEventListener = {\n  eventTypes: ['DIDCommV2Message-sent', 'DIDCommV2Message-received'],\n  onEvent: jest.fn(() => Promise.resolve()),\n}\n\nexport default (testContext: {\n  getAgent: () => ConfiguredAgent\n  setup: (options?: IAgentOptions) => Promise<boolean>\n  tearDown: () => Promise<boolean>\n}) => {\n  describe('DID comm using did:fake flow', () => {\n    let agent: ConfiguredAgent\n    let sender: IIdentifier\n    let receiver: IIdentifier\n\n    beforeAll(async () => {\n      await testContext.setup({ plugins: [DIDCommEventSniffer] })\n      agent = testContext.getAgent()\n\n      sender = await agent.didManagerImport({\n        did: 'did:fake:z6MkgbqNU4uF9NKSz5BqJQ4XKVHuQZYcUZP8pXGsJC8nTHwo',\n        keys: [\n          {\n            type: 'Ed25519',\n            kid: 'didcomm-senderKey-1',\n            publicKeyHex: '1fe9b397c196ab33549041b29cf93be29b9f2bdd27322f05844112fad97ff92a',\n            privateKeyHex:\n              'b57103882f7c66512dc96777cbafbeb2d48eca1e7a867f5a17a84e9a6740f7dc1fe9b397c196ab33549041b29cf93be29b9f2bdd27322f05844112fad97ff92a',\n            kms: 'local',\n          },\n        ],\n        services: [\n          {\n            id: 'msg1',\n            type: 'DIDCommMessaging',\n            serviceEndpoint: 'http://localhost:3002/messaging',\n          },\n        ],\n        provider: 'did:fake',\n        alias: 'sender',\n      })\n\n      receiver = await agent.didManagerImport({\n        did: 'did:fake:z6MkrPhffVLBZpxH7xvKNyD4sRVZeZsNTWJkLdHdgWbfgNu3',\n        keys: [\n          {\n            type: 'Ed25519',\n            kid: 'didcomm-receiverKey-1',\n            publicKeyHex: 'b162e405b6485eff8a57932429b192ec4de13c06813e9028a7cdadf0e2703636',\n            privateKeyHex:\n              '19ed9b6949cfd0f9a57e30f0927839a985fa699491886ebcdda6a954d869732ab162e405b6485eff8a57932429b192ec4de13c06813e9028a7cdadf0e2703636',\n            kms: 'local',\n          },\n        ],\n        services: [\n          {\n            id: 'msg2',\n            type: 'DIDCommMessaging',\n            serviceEndpoint: 'http://localhost:3002/messaging',\n          },\n        ],\n        provider: 'did:fake',\n        alias: 'receiver',\n      })\n      return true\n    })\n    afterAll(testContext.tearDown)\n\n    it('should send a message', async () => {\n      expect.assertions(2)\n      const numMessagesBefore = await agent.dataStoreORMGetMessagesCount({})\n      const numVCsBefore = await agent.dataStoreORMGetVerifiableCredentialsCount({})\n\n      const message = {\n        type: 'test',\n        to: [receiver.did],\n        from: sender.did,\n        id: 'test',\n        body: { hello: 'world' },\n      }\n      const packedMessage = await agent.packDIDCommMessage({\n        packing: 'authcrypt',\n        message,\n      })\n      await agent.sendDIDCommMessage({\n        messageId: '123',\n        packedMessage,\n        recipientDidUrl: receiver.did,\n      })\n\n      const messages = await agent.dataStoreORMGetMessagesCount({})\n      expect(messages).toEqual(numMessagesBefore + 1)\n      const vcs = await agent.dataStoreORMGetVerifiableCredentialsCount({})\n      // should have same number of VCs as before handling message since DIDCommMessage doesn't have VC in it\n      expect(vcs).toEqual(numVCsBefore)\n    })\n\n    const vc = (creator: IIdentifier, proofFormat: string): Promise<VerifiableCredential> => {\n      return agent.createVerifiableCredential({\n        credential: {\n          issuer: { id: creator.did },\n          '@context': ['https://www.w3.org/2018/credentials/v1', 'https://veramo.io/contexts/profile/v1'],\n          type: ['VerifiableCredential', 'Profile'],\n          issuanceDate: new Date().toISOString(),\n          credentialSubject: {\n            name: 'No, 33',\n          },\n        },\n        save: false,\n        proofFormat: proofFormat,\n      })\n    }\n\n    const packed = (vc: VerifiableCredential): Promise<IPackedDIDCommMessage> => {\n      return agent.packDIDCommMessage({\n        packing: 'none',\n        message: {\n          id: v4(),\n          type: 'w3c.vc',\n          from: sender.did,\n          to: [receiver.did],\n          body: vc,\n        },\n      })\n    }\n\n    it('should save LDS credential found inside DIDCommMessage', async () => {\n      expect.assertions(2)\n      const creator = await agent.didManagerGetOrCreate({\n        alias: 'messageCreator1',\n        provider: 'did:ethr:ganache',\n      })\n\n      const numMessagesBefore = await agent.dataStoreORMGetMessagesCount({})\n      const numVCsBefore = await agent.dataStoreORMGetVerifiableCredentialsCount({})\n\n      const verifiableCredential = await vc(creator, 'lds')\n      const packedMessage = await packed(verifiableCredential)\n\n      await agent.sendDIDCommMessage({\n        messageId: 'test-jwt-success',\n        packedMessage,\n        recipientDidUrl: sender.did,\n      })\n      const messages = await agent.dataStoreORMGetMessagesCount({})\n      expect(messages).toEqual(numMessagesBefore + 1)\n      const vcs = await agent.dataStoreORMGetVerifiableCredentialsCount({})\n      expect(vcs).toEqual(numVCsBefore + 1)\n    })\n\n    it('should save JWT credential found inside DIDCommMessage', async () => {\n      expect.assertions(2)\n      const creator = await agent.didManagerGetOrCreate({\n        alias: 'messageCreator1',\n        provider: 'did:ethr:ganache',\n      })\n      const numMessagesBefore = await agent.dataStoreORMGetMessagesCount({})\n      const numVCsBefore = await agent.dataStoreORMGetVerifiableCredentialsCount({})\n\n      const verifiableCredential = await vc(creator, 'jwt')\n      const packedMessage = await packed(verifiableCredential)\n\n      await agent.sendDIDCommMessage({\n        messageId: 'test-jwt-success',\n        packedMessage,\n        recipientDidUrl: sender.did,\n      })\n      const messages = await agent.dataStoreORMGetMessagesCount({})\n      expect(messages).toEqual(numMessagesBefore + 1)\n      const vcs = await agent.dataStoreORMGetVerifiableCredentialsCount({})\n      expect(vcs).toEqual(numVCsBefore + 1)\n    })\n\n    it('should save JWT credential found inside DIDCommMessage', async () => {\n      expect.assertions(2)\n      const creator = await agent.didManagerGetOrCreate({\n        alias: 'messageCreator1',\n        provider: 'did:ethr:ganache',\n      })\n      const numMessagesBefore = await agent.dataStoreORMGetMessagesCount({})\n      const numVCsBefore = await agent.dataStoreORMGetVerifiableCredentialsCount({})\n\n      const verifiableCredential = await vc(creator, 'EthereumEip712Signature2021')\n      const packedMessage = await packed(verifiableCredential)\n\n      await agent.sendDIDCommMessage({\n        messageId: 'test-jwt-success',\n        packedMessage,\n        recipientDidUrl: sender.did,\n      })\n      const messages = await agent.dataStoreORMGetMessagesCount({})\n      expect(messages).toEqual(numMessagesBefore + 1)\n      const vcs = await agent.dataStoreORMGetVerifiableCredentialsCount({})\n      expect(vcs).toEqual(numVCsBefore + 1)\n    })\n  })\n}\n"
  },
  {
    "path": "__tests__/shared/didCommPacking.ts",
    "content": "// noinspection ES6PreferShortImport\n\nimport { IDIDManager, IIdentifier, IKeyManager, IResolver, TAgent } from '../../packages/core-types/src'\nimport { IDIDComm, IDIDCommMessage } from '../../packages/did-comm/src'\n\ntype ConfiguredAgent = TAgent<IDIDManager & IKeyManager & IResolver & IDIDComm>\n\nexport default (testContext: {\n  getAgent: () => ConfiguredAgent\n  setup: () => Promise<boolean>\n  tearDown: () => Promise<boolean>\n}) => {\n  describe('DID comm', () => {\n    let agent: ConfiguredAgent\n    let sender: IIdentifier\n    let receiver: IIdentifier\n\n    beforeAll(async () => {\n      await testContext.setup()\n      agent = testContext.getAgent()\n\n      sender = await agent.didManagerImport({\n        did: 'did:fake:z6MkgbqNU4uF9NKSz5BqJQ4XKVHuQZYcUZP8pXGsJC8nTHwo',\n        keys: [\n          {\n            type: 'Ed25519',\n            kid: 'didcomm-senderKey-1',\n            publicKeyHex: '1fe9b397c196ab33549041b29cf93be29b9f2bdd27322f05844112fad97ff92a',\n            privateKeyHex:\n              'b57103882f7c66512dc96777cbafbeb2d48eca1e7a867f5a17a84e9a6740f7dc1fe9b397c196ab33549041b29cf93be29b9f2bdd27322f05844112fad97ff92a',\n            kms: 'local',\n          },\n        ],\n        services: [],\n        provider: 'did:fake',\n        alias: 'sender',\n      })\n\n      receiver = await agent.didManagerImport({\n        did: 'did:fake:z6MkrPhffVLBZpxH7xvKNyD4sRVZeZsNTWJkLdHdgWbfgNu3',\n        keys: [\n          {\n            type: 'Ed25519',\n            kid: 'didcomm-receiverKey-1',\n            publicKeyHex: 'b162e405b6485eff8a57932429b192ec4de13c06813e9028a7cdadf0e2703636',\n            privateKeyHex:\n              '19ed9b6949cfd0f9a57e30f0927839a985fa699491886ebcdda6a954d869732ab162e405b6485eff8a57932429b192ec4de13c06813e9028a7cdadf0e2703636',\n            kms: 'local',\n          },\n        ],\n        services: [],\n        provider: 'did:fake',\n        alias: 'receiver',\n      })\n      return true\n    })\n    afterAll(testContext.tearDown)\n\n    it('should pack and unpack a plaintext message', async () => {\n      expect.assertions(2)\n      const message: IDIDCommMessage = {\n        type: 'test',\n        to: [receiver.did],\n        id: 'test',\n        body: { hello: 'world' },\n      }\n      const packedMessage = await agent.packDIDCommMessage({\n        packing: 'none',\n        message,\n      })\n      expect(JSON.parse(packedMessage.message).typ).toEqual('application/didcomm-plain+json')\n      const unpackedMessage = await agent.unpackDIDCommMessage(packedMessage)\n      expect(unpackedMessage).toEqual({\n        message: {\n          ...message,\n          typ: 'application/didcomm-plain+json',\n        },\n        metaData: { packing: 'none' },\n      })\n    })\n\n    it('should pack and unpack a JWS message', async () => {\n      const message: IDIDCommMessage = {\n        type: 'test',\n        to: [receiver.did],\n        from: sender.did,\n        id: 'test',\n        body: { hello: 'world' },\n      }\n      const packedMessage = await agent.packDIDCommMessage({\n        packing: 'jws',\n        message,\n      })\n      const unpackedMessage = await agent.unpackDIDCommMessage(packedMessage)\n      expect(unpackedMessage).toEqual({\n        message,\n        metaData: { packing: 'jws' },\n      })\n    })\n\n    it('should pack and unpack an anoncrypted message', async () => {\n      expect.assertions(2)\n      const message :IDIDCommMessage = {\n        type: 'test',\n        to: [receiver.did],\n        id: 'test',\n        body: { hello: 'world' },\n      }\n      const packedMessage = await agent.packDIDCommMessage({\n        packing: 'anoncrypt',\n        message,\n      })\n      const unpackedMessage = await agent.unpackDIDCommMessage(packedMessage)\n      expect(unpackedMessage.message).toEqual(message)\n      expect(unpackedMessage.metaData).toEqual({ packing: 'anoncrypt' })\n    })\n\n    it('should pack and unpack an authcrypted message', async () => {\n      expect.assertions(2)\n      const message: IDIDCommMessage = {\n        type: 'test',\n        to: [receiver.did],\n        from: sender.did,\n        id: 'test',\n        body: { hello: 'world' },\n      }\n      const packedMessage = await agent.packDIDCommMessage({\n        packing: 'authcrypt',\n        message,\n      })\n      const unpackedMessage = await agent.unpackDIDCommMessage(packedMessage)\n      expect(unpackedMessage.message).toEqual(message)\n      expect(unpackedMessage.metaData).toEqual({ packing: 'authcrypt' })\n    })\n\n    it('should pack and unpack message with multiple bcc recipients', async () => {\n      expect.assertions(2)\n\n      const originator = await agent.didManagerCreate({\n        provider: 'did:key',\n      })\n      const beneficiary1 = await agent.didManagerCreate({\n        provider: 'did:key',\n      })\n      const beneficiary2 = await agent.didManagerCreate({\n        provider: 'did:key',\n      })\n\n      const message: IDIDCommMessage = {\n        type: 'test',\n        from: originator.did,\n        to: [originator.did],\n        id: 'test',\n        body: { hello: 'world' },\n      }\n      const packedMessage = await agent.packDIDCommMessage({\n        packing: 'authcrypt',\n        message,\n        options: { bcc: [beneficiary1.did, beneficiary2.did] },\n      })\n\n      // delete originator's key from local KMS\n      await agent.didManagerDelete({ did: originator.did })\n\n      // bcc'd beneficiaries should be able to decrypt\n      const unpackedMessage = await agent.unpackDIDCommMessage(packedMessage)\n      expect(unpackedMessage.message).toEqual(message)\n      expect(unpackedMessage.metaData).toEqual({ packing: 'authcrypt' })\n    })\n\n    it('should pack and fail unpacking message with multiple bcc recipients', async () => {\n      const originator = await agent.didManagerCreate({\n        provider: 'did:key',\n      })\n      const beneficiary1 = await agent.didManagerCreate({\n        provider: 'did:key',\n      })\n      const beneficiary2 = await agent.didManagerCreate({\n        provider: 'did:key',\n      })\n\n      const message: IDIDCommMessage = {\n        type: 'test',\n        from: originator.did,\n        to: [originator.did],\n        id: 'test',\n        body: { hello: 'world' },\n      }\n      const packedMessage = await agent.packDIDCommMessage({\n        packing: 'authcrypt',\n        message,\n        options: { bcc: [beneficiary1.did, beneficiary2.did] },\n      })\n\n      // delete all keys\n      await agent.didManagerDelete({ did: originator.did })\n      await agent.didManagerDelete({ did: beneficiary1.did })\n      await agent.didManagerDelete({ did: beneficiary2.did })\n\n      await expect(agent.unpackDIDCommMessage(packedMessage)).rejects.toThrow(\n        'unable to decrypt DIDComm message with any of the locally managed keys',\n      )\n    })\n  })\n}\n"
  },
  {
    "path": "__tests__/shared/didCommWithEthrDidFlow.ts",
    "content": "// noinspection ES6PreferShortImport\n\nimport {\n  IAgentOptions,\n  IDIDManager,\n  IEventListener,\n  IIdentifier,\n  IKey,\n  IKeyManager,\n  IMessageHandler,\n  IResolver,\n  TAgent,\n} from '../../packages/core-types/src'\nimport { IDIDComm } from '../../packages/did-comm/src'\nimport { MessagingRouter, RequestWithAgentRouter } from '../../packages/remote-server/src'\n// @ts-ignore\nimport express from 'express'\nimport { Server } from 'http'\nimport { jest } from '@jest/globals'\nimport { bytesToBase58, hexToBytes } from '../../packages/utils/src'\n\ntype ConfiguredAgent = TAgent<IDIDManager & IKeyManager & IResolver & IDIDComm & IMessageHandler>\n\nconst DIDCommEventSniffer: IEventListener = {\n  eventTypes: ['DIDCommV2Message-sent', 'DIDCommV2Message-received'],\n  onEvent: jest.fn(() => Promise.resolve()),\n}\n\nexport default (testContext: {\n  getAgent: () => ConfiguredAgent\n  setup: (options?: IAgentOptions) => Promise<boolean>\n  tearDown: () => Promise<boolean>\n}) => {\n  describe('DIDComm using did:ethr:ganache flow', () => {\n    let agent: ConfiguredAgent\n\n    let alice: IIdentifier\n    let bob: IIdentifier\n\n    let didCommEndpointServer: Server\n    let listeningPort = Math.round(Math.random() * 32000 + 2048)\n\n    beforeAll(async () => {\n      await testContext.setup({ plugins: [DIDCommEventSniffer] })\n      agent = testContext.getAgent()\n\n      alice = await agent.didManagerImport({\n        controllerKeyId: 'alice-controller-key',\n        did: 'did:ethr:ganache:0x0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798',\n        provider: 'did:ethr:ganache',\n        alias: 'alice-did-ethr',\n        keys: [\n          {\n            privateKeyHex: '0000000000000000000000000000000000000000000000000000000000000001',\n            kms: 'local',\n            type: 'Secp256k1',\n            kid: 'alice-controller-key',\n          },\n        ],\n      })\n\n      bob = await agent.didManagerImport({\n        controllerKeyId: 'bob-controller-key',\n        did: 'did:ethr:ganache:0x02c6047f9441ed7d6d3045406e95c07cd85c778e4b8cef3ca7abac09b95c709ee5',\n        provider: 'did:ethr:ganache',\n        alias: 'bob-did-ethr',\n        keys: [\n          {\n            privateKeyHex: '0000000000000000000000000000000000000000000000000000000000000002',\n            kms: 'local',\n            type: 'Secp256k1',\n            kid: 'bob-controller-key',\n          },\n        ],\n      })\n\n      const requestWithAgent = RequestWithAgentRouter({ agent })\n\n      await new Promise((resolve) => {\n        //setup a server to receive HTTP messages and forward them to this agent to be processed as DIDComm messages\n        const app = express()\n        // app.use(requestWithAgent)\n        app.use(\n          '/messaging',\n          requestWithAgent,\n          MessagingRouter({\n            metaData: { type: 'DIDComm', value: 'integration test' },\n          }),\n        )\n        didCommEndpointServer = app.listen(listeningPort, () => {\n          resolve(true)\n        })\n      })\n    })\n\n    afterAll(async () => {\n      try {\n        await new Promise((resolve, reject) => didCommEndpointServer?.close(resolve))\n      } catch (e) {\n        //nop\n      }\n      await testContext.tearDown()\n    })\n\n    it('should add dummy service to identifier', async () => {\n      const result = await agent.didManagerAddService({\n        did: alice.did,\n        service: {\n          id: 'localhost-useless-endpoint',\n          type: 'DIDComm',\n          serviceEndpoint: `http://localhost:${listeningPort}/foobar`,\n          description: 'this endpoint will be removed',\n        },\n      })\n      expect(result.substr(0, 2)).toEqual('0x')\n\n      const resolution = await agent.resolveDid({ didUrl: alice.did })\n\n      expect(resolution?.didDocument?.service?.[0].serviceEndpoint).toEqual(\n        `http://localhost:${listeningPort}/foobar`,\n      )\n    })\n\n    it('should remove dummy service from identifier', async () => {\n      const result = await agent.didManagerRemoveService({\n        did: alice.did,\n        id: 'localhost-useless-endpoint',\n      })\n\n      expect(result.substr(0, 2)).toEqual('0x')\n\n      const resolution = await agent.resolveDid({ didUrl: alice.did })\n\n      expect(resolution?.didDocument).not.toBeNull()\n      expect([...(resolution?.didDocument?.service || [])]).toEqual([])\n    })\n\n    it('should add dummy service 2 to identifier', async () => {\n      const result = await agent.didManagerAddService({\n        did: alice.did,\n        service: {\n          id: 'localhost-useless-endpoint-2',\n          type: 'DIDComm',\n          serviceEndpoint: { uri: `http://localhost:${listeningPort}/foobar` },\n          description: 'this endpoint will be removed',\n        },\n      })\n      expect(result.substr(0, 2)).toEqual('0x')\n\n      const resolution = await agent.resolveDid({ didUrl: alice.did })\n\n      expect(resolution?.didDocument?.service?.[0].serviceEndpoint).toEqual({\n        uri: `http://localhost:${listeningPort}/foobar`,\n      })\n    })\n\n    it('should remove dummy service 2 from identifier', async () => {\n      const result = await agent.didManagerRemoveService({\n        did: alice.did,\n        id: 'localhost-useless-endpoint-2',\n      })\n\n      expect(result.substr(0, 2)).toEqual('0x')\n\n      const resolution = await agent.resolveDid({ didUrl: alice.did })\n\n      expect(resolution?.didDocument).not.toBeNull()\n      expect([...(resolution?.didDocument?.service || [])]).toEqual([])\n    })\n\n    it('should add dummy service 3 to identifier', async () => {\n      const result = await agent.didManagerAddService({\n        did: alice.did,\n        service: {\n          id: 'localhost-useless-endpoint-3',\n          type: 'DIDComm',\n          serviceEndpoint: [{ uri: `http://localhost:${listeningPort}/foobar` }],\n          description: 'this endpoint will be removed',\n        },\n      })\n      expect(result.substr(0, 2)).toEqual('0x')\n\n      const resolution = await agent.resolveDid({ didUrl: alice.did })\n\n      expect(resolution?.didDocument?.service?.[0].serviceEndpoint).toEqual([\n        { uri: `http://localhost:${listeningPort}/foobar` },\n      ])\n    })\n\n    it('should remove dummy service 3 from identifier', async () => {\n      const result = await agent.didManagerRemoveService({\n        did: alice.did,\n        id: 'localhost-useless-endpoint-3',\n      })\n\n      expect(result.substr(0, 2)).toEqual('0x')\n\n      const resolution = await agent.resolveDid({ didUrl: alice.did })\n\n      expect(resolution?.didDocument).not.toBeNull()\n      expect([...(resolution?.didDocument?.service || [])]).toEqual([])\n    })\n\n    it('should add dummy service 4 to identifier', async () => {\n      const result = await agent.didManagerAddService({\n        did: alice.did,\n        service: {\n          id: 'localhost-useless-endpoint-4',\n          type: 'DIDComm',\n          serviceEndpoint: [`http://localhost:${listeningPort}/foobar`],\n          description: 'this endpoint will be removed',\n        },\n      })\n      expect(result.substr(0, 2)).toEqual('0x')\n\n      const resolution = await agent.resolveDid({ didUrl: alice.did })\n\n      expect(resolution?.didDocument?.service?.[0].serviceEndpoint).toEqual([\n        `http://localhost:${listeningPort}/foobar`,\n      ])\n    })\n\n    it('should remove dummy service 4 from identifier', async () => {\n      const result = await agent.didManagerRemoveService({\n        did: alice.did,\n        id: 'localhost-useless-endpoint-4',\n      })\n\n      expect(result.substr(0, 2)).toEqual('0x')\n\n      const resolution = await agent.resolveDid({ didUrl: alice.did })\n\n      expect(resolution?.didDocument).not.toBeNull()\n      expect([...(resolution?.didDocument?.service || [])]).toEqual([])\n    })\n\n    let dummyKey: IKey\n\n    it('should add dummy key to identifier', async () => {\n      dummyKey = await agent.keyManagerCreate({\n        kms: 'local',\n        type: 'Secp256k1',\n      })\n\n      const result = await agent.didManagerAddKey({\n        did: alice.did,\n        key: dummyKey,\n      })\n\n      expect(result.substr(0, 2)).toEqual('0x')\n      const resolution = await agent.resolveDid({ didUrl: alice.did })\n      expect(resolution?.didDocument?.verificationMethod?.[2].publicKeyHex).toEqual(dummyKey.publicKeyHex)\n    })\n\n    it('should remove dummy key from identifier', async () => {\n      const result = await agent.didManagerRemoveKey({\n        did: alice.did,\n        kid: dummyKey.kid,\n      })\n\n      expect(result.substr(0, 2)).toEqual('0x')\n      const resolution = await agent.resolveDid({ didUrl: alice.did })\n      expect(resolution?.didDocument?.verificationMethod?.length).toEqual(2)\n    })\n\n    it('should add DIDComm service to receiver DID with serviceEndpoint as string', async () => {\n      const result = await agent.didManagerAddService({\n        did: alice.did,\n        service: {\n          id: 'alice-didcomm-endpoint',\n          type: 'DIDCommMessaging',\n          serviceEndpoint: `http://localhost:${listeningPort}/messaging`,\n          description: 'handles DIDComm messages',\n        },\n      })\n      expect(result.substr(0, 2)).toEqual('0x')\n\n      const resolution = await agent.resolveDid({ didUrl: alice.did })\n\n      expect(resolution?.didDocument?.service?.[0].serviceEndpoint).toEqual(\n        `http://localhost:${listeningPort}/messaging`,\n      )\n    })\n\n    it('should send an signed message from bob to alice with serviceEndpoint as string', async () => {\n      expect.assertions(3)\n\n      const message = {\n        type: 'test',\n        to: [alice.did],\n        from: bob.did,\n        id: 'test-jws-success',\n        body: { hello: 'world' },\n      }\n      const packedMessage = await agent.packDIDCommMessage({\n        packing: 'jws',\n        message,\n      })\n      const result = await agent.sendDIDCommMessage({\n        messageId: 'test-jws-success',\n        packedMessage,\n        recipientDidUrl: alice.did,\n      })\n\n      expect(result).toBeTruthy()\n      expect(DIDCommEventSniffer.onEvent).toHaveBeenCalledWith(\n        { data: 'test-jws-success', type: 'DIDCommV2Message-sent' },\n        expect.anything(),\n      )\n      // in our case, it is the same agent that is receiving the messages\n      expect(DIDCommEventSniffer.onEvent).toHaveBeenCalledWith(\n        {\n          data: {\n            message: {\n              body: { hello: 'world' },\n              from: bob.did,\n              id: 'test-jws-success',\n              to: [alice.did],\n              type: 'test',\n            },\n            metaData: { packing: 'jws' },\n          },\n          type: 'DIDCommV2Message-received',\n        },\n        expect.anything(),\n      )\n    })\n\n    it('should remove DIDComm service from receiver', async () => {\n      const result = await agent.didManagerRemoveService({\n        did: alice.did,\n        id: 'alice-didcomm-endpoint',\n      })\n\n      expect(result.substr(0, 2)).toEqual('0x')\n\n      const resolution = await agent.resolveDid({ didUrl: alice.did })\n\n      expect(resolution?.didDocument).not.toBeNull()\n      expect([...(resolution?.didDocument?.service || [])]).toEqual([])\n    })\n\n    it('should add DIDComm service to receiver DID with serviceEndpoint as array of strings', async () => {\n      const result = await agent.didManagerAddService({\n        did: alice.did,\n        service: {\n          id: 'alice-didcomm-endpoint',\n          type: 'DIDCommMessaging',\n          serviceEndpoint: [`http://localhost:${listeningPort}/messaging`],\n          description: 'handles DIDComm messages',\n        },\n      })\n      expect(result.substr(0, 2)).toEqual('0x')\n\n      const resolution = await agent.resolveDid({ didUrl: alice.did })\n\n      expect(resolution?.didDocument?.service?.[0].serviceEndpoint).toEqual([\n        `http://localhost:${listeningPort}/messaging`,\n      ])\n    })\n\n    it('should send an signed message from bob to alice with serviceEndpoint as array of strings', async () => {\n      expect.assertions(3)\n\n      const message = {\n        type: 'test',\n        to: [alice.did],\n        from: bob.did,\n        id: 'test-jws-success',\n        body: { hello: 'world' },\n      }\n      const packedMessage = await agent.packDIDCommMessage({\n        packing: 'jws',\n        message,\n      })\n      const result = await agent.sendDIDCommMessage({\n        messageId: 'test-jws-success',\n        packedMessage,\n        recipientDidUrl: alice.did,\n      })\n\n      expect(result).toBeTruthy()\n      expect(DIDCommEventSniffer.onEvent).toHaveBeenCalledWith(\n        { data: 'test-jws-success', type: 'DIDCommV2Message-sent' },\n        expect.anything(),\n      )\n      // in our case, it is the same agent that is receiving the messages\n      expect(DIDCommEventSniffer.onEvent).toHaveBeenCalledWith(\n        {\n          data: {\n            message: {\n              body: { hello: 'world' },\n              from: bob.did,\n              id: 'test-jws-success',\n              to: [alice.did],\n              type: 'test',\n            },\n            metaData: { packing: 'jws' },\n          },\n          type: 'DIDCommV2Message-received',\n        },\n        expect.anything(),\n      )\n    })\n\n    it('should remove DIDComm service from receiver', async () => {\n      const result = await agent.didManagerRemoveService({\n        did: alice.did,\n        id: 'alice-didcomm-endpoint',\n      })\n\n      expect(result.substr(0, 2)).toEqual('0x')\n\n      const resolution = await agent.resolveDid({ didUrl: alice.did })\n\n      expect(resolution?.didDocument).not.toBeNull()\n      expect([...(resolution?.didDocument?.service || [])]).toEqual([])\n    })\n\n    it('should add DIDComm service to receiver DID with ServiceEndpoint as object', async () => {\n      const result = await agent.didManagerAddService({\n        did: alice.did,\n        service: {\n          id: 'alice-didcomm-endpoint',\n          type: 'DIDCommMessaging',\n          serviceEndpoint: { uri: `http://localhost:${listeningPort}/messaging` },\n          description: 'handles DIDComm messages',\n        },\n      })\n      expect(result.substr(0, 2)).toEqual('0x')\n\n      const resolution = await agent.resolveDid({ didUrl: alice.did })\n\n      expect(resolution?.didDocument?.service?.[0].serviceEndpoint).toEqual({\n        uri: `http://localhost:${listeningPort}/messaging`,\n      })\n    })\n\n    it('should send an signed message from bob to alice with ServiceEndpoint as object', async () => {\n      expect.assertions(3)\n\n      const message = {\n        type: 'test',\n        to: [alice.did],\n        from: bob.did,\n        id: 'test-jws-success',\n        body: { hello: 'world' },\n      }\n      const packedMessage = await agent.packDIDCommMessage({\n        packing: 'jws',\n        message,\n      })\n      const result = await agent.sendDIDCommMessage({\n        messageId: 'test-jws-success',\n        packedMessage,\n        recipientDidUrl: alice.did,\n      })\n\n      expect(result).toBeTruthy()\n      expect(DIDCommEventSniffer.onEvent).toHaveBeenCalledWith(\n        { data: 'test-jws-success', type: 'DIDCommV2Message-sent' },\n        expect.anything(),\n      )\n      // in our case, it is the same agent that is receiving the messages\n      expect(DIDCommEventSniffer.onEvent).toHaveBeenCalledWith(\n        {\n          data: {\n            message: {\n              body: { hello: 'world' },\n              from: bob.did,\n              id: 'test-jws-success',\n              to: [alice.did],\n              type: 'test',\n            },\n            metaData: { packing: 'jws' },\n          },\n          type: 'DIDCommV2Message-received',\n        },\n        expect.anything(),\n      )\n    })\n\n    it('should remove DIDComm service from receiver', async () => {\n      const result = await agent.didManagerRemoveService({\n        did: alice.did,\n        id: 'alice-didcomm-endpoint',\n      })\n\n      expect(result.substr(0, 2)).toEqual('0x')\n\n      const resolution = await agent.resolveDid({ didUrl: alice.did })\n\n      expect(resolution?.didDocument).not.toBeNull()\n      expect([...(resolution?.didDocument?.service || [])]).toEqual([])\n    })\n\n    it('should add DIDComm service to receiver DID with serviceEndpoint as array of ServiceEndpoint objects', async () => {\n      const result = await agent.didManagerAddService({\n        did: alice.did,\n        service: {\n          id: 'alice-didcomm-endpoint',\n          type: 'DIDCommMessaging',\n          serviceEndpoint: [{ uri: `http://localhost:${listeningPort}/messaging` }],\n          description: 'handles DIDComm messages',\n        },\n      })\n      expect(result.substr(0, 2)).toEqual('0x')\n\n      const resolution = await agent.resolveDid({ didUrl: alice.did })\n\n      expect(resolution?.didDocument?.service?.[0].serviceEndpoint).toEqual([\n        { uri: `http://localhost:${listeningPort}/messaging` },\n      ])\n    })\n\n    it('should send an signed message from bob to alice with serviceEndpoint as array of ServiceEndpoint objects', async () => {\n      expect.assertions(3)\n\n      const message = {\n        type: 'test',\n        to: [alice.did],\n        from: bob.did,\n        id: 'test-jws-success',\n        body: { hello: 'world' },\n      }\n      const packedMessage = await agent.packDIDCommMessage({\n        packing: 'jws',\n        message,\n      })\n      const result = await agent.sendDIDCommMessage({\n        messageId: 'test-jws-success',\n        packedMessage,\n        recipientDidUrl: alice.did,\n      })\n\n      expect(result).toBeTruthy()\n      expect(DIDCommEventSniffer.onEvent).toHaveBeenCalledWith(\n        { data: 'test-jws-success', type: 'DIDCommV2Message-sent' },\n        expect.anything(),\n      )\n      // in our case, it is the same agent that is receiving the messages\n      expect(DIDCommEventSniffer.onEvent).toHaveBeenCalledWith(\n        {\n          data: {\n            message: {\n              body: { hello: 'world' },\n              from: bob.did,\n              id: 'test-jws-success',\n              to: [alice.did],\n              type: 'test',\n            },\n            metaData: { packing: 'jws' },\n          },\n          type: 'DIDCommV2Message-received',\n        },\n        expect.anything(),\n      )\n    })\n\n    it('should fail to pack an anoncrypt message from bob to alice (no receiver key)', async () => {\n      expect.assertions(1)\n\n      const message = {\n        type: 'test',\n        to: [alice.did],\n        from: bob.did,\n        id: 'test-anoncrypt-fail',\n        body: { hello: 'world' },\n      }\n      await expect(\n        agent.packDIDCommMessage({\n          packing: 'anoncrypt',\n          message,\n        }),\n      ).rejects.toThrow(/^key_not_found: no key agreement keys found for recipient/)\n    })\n\n    it('should add encryption key to receiver DID', async () => {\n      const newKey = await agent.keyManagerCreate({\n        kms: 'local',\n        type: 'X25519',\n      })\n\n      const result = await agent.didManagerAddKey({\n        did: alice.did,\n        key: newKey,\n      })\n\n      expect(result.substring(0, 2)).toEqual('0x')\n      const resolution = await agent.resolveDid({ didUrl: alice.did })\n      const expectedBase58Key = bytesToBase58(hexToBytes(newKey.publicKeyHex))\n      expect(resolution?.didDocument?.verificationMethod?.[2].publicKeyBase58).toEqual(expectedBase58Key)\n      expect(resolution?.didDocument?.keyAgreement?.[0]).toEqual(\n        resolution?.didDocument?.verificationMethod?.[2].id,\n      )\n    })\n\n    it('should send an anoncrypt message from bob to alice', async () => {\n      expect.assertions(3)\n\n      const message = {\n        type: 'test',\n        to: [alice.did],\n        from: bob.did,\n        id: 'test-anoncrypt-success',\n        body: { hello: 'world' },\n      }\n      const packedMessage = await agent.packDIDCommMessage({\n        packing: 'anoncrypt',\n        message,\n      })\n      const result = await agent.sendDIDCommMessage({\n        messageId: 'test-anoncrypt-success',\n        packedMessage,\n        recipientDidUrl: alice.did,\n      })\n\n      expect(result).toBeTruthy()\n      expect(DIDCommEventSniffer.onEvent).toHaveBeenCalledWith(\n        { data: 'test-anoncrypt-success', type: 'DIDCommV2Message-sent' },\n        expect.anything(),\n      )\n      // in our case, it is the same agent that is receiving the messages\n      expect(DIDCommEventSniffer.onEvent).toHaveBeenCalledWith(\n        {\n          data: {\n            message: {\n              body: { hello: 'world' },\n              from: 'did:ethr:ganache:0x02c6047f9441ed7d6d3045406e95c07cd85c778e4b8cef3ca7abac09b95c709ee5',\n              id: 'test-anoncrypt-success',\n              to: ['did:ethr:ganache:0x0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798'],\n              type: 'test',\n            },\n            metaData: { packing: 'anoncrypt' },\n          },\n          type: 'DIDCommV2Message-received',\n        },\n        expect.anything(),\n      )\n    })\n\n    it('should fail to send jws message from alice to bob (no service endpoint)', async () => {\n      expect.assertions(1)\n\n      const message = {\n        type: 'test',\n        to: [bob.did],\n        from: alice.did,\n        id: 'test-endpoint-fail',\n        body: { hello: 'world' },\n      }\n      const packedMessage = await agent.packDIDCommMessage({\n        packing: 'jws',\n        message,\n      })\n      await expect(\n        agent.sendDIDCommMessage({\n          messageId: 'test-endpoint-fail',\n          packedMessage,\n          recipientDidUrl: bob.did,\n        }),\n      ).rejects.toThrow(/^not_found: could not find DIDComm Messaging service in DID document for/)\n    })\n\n    it('should fail to pack an authcrypt message from bob to alice (no skid)', async () => {\n      expect.assertions(1)\n\n      const message = {\n        type: 'test',\n        to: [alice.did],\n        from: bob.did,\n        id: 'test-authcrypt-fail',\n        body: { hello: 'world' },\n      }\n      const packedMessage = await expect(\n        agent.packDIDCommMessage({\n          packing: 'authcrypt',\n          message,\n        }),\n      ).rejects.toThrow(/^key_not_found: could not map an agent key to an skid for/)\n    })\n\n    it('should add encryption key to sender DID', async () => {\n      const newKey = await agent.keyManagerCreate({\n        kms: 'local',\n        type: 'X25519',\n      })\n\n      const result = await agent.didManagerAddKey({\n        did: bob.did,\n        key: newKey,\n      })\n\n      expect(result.substr(0, 2)).toEqual('0x')\n      const resolution = await agent.resolveDid({ didUrl: bob.did })\n      const expectedBase58Key = bytesToBase58(hexToBytes(newKey.publicKeyHex))\n      expect(resolution?.didDocument?.verificationMethod?.[2].publicKeyBase58).toEqual(expectedBase58Key)\n      expect(resolution?.didDocument?.keyAgreement?.[0]).toEqual(\n        resolution?.didDocument?.verificationMethod?.[2].id,\n      )\n    })\n\n    it('should send an authcrypt message from bob to alice', async () => {\n      expect.assertions(3)\n\n      const message = {\n        type: 'test',\n        to: [alice.did],\n        from: bob.did,\n        id: 'test-authcrypt-success',\n        body: { hello: 'world' },\n      }\n      const packedMessage = await agent.packDIDCommMessage({\n        packing: 'authcrypt',\n        message,\n      })\n      const result = await agent.sendDIDCommMessage({\n        messageId: 'test-authcrypt-success',\n        packedMessage,\n        recipientDidUrl: alice.did,\n      })\n\n      expect(result).toBeTruthy()\n      expect(DIDCommEventSniffer.onEvent).toHaveBeenCalledWith(\n        { data: 'test-authcrypt-success', type: 'DIDCommV2Message-sent' },\n        expect.anything(),\n      )\n      // in our case, it is the same agent that is receiving the messages\n      expect(DIDCommEventSniffer.onEvent).toHaveBeenCalledWith(\n        {\n          data: {\n            message: {\n              body: { hello: 'world' },\n              from: bob.did,\n              id: 'test-authcrypt-success',\n              to: [alice.did],\n              type: 'test',\n            },\n            metaData: { packing: 'authcrypt' },\n          },\n          type: 'DIDCommV2Message-received',\n        },\n        expect.anything(),\n      )\n    })\n  })\n}\n"
  },
  {
    "path": "__tests__/shared/didCommWithFakeDidFlow.ts",
    "content": "// noinspection ES6PreferShortImport\n\nimport {\n  IAgentOptions,\n  IDIDManager,\n  IEventListener,\n  IIdentifier,\n  IKeyManager,\n  IResolver,\n  TAgent,\n} from '../../packages/core-types/src'\nimport { IDIDComm } from '../../packages/did-comm/src'\nimport { jest } from '@jest/globals'\n\ntype ConfiguredAgent = TAgent<IDIDManager & IKeyManager & IResolver & IDIDComm>\n\nconst DIDCommEventSniffer: IEventListener = {\n  eventTypes: ['DIDCommV2Message-sent', 'DIDCommV2Message-received', 'DIDCommV2Message-forwarded'],\n  onEvent: jest.fn(() => Promise.resolve()),\n}\n\nexport default (testContext: {\n  getAgent: () => ConfiguredAgent\n  setup: (options?: IAgentOptions) => Promise<boolean>\n  tearDown: () => Promise<boolean>\n}) => {\n  describe('DID comm using did:fake flow', () => {\n    let agent: ConfiguredAgent\n    let sender: IIdentifier\n    let mediator: IIdentifier\n    let mediator2: IIdentifier\n    let receiver: IIdentifier\n    let receiverWithMediation: IIdentifier\n    let receiverWithMediation2: IIdentifier\n    let receiverWithMediation3: IIdentifier\n    let receiverWithMediation4: IIdentifier\n    let receiverWithMediation5: IIdentifier\n\n    beforeAll(async () => {\n      await testContext.setup({ plugins: [DIDCommEventSniffer] })\n      agent = testContext.getAgent()\n\n      sender = await agent.didManagerImport({\n        did: 'did:fake:z6MkgbqNU4uF9NKSz5BqJQ4XKVHuQZYcUZP8pXGsJC8nTHwo',\n        keys: [\n          {\n            type: 'Ed25519',\n            kid: 'didcomm-senderKey-1',\n            publicKeyHex: '1fe9b397c196ab33549041b29cf93be29b9f2bdd27322f05844112fad97ff92a',\n            privateKeyHex:\n              'b57103882f7c66512dc96777cbafbeb2d48eca1e7a867f5a17a84e9a6740f7dc1fe9b397c196ab33549041b29cf93be29b9f2bdd27322f05844112fad97ff92a',\n            kms: 'local',\n          },\n        ],\n        services: [\n          {\n            id: 'msg1',\n            type: 'DIDCommMessaging',\n            serviceEndpoint: 'http://localhost:3002/messaging',\n          },\n        ],\n        provider: 'did:fake',\n        alias: 'sender',\n      })\n\n      mediator = await agent.didManagerImport({\n        did: 'did:fake:mediator',\n        keys: [\n          {\n            type: 'Ed25519',\n            kid: 'didcomm-mediatorKey-1',\n            publicKeyHex: '1fe9b397c196ab33549041b29cf93be29b9f2bdd27322f05844112fad97ff92a',\n            privateKeyHex:\n              'b57103882f7c66512dc96777cbafbeb2d48eca1e7a867f5a17a84e9a6740f7dc1fe9b397c196ab33549041b29cf93be29b9f2bdd27322f05844112fad97ff92a',\n            kms: 'local',\n          },\n        ],\n        services: [\n          {\n            id: 'msgM1',\n            type: 'DIDCommMessaging',\n            serviceEndpoint: 'http://localhost:3002/messaging',\n          },\n        ],\n        provider: 'did:fake',\n        alias: 'mediator',\n      })\n\n      mediator2 = await agent.didManagerImport({\n        did: 'did:fake:mediator2',\n        keys: [\n          {\n            type: 'Ed25519',\n            kid: 'didcomm-mediator2Key-1',\n            publicKeyHex: '1fe9b397c196ab33549041b29cf93be29b9f2bdd27322f05844112fad97ff92a',\n            privateKeyHex:\n              'b57103882f7c66512dc96777cbafbeb2d48eca1e7a867f5a17a84e9a6740f7dc1fe9b397c196ab33549041b29cf93be29b9f2bdd27322f05844112fad97ff92a',\n            kms: 'local',\n          },\n        ],\n        services: [\n          {\n            id: 'msgM2',\n            type: 'DIDCommMessaging',\n            serviceEndpoint: 'http://localhost:3002/messaging',\n          },\n        ],\n        provider: 'did:fake',\n        alias: 'mediator2',\n      })\n\n      receiver = await agent.didManagerImport({\n        did: 'did:fake:z6MkrPhffVLBZpxH7xvKNyD4sRVZeZsNTWJkLdHdgWbfgNu3',\n        keys: [\n          {\n            type: 'Ed25519',\n            kid: 'didcomm-receiverKey-1',\n            publicKeyHex: 'b162e405b6485eff8a57932429b192ec4de13c06813e9028a7cdadf0e2703636',\n            privateKeyHex:\n              '19ed9b6949cfd0f9a57e30f0927839a985fa699491886ebcdda6a954d869732ab162e405b6485eff8a57932429b192ec4de13c06813e9028a7cdadf0e2703636',\n            kms: 'local',\n          },\n        ],\n        services: [\n          {\n            id: 'msg2',\n            type: 'DIDCommMessaging',\n            serviceEndpoint: 'http://localhost:3002/messaging',\n          },\n        ],\n        provider: 'did:fake',\n        alias: 'receiver',\n      })\n\n      receiverWithMediation = await agent.didManagerImport({\n        did: 'did:fake:receiverWithMediation',\n        keys: [\n          {\n            type: 'Ed25519',\n            kid: 'didcomm-receiverWithMediationKey-1',\n            publicKeyHex: 'b162e405b6485eff8a57932429b192ec4de13c06813e9028a7cdadf0e2703636',\n            privateKeyHex:\n              '19ed9b6949cfd0f9a57e30f0927839a985fa699491886ebcdda6a954d869732ab162e405b6485eff8a57932429b192ec4de13c06813e9028a7cdadf0e2703636',\n            kms: 'local',\n          },\n        ],\n        services: [\n          {\n            id: 'msg3',\n            type: 'DIDCommMessaging',\n            serviceEndpoint: [\n              {\n                uri: 'http://localhost:3002/messaging',\n                routingKeys: [`${mediator.did}#${mediator.keys[0].kid}`],\n              },\n            ],\n          },\n        ],\n        provider: 'did:fake',\n        alias: 'receiverWithMediation',\n      })\n\n      receiverWithMediation2 = await agent.didManagerImport({\n        did: 'did:fake:receiverWithMediation2',\n        keys: [\n          {\n            type: 'Ed25519',\n            kid: 'didcomm-receiverWithMediation2Key-1',\n            publicKeyHex: 'b162e405b6485eff8a57932429b192ec4de13c06813e9028a7cdadf0e2703636',\n            privateKeyHex:\n              '19ed9b6949cfd0f9a57e30f0927839a985fa699491886ebcdda6a954d869732ab162e405b6485eff8a57932429b192ec4de13c06813e9028a7cdadf0e2703636',\n            kms: 'local',\n          },\n        ],\n        services: [\n          {\n            id: 'msg4',\n            type: 'DIDCommMessaging',\n            serviceEndpoint: [\n              {\n                uri: 'http://localhost:3002/messaging',\n                routingKeys: [\n                  `${mediator2.did}#${mediator2.keys[0].kid}`,\n                  `${mediator.did}#${mediator.keys[0].kid}`,\n                ],\n              },\n            ],\n          },\n        ],\n        provider: 'did:fake',\n        alias: 'receiverWithMediation2',\n      })\n\n      receiverWithMediation3 = await agent.didManagerImport({\n        did: 'did:fake:receiverWithMediation3',\n        keys: [\n          {\n            type: 'Ed25519',\n            kid: 'didcomm-receiverWithMediation3Key-1',\n            publicKeyHex: 'b162e405b6485eff8a57932429b192ec4de13c06813e9028a7cdadf0e2703636',\n            privateKeyHex:\n              '19ed9b6949cfd0f9a57e30f0927839a985fa699491886ebcdda6a954d869732ab162e405b6485eff8a57932429b192ec4de13c06813e9028a7cdadf0e2703636',\n            kms: 'local',\n          },\n        ],\n        services: [\n          {\n            id: 'msg5',\n            type: 'DIDCommMessaging',\n            serviceEndpoint: [{ uri: mediator.did }],\n          },\n        ],\n        provider: 'did:fake',\n        alias: 'receiverWithMediation3',\n      })\n\n      receiverWithMediation4 = await agent.didManagerImport({\n        did: 'did:fake:receiverWithMediation4',\n        keys: [\n          {\n            type: 'Ed25519',\n            kid: 'didcomm-receiverWithMediation4Key-1',\n            publicKeyHex: 'b162e405b6485eff8a57932429b192ec4de13c06813e9028a7cdadf0e2703636',\n            privateKeyHex:\n              '19ed9b6949cfd0f9a57e30f0927839a985fa699491886ebcdda6a954d869732ab162e405b6485eff8a57932429b192ec4de13c06813e9028a7cdadf0e2703636',\n            kms: 'local',\n          },\n        ],\n        services: [\n          {\n            id: 'msg6',\n            type: 'DIDCommMessaging',\n            serviceEndpoint: [\n              { uri: mediator2.did, routingKeys: [`${mediator.did}#${mediator.keys[0].kid}`] },\n            ],\n          },\n        ],\n        provider: 'did:fake',\n        alias: 'receiverWithMediation4',\n      })\n\n      receiverWithMediation5 = await agent.didManagerImport({\n        did: 'did:fake:receiverWithMediation5',\n        keys: [\n          {\n            type: 'Ed25519',\n            kid: 'didcomm-receiverWithMediation5Key-1',\n            publicKeyHex: 'b162e405b6485eff8a57932429b192ec4de13c06813e9028a7cdadf0e2703636',\n            privateKeyHex:\n              '19ed9b6949cfd0f9a57e30f0927839a985fa699491886ebcdda6a954d869732ab162e405b6485eff8a57932429b192ec4de13c06813e9028a7cdadf0e2703636',\n            kms: 'local',\n          },\n        ],\n        services: [\n          {\n            id: 'msg7',\n            type: 'DIDCommMessaging',\n            serviceEndpoint: {\n              uri: 'http://localhost:3002/messaging',\n              routingKeys: [`${mediator.did}#${mediator.keys[0].kid}`],\n            },\n          },\n        ],\n        provider: 'did:fake',\n        alias: 'receiverWithMediation5',\n      })\n\n      return true\n    })\n    afterAll(testContext.tearDown)\n\n    it('should send a message', async () => {\n      expect.assertions(3)\n\n      const message = {\n        type: 'test',\n        to: [receiver.did],\n        from: sender.did,\n        id: 'test',\n        body: { hello: 'world' },\n      }\n      const packedMessage = await agent.packDIDCommMessage({\n        packing: 'authcrypt',\n        message,\n      })\n      const result = await agent.sendDIDCommMessage({\n        messageId: '123',\n        packedMessage,\n        recipientDidUrl: receiver.did,\n      })\n\n      expect(result).toBeTruthy()\n      expect(DIDCommEventSniffer.onEvent).toHaveBeenCalledWith(\n        { data: '123', type: 'DIDCommV2Message-sent' },\n        expect.anything(),\n      )\n      // in our case, it is the same agent that is receiving the messages\n      expect(DIDCommEventSniffer.onEvent).toHaveBeenCalledWith(\n        {\n          data: {\n            message: {\n              body: { hello: 'world' },\n              from: 'did:fake:z6MkgbqNU4uF9NKSz5BqJQ4XKVHuQZYcUZP8pXGsJC8nTHwo',\n              id: 'test',\n              to: ['did:fake:z6MkrPhffVLBZpxH7xvKNyD4sRVZeZsNTWJkLdHdgWbfgNu3'],\n              type: 'test',\n            },\n            metaData: { packing: 'authcrypt' },\n          },\n          type: 'DIDCommV2Message-received',\n        },\n        expect.anything(),\n      )\n    })\n\n    it('should wrap and forward a message to single mediator via routingKeys', async () => {\n      expect.assertions(4)\n\n      const message = {\n        type: 'test',\n        to: [receiverWithMediation.did],\n        from: sender.did,\n        id: 'test',\n        body: { hello: 'world' },\n      }\n      const packedMessage = await agent.packDIDCommMessage({\n        packing: 'authcrypt',\n        message,\n      })\n      const result = await agent.sendDIDCommMessage({\n        messageId: '123',\n        packedMessage,\n        recipientDidUrl: receiverWithMediation.did,\n      })\n\n      expect(result).toBeTruthy()\n      expect(DIDCommEventSniffer.onEvent).toHaveBeenCalledWith(\n        {\n          data: {\n            messageId: '123',\n            next: receiverWithMediation.did,\n            routingKey: 'did:fake:mediator#didcomm-mediatorKey-1',\n          },\n          type: 'DIDCommV2Message-forwarded',\n        },\n        expect.anything(),\n      )\n      expect(DIDCommEventSniffer.onEvent).toHaveBeenCalledWith(\n        { data: '123', type: 'DIDCommV2Message-sent' },\n        expect.anything(),\n      )\n      // in our case, it is the same agent that is receiving the messages\n      expect(DIDCommEventSniffer.onEvent).toHaveBeenCalledWith(\n        {\n          data: {\n            message: {\n              body: { next: receiverWithMediation.did },\n              id: expect.anything(),\n              to: [mediator.did],\n              type: 'https://didcomm.org/routing/2.0/forward',\n              attachments: expect.anything(),\n            },\n            metaData: { packing: 'anoncrypt' },\n          },\n          type: 'DIDCommV2Message-received',\n        },\n        expect.anything(),\n      )\n    })\n\n    it('should wrap and forward a message to single mediator via routingKeys in single service endpoint', async () => {\n      expect.assertions(4)\n\n      const message = {\n        type: 'test',\n        to: [receiverWithMediation5.did],\n        from: sender.did,\n        id: 'test',\n        body: { hello: 'world' },\n      }\n      const packedMessage = await agent.packDIDCommMessage({\n        packing: 'authcrypt',\n        message,\n      })\n      const result = await agent.sendDIDCommMessage({\n        messageId: '123',\n        packedMessage,\n        recipientDidUrl: receiverWithMediation5.did,\n      })\n\n      expect(result).toBeTruthy()\n      expect(DIDCommEventSniffer.onEvent).toHaveBeenCalledWith(\n        {\n          data: {\n            messageId: '123',\n            next: receiverWithMediation5.did,\n            routingKey: 'did:fake:mediator#didcomm-mediatorKey-1',\n          },\n          type: 'DIDCommV2Message-forwarded',\n        },\n        expect.anything(),\n      )\n      expect(DIDCommEventSniffer.onEvent).toHaveBeenCalledWith(\n        { data: '123', type: 'DIDCommV2Message-sent' },\n        expect.anything(),\n      )\n      // in our case, it is the same agent that is receiving the messages\n      expect(DIDCommEventSniffer.onEvent).toHaveBeenCalledWith(\n        {\n          data: {\n            message: {\n              body: { next: receiverWithMediation5.did },\n              id: expect.anything(),\n              to: [mediator.did],\n              type: 'https://didcomm.org/routing/2.0/forward',\n              attachments: expect.anything(),\n            },\n            metaData: { packing: 'anoncrypt' },\n          },\n          type: 'DIDCommV2Message-received',\n        },\n        expect.anything(),\n      )\n    })\n\n    it('should wrap and forward a message to multiple mediators via routingKeys', async () => {\n      expect.assertions(5)\n\n      const message = {\n        type: 'test',\n        to: [receiverWithMediation2.did],\n        from: sender.did,\n        id: 'test',\n        body: { hello: 'world' },\n      }\n      const packedMessage = await agent.packDIDCommMessage({\n        packing: 'authcrypt',\n        message,\n      })\n      const result = await agent.sendDIDCommMessage({\n        messageId: '123',\n        packedMessage,\n        recipientDidUrl: receiverWithMediation2.did,\n      })\n\n      expect(result).toBeTruthy()\n      expect(DIDCommEventSniffer.onEvent).toHaveBeenCalledWith(\n        {\n          data: {\n            messageId: '123',\n            next: receiverWithMediation2.did,\n            routingKey: 'did:fake:mediator#didcomm-mediatorKey-1',\n          },\n          type: 'DIDCommV2Message-forwarded',\n        },\n        expect.anything(),\n      )\n      expect(DIDCommEventSniffer.onEvent).toHaveBeenCalledWith(\n        {\n          data: {\n            messageId: '123',\n            next: mediator.did,\n            routingKey: 'did:fake:mediator2#didcomm-mediator2Key-1',\n          },\n          type: 'DIDCommV2Message-forwarded',\n        },\n        expect.anything(),\n      )\n      expect(DIDCommEventSniffer.onEvent).toHaveBeenCalledWith(\n        { data: '123', type: 'DIDCommV2Message-sent' },\n        expect.anything(),\n      )\n      // in our case, it is the same agent that is receiving the messages\n      expect(DIDCommEventSniffer.onEvent).toHaveBeenCalledWith(\n        {\n          data: {\n            message: {\n              body: { next: mediator.did },\n              id: expect.anything(),\n              to: [mediator2.did],\n              type: 'https://didcomm.org/routing/2.0/forward',\n              attachments: expect.anything(),\n            },\n            metaData: { packing: 'anoncrypt' },\n          },\n          type: 'DIDCommV2Message-received',\n        },\n        expect.anything(),\n      )\n    })\n\n    it('should wrap and forward a message to single mediator via DID as URI', async () => {\n      expect.assertions(4)\n\n      const message = {\n        type: 'test',\n        to: [receiverWithMediation3.did],\n        from: sender.did,\n        id: 'test',\n        body: { hello: 'world' },\n      }\n      const packedMessage = await agent.packDIDCommMessage({\n        packing: 'authcrypt',\n        message,\n      })\n      const result = await agent.sendDIDCommMessage({\n        messageId: '123',\n        packedMessage,\n        recipientDidUrl: receiverWithMediation3.did,\n      })\n\n      expect(result).toBeTruthy()\n      expect(DIDCommEventSniffer.onEvent).toHaveBeenCalledWith(\n        {\n          data: {\n            messageId: '123',\n            next: receiverWithMediation3.did,\n            routingKey: 'did:fake:mediator',\n          },\n          type: 'DIDCommV2Message-forwarded',\n        },\n        expect.anything(),\n      )\n      expect(DIDCommEventSniffer.onEvent).toHaveBeenCalledWith(\n        { data: '123', type: 'DIDCommV2Message-sent' },\n        expect.anything(),\n      )\n      // in our case, it is the same agent that is receiving the messages\n      expect(DIDCommEventSniffer.onEvent).toHaveBeenCalledWith(\n        {\n          data: {\n            message: {\n              body: { next: receiverWithMediation3.did },\n              id: expect.anything(),\n              to: [mediator.did],\n              type: 'https://didcomm.org/routing/2.0/forward',\n              attachments: expect.anything(),\n            },\n            metaData: { packing: 'anoncrypt' },\n          },\n          type: 'DIDCommV2Message-received',\n        },\n        expect.anything(),\n      )\n    })\n\n    it('should wrap and forward a message to multiple mediators via DID as URI and routingKeys', async () => {\n      expect.assertions(5)\n\n      const message = {\n        type: 'test',\n        to: [receiverWithMediation4.did],\n        from: sender.did,\n        id: 'test',\n        body: { hello: 'world' },\n      }\n      const packedMessage = await agent.packDIDCommMessage({\n        packing: 'authcrypt',\n        message,\n      })\n      const result = await agent.sendDIDCommMessage({\n        messageId: '123',\n        packedMessage,\n        recipientDidUrl: receiverWithMediation4.did,\n      })\n\n      expect(result).toBeTruthy()\n      expect(DIDCommEventSniffer.onEvent).toHaveBeenCalledWith(\n        {\n          data: {\n            messageId: '123',\n            next: receiverWithMediation4.did,\n            routingKey: 'did:fake:mediator#didcomm-mediatorKey-1',\n          },\n          type: 'DIDCommV2Message-forwarded',\n        },\n        expect.anything(),\n      )\n      expect(DIDCommEventSniffer.onEvent).toHaveBeenCalledWith(\n        {\n          data: {\n            messageId: '123',\n            next: mediator.did,\n            routingKey: 'did:fake:mediator2',\n          },\n          type: 'DIDCommV2Message-forwarded',\n        },\n        expect.anything(),\n      )\n      expect(DIDCommEventSniffer.onEvent).toHaveBeenCalledWith(\n        { data: '123', type: 'DIDCommV2Message-sent' },\n        expect.anything(),\n      )\n      // in our case, it is the same agent that is receiving the messages\n      expect(DIDCommEventSniffer.onEvent).toHaveBeenCalledWith(\n        {\n          data: {\n            message: {\n              body: { next: mediator.did },\n              id: expect.anything(),\n              to: [mediator2.did],\n              type: 'https://didcomm.org/routing/2.0/forward',\n              attachments: expect.anything(),\n            },\n            metaData: { packing: 'anoncrypt' },\n          },\n          type: 'DIDCommV2Message-received',\n        },\n        expect.anything(),\n      )\n    })\n  })\n}\n"
  },
  {
    "path": "__tests__/shared/didCommWithPeerDidFlow.ts",
    "content": "// noinspection ES6PreferShortImport\n\nimport {\n  IAgentOptions,\n  IDIDManager,\n  IEventListener,\n  IIdentifier,\n  IKeyManager,\n  IResolver,\n  TAgent,\n} from '../../packages/core-types/src'\nimport { IDIDComm } from '../../packages/did-comm/src'\nimport { jest } from '@jest/globals'\n\ntype ConfiguredAgent = TAgent<IDIDManager & IKeyManager & IResolver & IDIDComm>\n\nconst DIDCommEventSniffer: IEventListener = {\n  eventTypes: ['DIDCommV2Message-sent', 'DIDCommV2Message-received', 'DIDCommV2Message-forwarded'],\n  onEvent: jest.fn(() => Promise.resolve()),\n}\n\nexport default (testContext: {\n  getAgent: () => ConfiguredAgent\n  setup: (options?: IAgentOptions) => Promise<boolean>\n  tearDown: () => Promise<boolean>\n}) => {\n  describe('DID comm using did:peer flow', () => {\n    let agent: ConfiguredAgent\n    let sender: IIdentifier\n    let receiver: IIdentifier\n\n    beforeAll(async () => {\n      await testContext.setup({ plugins: [DIDCommEventSniffer] })\n      agent = testContext.getAgent()\n\n      sender = await agent.didManagerCreate({\n        \"alias\": \"sender\",\n        \"provider\": \"did:peer\",\n        \"kms\": \"local\",\n        \"options\": {\"num_algo\":2 , \"service\" : {\"id\":\"12344\",\"type\":\"didcommv2\",\"serviceEndpoint\":\"alexexxxxx\",\"description\":\"an endpoint\"}\n      }\n      })\n\n      receiver = await agent.didManagerCreate({\n        \"alias\": \"receiver\",\n        \"provider\": \"did:peer\",\n        \"kms\": \"local\",\n        \"options\": {\"num_algo\":2 , \"service\" : {\"id\":\"12345\",\"type\":\"didcommv2\",\"serviceEndpoint\":\"alexexxxxx\",\"description\":\"an endpoint\"}\n      }\n      })\n\n      return true\n    })\n    afterAll(testContext.tearDown)\n\n    it('should pack and unpack a message', async () => {\n      expect.assertions(2)\n\n      const message = {\n        type: 'test',\n        to: [receiver.did],\n        from: sender.did,\n        id: 'test',\n        body: { hello: 'world' },\n      }\n      const packedMessage = await agent.packDIDCommMessage({\n        packing: 'authcrypt',\n        message,\n      })\n      expect(packedMessage).toBeDefined()\n\n      const unpackedMessage = await agent.unpackDIDCommMessage(packedMessage)\n      expect(unpackedMessage.message.id).toEqual('test')\n    })\n  })\n}\n"
  },
  {
    "path": "__tests__/shared/didDiscovery.ts",
    "content": "// noinspection ES6PreferShortImport\n\nimport { IDIDDiscovery } from '../../packages/did-discovery/src'\nimport { IAgentOptions, ICredentialIssuer, IDataStoreORM, IDIDManager, TAgent } from '../../packages/core-types/src'\n\ntype ConfiguredAgent = TAgent<IDIDManager & IDIDDiscovery & IDataStoreORM & ICredentialIssuer>\n\nexport default (testContext: {\n  getAgent: () => ConfiguredAgent\n  setup: (agentOptions: IAgentOptions) => Promise<boolean>\n  tearDown: () => Promise<boolean>\n}) => {\n  describe('DID discovery', () => {\n    let agent: ConfiguredAgent\n\n    beforeAll(async () => {\n      await testContext.setup({ context: { dbName: 'did-discovery-test' } })\n      agent = testContext.getAgent()\n      return true\n    })\n    afterAll(testContext.tearDown)\n\n    it('should discover did by alias', async () => {\n      const identifier = await agent.didManagerGetOrCreate({\n        alias: 'alice',\n      })\n\n      const result = await agent.discoverDid({ query: 'alice' })\n\n      expect(result.results[0].matches[0]).toEqual({\n        did: identifier.did,\n        metaData: {\n          alias: 'alice',\n        },\n      })\n    })\n\n    it('should discover did by profile vc', async () => {\n      const identifier = await agent.didManagerCreate({})\n\n      const verifiableCredential = await agent.createVerifiableCredential({\n        credential: {\n          issuer: { id: identifier.did },\n          '@context': ['https://www.w3.org/2018/credentials/v1'],\n          type: ['VerifiableCredential', 'Profile'],\n          issuanceDate: new Date().toISOString(),\n          credentialSubject: {\n            id: identifier.did,\n            name: 'bobby',\n          },\n        },\n        proofFormat: 'jwt',\n        save: true,\n      })\n\n      const result = await agent.discoverDid({ query: 'bobby' })\n\n      expect(result.results[0].matches[0]).toEqual({\n        did: identifier.did,\n        metaData: { verifiableCredential },\n      })\n    })\n\n    it('should discover did by alias and profile vc', async () => {\n      const identifier = await agent.didManagerGetOrCreate({\n        alias: 'bob',\n      })\n\n      const verifiableCredential = await agent.createVerifiableCredential({\n        credential: {\n          issuer: { id: identifier.did },\n          '@context': ['https://www.w3.org/2018/credentials/v1'],\n          type: ['VerifiableCredential', 'Profile'],\n          issuanceDate: new Date().toISOString(),\n          credentialSubject: {\n            id: identifier.did,\n            name: 'bobby',\n          },\n        },\n        proofFormat: 'jwt',\n        save: true,\n      })\n\n      const result = await agent.discoverDid({ query: 'bob' })\n      expect(result.results).toHaveLength(2)\n      expect(result.results[0].matches).toHaveLength(1)\n      expect(result.results[1].matches).toHaveLength(3)\n\n      expect(result.results[0].matches[0]).toEqual({\n        did: identifier.did,\n        metaData: {\n          alias: 'bob',\n        },\n      })\n\n      expect(result.results[1].matches[1]).toEqual({\n        did: identifier.did,\n        metaData: { verifiableCredential },\n      })\n\n      expect(result.results[1].matches[2]).toEqual({\n        did: identifier.did,\n        metaData: {\n          alias: 'bob',\n        },\n      })\n\n      const byDIDFragmentResult = await agent.discoverDid({\n        query: identifier.did.substring(3, identifier.did.length - 3),\n      })\n      expect(byDIDFragmentResult.results).toHaveLength(1)\n      expect(byDIDFragmentResult.results[0].matches).toHaveLength(2)\n\n      expect(byDIDFragmentResult.results[0].matches[1]).toEqual({\n        did: identifier.did,\n        metaData: {\n          alias: 'bob',\n        },\n      })\n    })\n\n    it('should return errors', async () => {\n      const result = await agent.discoverDid({ query: 'broken' })\n      expect(result!.errors!['broken-discovery']).toMatch(/test_error/)\n    })\n  })\n}\n"
  },
  {
    "path": "__tests__/shared/didManager.ts",
    "content": "// noinspection ES6PreferShortImport\n\nimport { IDIDManager, IIdentifier, IKeyManager, ManagedKeyInfo, TAgent } from '../../packages/core-types/src'\n\ntype ConfiguredAgent = TAgent<IDIDManager & IKeyManager>\n\nexport default (testContext: {\n  getAgent: () => ConfiguredAgent\n  setup: () => Promise<boolean>\n  tearDown: () => Promise<boolean>\n}) => {\n  describe('DID manager', () => {\n    let agent: ConfiguredAgent\n\n    beforeAll(async () => {\n      await testContext.setup()\n      agent = testContext.getAgent()\n      return true\n    })\n    afterAll(testContext.tearDown)\n\n    let identifier: IIdentifier\n    let localKey: ManagedKeyInfo\n    it('should create identifier', async () => {\n      identifier = await agent.didManagerCreate({\n        provider: 'did:web',\n        alias: 'example.com',\n      })\n      expect(identifier.provider).toEqual('did:web')\n      expect(identifier.alias).toEqual('example.com')\n      expect(identifier.did).toEqual('did:web:example.com')\n      expect(identifier.keys.length).toEqual(1)\n      expect(identifier.services.length).toEqual(0)\n      expect(identifier.controllerKeyId).toEqual(identifier.keys[0].kid)\n    })\n\n    it('should create pkh identifier using did:pkh provider', async () => {\n      identifier = await agent.didManagerCreate({\n        // this expects the `did:ethr` provider to matchPrefix and use the `arbitrum:goerli` network specifier\n        provider: 'did:pkh',\n        options: { chainId: '1' },\n      })\n      expect(identifier.provider).toEqual('did:pkh')\n      //expect(identifier.did).toMatch(/^did:pkh:eip155:*$/)\n      expect(identifier.keys.length).toEqual(1)\n      expect(identifier.services.length).toEqual(0)\n      expect(identifier.controllerKeyId).toEqual(identifier.keys[0].kid)\n    })\n\n    it('should create identifier using did:jwk', async () => {\n      // keyType supports 'Secp256k1', 'Secp256r1', 'Ed25519', 'X25519'\n      const keyType = 'Ed25519'\n      identifier = await agent.didManagerCreate({\n        provider: 'did:jwk',\n        options: {\n          keyType,\n        },\n      })\n      expect(identifier.provider).toEqual('did:jwk')\n      expect(identifier.keys[0].type).toEqual(keyType)\n      expect(identifier.controllerKeyId).toEqual(identifier.keys[0].kid)\n    })\n    it('should create identifier using did:jwk with an imported key', async () => {\n      // keyType supports 'Secp256k1', 'Secp256r1', 'Ed25519', 'X25519'\n      const keyType = 'Ed25519'\n      identifier = await agent.didManagerCreate({\n        provider: 'did:jwk',\n        options: {\n          keyType,\n          privateKeyHex:\n            'f3157fbbb356a0d56a84a1a9752f81d0638cce4153168bd1b46f68a6e62b82b0f3157fbbb356a0d56a84a1a9752f81d0638cce4153168bd1b46f68a6e62b82b0',\n        },\n      })\n      expect(identifier.provider).toEqual('did:jwk')\n      expect(identifier.keys[0].type).toEqual(keyType)\n      expect(identifier.controllerKeyId).toEqual(identifier.keys[0].kid)\n    })\n    it('should create identifier using did:jwk with a default imported key', async () => {\n      // keyType supports 'Secp256k1', 'Secp256r1', 'Ed25519', 'X25519'\n      const keyType = 'Secp256k1'\n      identifier = await agent.didManagerCreate({\n        provider: 'did:jwk',\n        options: {\n          privateKeyHex: 'f3157fbbb356a0d56a84a1a9752f81d0638cce4153168bd1b46f68a6e62b82b0',\n        },\n      })\n      expect(identifier.provider).toEqual('did:jwk')\n      expect(identifier.keys[0].type).toEqual(keyType)\n      expect(identifier.controllerKeyId).toEqual(identifier.keys[0].kid)\n    })\n    it('should throw error for invalid privateKEyHex', async () => {\n      await expect(\n        agent.didManagerCreate({\n          provider: 'did:jwk',\n          options: {\n            privateKeyHex: '1234',\n          },\n        }),\n      ).rejects.toThrow()\n      expect(identifier.provider).toEqual('did:jwk')\n    })\n    it('should throw error for invalid keyUse parameter', async () => {\n      await expect(\n        agent.didManagerCreate({\n          provider: 'did:jwk',\n          options: {\n            keyType: 'Secp256k1',\n            keyUse: 'signing',\n          },\n        }),\n      ).rejects.toThrow('illegal_argument: Key use must be sig or enc')\n      expect(identifier.provider).toEqual('did:jwk')\n    })\n    it('should throw error for invalid Ed25519 key use', async () => {\n      await expect(\n        agent.didManagerCreate({\n          provider: 'did:jwk',\n          alias: 'test1',\n          options: {\n            keyType: 'Ed25519',\n            keyUse: 'enc',\n          },\n        }),\n      ).rejects.toThrow('illegal_argument: Ed25519 keys cannot be used for encryption')\n      expect(identifier.provider).toEqual('did:jwk')\n    })\n\n    it('should create identifier using did:key with an imported key', async () => {\n      // keyType supports 'Secp256k1', 'Ed25519', 'X25519'\n      const keyType = 'Secp256k1'\n      identifier = await agent.didManagerCreate({\n        provider: 'did:key',\n        alias: 'keyTest',\n        options: {\n          keyType,\n          privateKeyHex: 'f3157fbbb356a0d56a84a1a9752f81d0638cce4153168bd1b46f68a6e62b82b1',\n        },\n      })\n      expect(identifier.provider).toEqual('did:key')\n      expect(identifier.keys[0].type).toEqual(keyType)\n      expect(identifier.controllerKeyId).toEqual(identifier.keys[0].kid)\n    })\n\n    it('should throw error for existing alias provider combo', async () => {\n      await expect(\n        agent.didManagerCreate({\n          provider: 'did:web',\n          alias: 'example.com',\n        }),\n      ).rejects.toThrow(/Identifier with alias: example.com already exists/)\n    })\n\n    it('should get identifier', async () => {\n      const identifier2 = await agent.didManagerGet({\n        did: identifier.did,\n      })\n      expect(identifier2.did).toEqual(identifier.did)\n    })\n\n    it('should throw error for non existing did', async () => {\n      await expect(\n        agent.didManagerGet({\n          did: 'did:web:foobar',\n        }),\n      ).rejects.toThrow('Identifier not found')\n    })\n\n    it('should get or create identifier', async () => {\n      const identifier3 = await agent.didManagerGetOrCreate({\n        alias: 'aliceDID11',\n        provider: 'did:ethr:ganache',\n      })\n\n      const identifier4 = await agent.didManagerGetOrCreate({\n        alias: 'aliceDID11',\n      })\n\n      expect(identifier3).toEqual(identifier4)\n\n      const identifierKey1 = await agent.didManagerGetOrCreate({\n        alias: 'caroline',\n        provider: 'did:key',\n      })\n\n      const identifierKey2 = await agent.didManagerGetOrCreate({\n        alias: 'caroline',\n      })\n\n      expect(identifierKey1).toEqual(identifierKey2)\n\n      const identifier5 = await agent.didManagerGetOrCreate({\n        alias: 'aliceDID11',\n        provider: 'did:ethr',\n      })\n\n      expect(identifier5).toEqual(identifier4)\n\n      const identifier6 = await agent.didManagerGetByAlias({\n        alias: 'aliceDID11',\n        provider: 'did:ethr',\n      })\n\n      expect(identifier6).toEqual(identifier5)\n    })\n\n    it('should get identifiers', async () => {\n      const allIdentifiers = await agent.didManagerFind()\n      expect(allIdentifiers.length).toBeGreaterThanOrEqual(5)\n\n      const aliceIdentifiers = await agent.didManagerFind({\n        alias: 'aliceDID11',\n      })\n      expect(aliceIdentifiers.length).toEqual(1)\n\n      const ethrIdentifiers = await agent.didManagerFind({\n        provider: 'did:ethr:ganache',\n      })\n      expect(ethrIdentifiers.length).toBeGreaterThanOrEqual(1)\n\n      await agent.didManagerCreate({ provider: 'did:ethr:ganache' })\n\n      const ethrIdentifiers2 = await agent.didManagerFind({\n        provider: 'did:ethr:ganache',\n      })\n      expect(ethrIdentifiers2.length).toEqual(ethrIdentifiers.length + 1)\n    })\n\n    it('should delete identifier', async () => {\n      const allIdentifiers = await agent.didManagerFind()\n      const count = allIdentifiers.length\n\n      const result = await agent.didManagerDelete({\n        did: allIdentifiers[0].did,\n      })\n\n      expect(result).toEqual(true)\n\n      const allIdentifiers2 = await agent.didManagerFind()\n      expect(allIdentifiers2.length).toEqual(count - 1)\n\n      await expect(\n        agent.didManagerGet({\n          did: allIdentifiers[0].did,\n        }),\n      ).rejects.toThrow('Identifier not found')\n    })\n\n    it('should add service to identifier', async () => {\n      const webIdentifier = await agent.didManagerGetOrCreate({\n        alias: 'foobar.com',\n        provider: 'did:web',\n      })\n\n      expect(webIdentifier.services.length).toEqual(0)\n\n      const result = await agent.didManagerAddService({\n        did: webIdentifier.did,\n        service: {\n          id: 'did:web:foobar.com#msg',\n          type: 'Messaging',\n          serviceEndpoint: 'https://foobar.com/messaging',\n          description: 'Handles incoming messages',\n        },\n      })\n      expect(result).toEqual({ success: true })\n\n      const webIdentifier2 = await agent.didManagerGetOrCreate({\n        alias: 'foobar.com',\n        provider: 'did:web',\n      })\n\n      expect(webIdentifier2.services.length).toEqual(1)\n      expect(webIdentifier2.services[0]).toEqual({\n        id: 'did:web:foobar.com#msg',\n        type: 'Messaging',\n        serviceEndpoint: 'https://foobar.com/messaging',\n        description: 'Handles incoming messages',\n      })\n    })\n\n    it('should remove service from identifier', async () => {\n      const result = await agent.didManagerRemoveService({\n        did: 'did:web:foobar.com',\n        id: 'did:web:foobar.com#msg',\n      })\n\n      expect(result).toEqual({ success: true })\n\n      const webIdentifier = await agent.didManagerGetOrCreate({\n        alias: 'foobar.com',\n        provider: 'did:web',\n      })\n\n      expect(webIdentifier.services.length).toEqual(0)\n    })\n\n    it('should add key to identifier', async () => {\n      const webIdentifier = await agent.didManagerGetOrCreate({\n        alias: 'foobar.com',\n        provider: 'did:web',\n      })\n\n      expect(webIdentifier.keys.length).toEqual(1)\n\n      const newKey = await agent.keyManagerCreate({\n        kms: 'local',\n        type: 'Secp256k1',\n      })\n\n      const result = await agent.didManagerAddKey({\n        did: webIdentifier.did,\n        key: newKey,\n      })\n\n      expect(result).toEqual({ success: true })\n\n      const webIdentifier2 = await agent.didManagerGetOrCreate({\n        alias: 'foobar.com',\n        provider: 'did:web',\n      })\n\n      expect(webIdentifier2.keys.length).toEqual(2)\n    })\n\n    it('should remove key from identifier', async () => {\n      const webIdentifier = await agent.didManagerGet({\n        did: 'did:web:foobar.com',\n      })\n\n      expect(webIdentifier.keys.length).toEqual(2)\n\n      const result = await agent.didManagerRemoveKey({\n        did: 'did:web:foobar.com',\n        kid: webIdentifier.keys[1].kid,\n      })\n\n      expect(result).toEqual({ success: true })\n\n      const webIdentifier2 = await agent.didManagerGet({\n        did: 'did:web:foobar.com',\n      })\n\n      expect(webIdentifier2.keys.length).toEqual(1)\n      expect(webIdentifier2.keys[0].kid).toEqual(webIdentifier.keys[0].kid)\n    })\n\n    it('should import identifier', async () => {\n      expect.assertions(1)\n      const did = 'did:web:imported.example'\n      const imported = await agent.didManagerImport({\n        did,\n        provider: 'did:web',\n        services: [\n          {\n            id: `${did}#msg`,\n            type: 'Messaging',\n            serviceEndpoint: 'https://example.org/messaging',\n            description: 'Handles incoming messages',\n          },\n        ],\n        keys: [\n          {\n            kms: 'local',\n            privateKeyHex: 'e63886b5ba367dc2aff9acea6d955ee7c39115f12eaf2aa6b1a2eaa852036668',\n            type: 'Secp256k1',\n          },\n        ],\n      })\n      expect(imported).toEqual({\n        did,\n        keys: [\n          {\n            kid: '04dd467afb12bdb797303e7f3f0c8cd0ba80d518dc4e339e0e2eb8f2d99a9415cac537854a30d31a854b7af0b4fcb54c3954047390fa9500d3cc2e15a3e09017bb',\n            kms: 'local',\n            meta: {\n              algorithms: [\n                'ES256K',\n                'ES256K-R',\n                'eth_signTransaction',\n                'eth_signTypedData',\n                'eth_signMessage',\n                'eth_rawSign',\n              ],\n            },\n            publicKeyHex:\n              '04dd467afb12bdb797303e7f3f0c8cd0ba80d518dc4e339e0e2eb8f2d99a9415cac537854a30d31a854b7af0b4fcb54c3954047390fa9500d3cc2e15a3e09017bb',\n            type: 'Secp256k1',\n          },\n        ],\n        provider: 'did:web',\n        services: [\n          {\n            description: 'Handles incoming messages',\n            id: `${did}#msg`,\n            serviceEndpoint: 'https://example.org/messaging',\n            type: 'Messaging',\n          },\n        ],\n      })\n    })\n\n    it('should set alias for identifier', async () => {\n      const identifier = await agent.didManagerCreate()\n      const result = await agent.didManagerSetAlias({\n        did: identifier.did,\n        alias: 'dave',\n      })\n      expect(result).toEqual(true)\n\n      const identifier2 = await agent.didManagerGetByAlias({\n        alias: 'dave',\n      })\n\n      expect(identifier2).toEqual({ ...identifier, alias: 'dave' })\n    })\n\n    it('should refuse to getOrCreate identifier with existing alias but different provider', async () => {\n      expect.assertions(1)\n      await agent.didManagerGetOrCreate({ alias: 'I am the same', provider: 'did:ethr' })\n      await expect(\n        agent.didManagerGetOrCreate({\n          alias: 'I am the same',\n          provider: 'did:key',\n        }),\n      ).rejects.toThrow(\n        /illegal_argument: Identifier with alias:.*already exists.*but was created with a different provider.*/,\n      )\n    })\n\n    it('should add key only in DIDStore', async () => {\n      const webIdentifier = await agent.didManagerGetOrCreate({\n        alias: 'did.example.com',\n        provider: 'did:web',\n      })\n\n      localKey = await agent.keyManagerCreate({\n        kms: 'local',\n        type: 'Secp256k1',\n      })\n\n      const result = await agent.didManagerAddKey({\n        did: webIdentifier.did,\n        key: localKey,\n        options: { localOnly: true },\n      })\n\n      expect(result).toEqual(true)\n\n      const updatedIdentifier = await agent.didManagerGet({ did: webIdentifier.did })\n      expect(updatedIdentifier.keys.some((key: any) => key.kid === localKey.kid)).toBe(true)\n    })\n\n    it('should remove key from DIDStore', async () => {\n      const webIdentifier = await agent.didManagerGet({\n        did: 'did:web:did.example.com',\n      })\n\n      const result = await agent.didManagerRemoveKey({\n        did: webIdentifier.did,\n        kid: localKey.kid,\n        options: { localOnly: true },\n      })\n\n      expect(result).toEqual(true)\n\n      const updatedIdentifier = await agent.didManagerGet({ did: webIdentifier.did })\n      expect(updatedIdentifier.keys.some((key: any) => key.kid === localKey.kid)).toBe(false)\n    })\n\n    it('should add service only in DIDStore', async () => {\n      const webIdentifier = await agent.didManagerGet({\n        did: 'did:web:did.example.com',\n      })\n\n      const mockService = {\n        id: 'did.example.com#didcomm_service',\n        type: 'Messaging',\n        serviceEndpoint: 'https://did.example.com/messaging',\n        description: 'Handles incoming messages',\n      }\n\n      const result = await agent.didManagerAddService({\n        did: webIdentifier.did,\n        service: mockService,\n        options: { localOnly: true },\n      })\n\n      expect(result).toEqual(true)\n\n      const updatedIdentifier = await agent.didManagerGet({ did: webIdentifier.did })\n      expect(updatedIdentifier.services.some((service: any) => service.id === mockService.id)).toBe(true)\n    })\n\n    it('should remove service from identifier with localOnly=true', async () => {\n      const webIdentifier = await agent.didManagerGet({\n        did: 'did:web:did.example.com',\n      })\n      const mockService = {\n        id: 'did.example.com#didcomm_service',\n      }\n\n      const result = await agent.didManagerRemoveService({\n        did: webIdentifier.did,\n        id: mockService.id,\n        options: { localOnly: true },\n      })\n\n      expect(result).toEqual(true)\n\n      const updatedIdentifier = await agent.didManagerGet({ did: webIdentifier.did })\n      expect(updatedIdentifier.services.some((service: any) => service.id === mockService.id)).toBe(false)\n    })\n  })\n}\n"
  },
  {
    "path": "__tests__/shared/documentationExamples.ts",
    "content": "// noinspection ES6PreferShortImport\n\n/**\n * This test suite runs the examples from the documentation in various test contexts.\n *\n * Documentation examples are extracted from the tsdoc of the relevant source code.\n * To document a new package, add it to docsconfig.json array and have it processed with `extract-api` or\n * `generate-plugin-schema`.\n */\n\nimport {\n  ICredentialIssuer,\n  IDataStore,\n  IDataStoreORM,\n  IDIDManager,\n  IMessageHandler,\n  TAgent,\n} from '../../packages/core-types/src'\nimport { ISelectiveDisclosure } from '../../packages/selective-disclosure/src'\n\ntype ConfiguredAgent = TAgent<\n  IDIDManager & ICredentialIssuer & IDataStoreORM & IDataStore & IMessageHandler & ISelectiveDisclosure\n>\n\nexport default (testContext: {\n  getAgent: () => ConfiguredAgent\n  setup: () => Promise<boolean>\n  tearDown: () => Promise<boolean>\n}) => {\n  describe('Documentation examples', () => {\n    let agent: ConfiguredAgent\n\n    beforeAll(async () => {\n      await testContext.setup()\n      agent = testContext.getAgent()\n    })\n    afterAll(testContext.tearDown)\n\n    //DO NOT EDIT MANUALLY START\n\n    it('core-types-IResolver-getDIDComponentById example', async () => {\n      const did = 'did:ethr:ganache:0xb09b66026ba5909a7cfe99b76875431d2b8d5190'\n      const didFragment = `${did}#controller`\n      const fragment = await agent.getDIDComponentById({\n        didDocument: (await agent.resolveDid({ didUrl: did }))?.didDocument,\n        didUrl: didFragment,\n        section: 'authentication',\n      })\n      expect(fragment).toEqual({\n        id: 'did:ethr:ganache:0xb09b66026ba5909a7cfe99b76875431d2b8d5190#controller',\n        type: 'EcdsaSecp256k1RecoveryMethod2020',\n        controller: 'did:ethr:ganache:0xb09b66026ba5909a7cfe99b76875431d2b8d5190',\n        blockchainAccountId: 'eip155:1337:0xb09B66026bA5909A7CFE99b76875431D2b8D5190',\n      })\n    })\n\n    it('core-types-IResolver-resolveDid example', async () => {\n      const doc = await agent.resolveDid({\n        didUrl: 'did:ethr:ganache:0xb09b66026ba5909a7cfe99b76875431d2b8d5190',\n      })\n      expect(doc.didDocument).toEqual({\n        '@context': expect.anything(),\n        id: 'did:ethr:ganache:0xb09b66026ba5909a7cfe99b76875431d2b8d5190',\n        verificationMethod: [\n          {\n            id: 'did:ethr:ganache:0xb09b66026ba5909a7cfe99b76875431d2b8d5190#controller',\n            type: 'EcdsaSecp256k1RecoveryMethod2020',\n            controller: 'did:ethr:ganache:0xb09b66026ba5909a7cfe99b76875431d2b8d5190',\n            blockchainAccountId: 'eip155:1337:0xb09B66026bA5909A7CFE99b76875431D2b8D5190',\n          },\n        ],\n        authentication: ['did:ethr:ganache:0xb09b66026ba5909a7cfe99b76875431d2b8d5190#controller'],\n        assertionMethod: ['did:ethr:ganache:0xb09b66026ba5909a7cfe99b76875431d2b8d5190#controller'],\n      })\n    })\n\n    it('core-types-IDIDManager-didManagerCreate example', async () => {\n      const identifier = await agent.didManagerCreate({\n        alias: 'charlie',\n        provider: 'did:ethr',\n        kms: 'local',\n      })\n    })\n\n    it('core-types-IDIDManager-didManagerFind example', async () => {\n      const aliceIdentifiers = await agent.didManagerFind({\n        alias: 'alice',\n      })\n\n      const sepoliaIdentifiers = await agent.didManagerFind({\n        provider: 'did:ethr',\n      })\n    })\n\n    it('core-types-IDIDManager-didManagerGetByAlias example', async () => {\n      const identifier = await agent.didManagerGetByAlias({\n        alias: 'charlie',\n        provider: 'did:ethr',\n      })\n    })\n\n    it('core-types-IDIDManager-didManagerSetAlias example', async () => {\n      const identifier = await agent.didManagerCreate()\n      const result = await agent.didManagerSetAlias({\n        did: identifier.did,\n        alias: 'carol',\n      })\n    })\n\n    it('did-comm-IDIDComm-getDIDCommMessageMediaType example', async () => {\n      undefined\n    })\n\n    //DO NOT EDIT MANUALLY END\n  })\n}\n"
  },
  {
    "path": "__tests__/shared/ethrDidFlowSigned.ts",
    "content": "// noinspection ES6PreferShortImport\n\nimport {\n  IAgentOptions,\n  IDIDManager,\n  IIdentifier,\n  IKeyManager,\n  IMessageHandler,\n  IResolver,\n  TAgent,\n} from '../../packages/core-types/src'\nimport {IDIDComm} from '../../packages/did-comm/src'\n// @ts-ignore\nimport express from 'express'\nimport {Server} from 'http'\n\ntype ConfiguredAgent = TAgent<IDIDManager & IKeyManager & IResolver & IDIDComm & IMessageHandler>\n\nexport async function sleep(milliseconds: number): Promise<void> {\n  return new Promise((resolve) => setTimeout(resolve, milliseconds))\n}\n\nexport default (testContext: {\n  getAgent: () => ConfiguredAgent\n  setup: (options?: IAgentOptions) => Promise<boolean>\n  tearDown: () => Promise<boolean>\n}) => {\n  describe('did ethr controller signed interactions', () => {\n    let agent: ConfiguredAgent\n\n    let alice: IIdentifier\n    let bob: IIdentifier\n\n    let didCommEndpointServer: Server\n    let listeningPort = Math.round(Math.random() * 32000 + 2048)\n\n    beforeEach(async () => {\n      await testContext.setup()\n      agent = testContext.getAgent()\n\n      alice = await agent.didManagerImport({\n        controllerKeyId: 'alice-controller-key',\n        did: 'did:ethr:ganache:0x0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798',\n        provider: 'did:ethr:ganache',\n        alias: 'alice-did-ethr',\n        keys: [\n          {\n            privateKeyHex: '0000000000000000000000000000000000000000000000000000000000000001',\n            kms: 'local',\n            type: 'Secp256k1',\n            kid: 'alice-controller-key',\n          },\n        ],\n      })\n\n      bob = await agent.didManagerImport({\n        controllerKeyId: 'bob-controller-key',\n        did: 'did:ethr:ganache:0x02c6047f9441ed7d6d3045406e95c07cd85c778e4b8cef3ca7abac09b95c709ee5',\n        provider: 'did:ethr:ganache',\n        alias: 'bob-did-ethr',\n        keys: [\n          {\n            privateKeyHex: '0000000000000000000000000000000000000000000000000000000000000002',\n            kms: 'local',\n            type: 'Secp256k1',\n            kid: 'bob-controller-key',\n          },\n        ],\n      })\n    })\n\n    afterAll(async () => {\n      await testContext.tearDown()\n    })\n\n    it('should add dummy service to alice did with bob sending the tx', async () => {\n      const result = await agent.didManagerAddService({\n        did: alice.did,\n        service: {\n          id: 'localhost-useless-endpoint',\n          type: 'DIDComm',\n          serviceEndpoint: `http://localhost:${listeningPort}/foobar`,\n          description: 'this endpoint will be removed',\n        }, options: {\n          metaIdentifierKeyId: bob.controllerKeyId\n        }\n      })\n\n      const resolution = await agent.resolveDid({ didUrl: alice.did })\n\n      expect(resolution.didDocument).toEqual(expect.objectContaining({\n        service: expect.arrayContaining([\n          expect.objectContaining({\n            serviceEndpoint: `http://localhost:${listeningPort}/foobar`\n          })\n        ])\n      }))\n    })\n\n    it('should remove dummy service to alice did with bob sending the tx', async () => {\n      await agent.didManagerAddService({\n        did: alice.did,\n        service: {\n          id: 'localhost-useless-endpoint',\n          type: 'DIDComm',\n          serviceEndpoint: `http://localhost:${listeningPort}/foobar`,\n          description: 'this endpoint will be removed',\n        }, options: {\n          metaIdentifierKeyId: bob.controllerKeyId\n        }\n      })\n\n      await agent.didManagerRemoveService({\n        did: alice.did,\n        id: \"localhost-useless-endpoint\",\n        options: {\n          metaIdentifierKeyId: bob.controllerKeyId\n        }\n      })\n\n      const resolution = await agent.resolveDid({ didUrl: alice.did })\n      expect(resolution?.didDocument?.service?.[0].serviceEndpoint).toBeFalsy()\n    })\n\n    it('should add verification key to alice did with bob sending the tx', async () => {\n      const keyToAdd = await agent.keyManagerCreate({type: 'Secp256k1', kms: 'local'})\n\n      await agent.didManagerAddKey({\n        did: alice.did,\n        key: keyToAdd,\n        options: {\n          metaIdentifierKeyId: bob.controllerKeyId\n        }\n      })\n\n      // Give ganache some time to emit the event from the contract\n      await sleep(1000)\n\n      const didAfterchange = await agent.resolveDid({ didUrl: alice.did })\n      expect(didAfterchange).toBeTruthy()\n      expect(didAfterchange.didDocument).toEqual(expect.objectContaining({\n        verificationMethod: expect.arrayContaining([\n          expect.objectContaining({\n            publicKeyHex: keyToAdd.publicKeyHex\n          })\n        ])\n      }))\n    })\n  })\n}\n"
  },
  {
    "path": "__tests__/shared/handleSdrMessage.ts",
    "content": "// noinspection ES6PreferShortImport\n\nimport {\n  ICredentialPlugin,\n  IDataStore,\n  IDataStoreORM,\n  IDIDManager,\n  IIdentifier,\n  IMessageHandler,\n  TAgent,\n} from '../../packages/core-types/src'\nimport { ISelectiveDisclosure, SelectiveDisclosure } from '../../packages/selective-disclosure/src'\n\ntype ConfiguredAgent = TAgent<\n  IDIDManager & ICredentialPlugin & IDataStoreORM & IDataStore & IMessageHandler & ISelectiveDisclosure\n>\n\nexport default (testContext: {\n  getAgent: () => ConfiguredAgent\n  setup: () => Promise<boolean>\n  tearDown: () => Promise<boolean>\n}) => {\n  describe('handling sdr message', () => {\n    let agent: ConfiguredAgent\n    let identifier: IIdentifier\n    let JWT: string\n    let originalRequestSender: string\n    let sdr: SelectiveDisclosure\n\n    beforeAll(async () => {\n      await testContext.setup()\n      agent = testContext.getAgent()\n    })\n    afterAll(testContext.tearDown)\n\n    it('should create identifier', async () => {\n      identifier = await agent.didManagerCreate({ kms: 'local', provider: 'did:key' })\n      expect(identifier).toHaveProperty('did')\n    })\n\n    it('should create verifiable credential', async () => {\n      const verifiableCredential = await agent.createVerifiableCredential({\n        credential: {\n          issuer: { id: identifier.did },\n          '@context': ['https://www.w3.org/2018/credentials/v1'],\n          type: ['VerifiableCredential'],\n          issuanceDate: new Date().toISOString(),\n          credentialSubject: {\n            id: 'did:web:uport.me',\n            you: 'Rock',\n          },\n        },\n        proofFormat: 'jwt',\n      })\n\n      expect(verifiableCredential).toHaveProperty('proof.jwt')\n    })\n\n    it('should save an SDR message', async () => {\n      JWT = await agent.createSelectiveDisclosureRequest({\n        data: {\n          issuer: identifier.did,\n          tag: 'sdr-one',\n          claims: [\n            {\n              reason: 'We need it',\n              claimType: 'name',\n              essential: true,\n            },\n          ],\n        },\n      })\n\n      const message = await agent.handleMessage({\n        raw: JWT,\n        save: true,\n      })\n      if (message.from) {\n        originalRequestSender = message.from\n      }\n\n      expect(message.raw).toEqual(JWT)\n    })\n\n    it('should create and handle an SDR message with Ed25519', async () => {\n      const sdrIssuer = await agent.didManagerCreate({ provider: 'did:key', options: { keyType: 'Ed25519' } })\n      const req = await agent.createSelectiveDisclosureRequest({\n        data: {\n          issuer: sdrIssuer.did,\n          tag: 'sdr-one',\n          claims: [\n            {\n              reason: 'We need it',\n              claimType: 'name',\n              essential: true,\n            },\n          ],\n        },\n      })\n\n      const message = await agent.handleMessage({\n        raw: req,\n        save: false,\n      })\n\n      expect(message.raw).toEqual(req)\n    })\n\n    it('should create and handle an SDR message with Secp256k1', async () => {\n      const sdrIssuer = await agent.didManagerCreate({\n        provider: 'did:ethr:ganache',\n      })\n      const req = await agent.createSelectiveDisclosureRequest({\n        data: {\n          issuer: sdrIssuer.did,\n          tag: 'sdr-one',\n          claims: [\n            {\n              reason: 'We need it',\n              claimType: 'name',\n              essential: true,\n            },\n          ],\n        },\n      })\n\n      const message = await agent.handleMessage({\n        raw: req,\n        save: false,\n      })\n\n      expect(message.raw).toEqual(req)\n    })\n\n    it('should create and handle an SDR message with Secp256r1', async () => {\n      const sdrIssuer = await agent.didManagerCreate({\n        provider: 'did:jwk',\n        options: {\n          keyType: 'Secp256r1',\n        },\n      })\n      const req = await agent.createSelectiveDisclosureRequest({\n        data: {\n          issuer: sdrIssuer.did,\n          tag: 'sdr-one',\n          claims: [\n            {\n              reason: 'We need it',\n              claimType: 'name',\n              essential: true,\n            },\n          ],\n        },\n      })\n\n      const message = await agent.handleMessage({\n        raw: req,\n        save: false,\n      })\n\n      expect(message.raw).toEqual(req)\n    })\n\n    it('should be able to find the request message', async () => {\n      const messages = await agent.dataStoreORMGetMessages()\n\n      expect(messages[0].raw).toEqual(JWT)\n      expect(messages[0].type).toEqual('sdr')\n    })\n\n    it('should be able to sign a credential after saving a message', async () => {\n      const identifiers = await agent.didManagerFind()\n      const identifier = identifiers[0]\n\n      expect(identifiers[0].did).toBeDefined()\n\n      const verifiableCredential = await agent.createVerifiableCredential({\n        credential: {\n          issuer: { id: identifier.did },\n          '@context': ['https://www.w3.org/2018/credentials/v1'],\n          type: ['VerifiableCredential'],\n          issuanceDate: new Date().toISOString(),\n          credentialSubject: {\n            id: 'did:web:uport.me',\n            name: 'Carrot',\n          },\n        },\n        proofFormat: 'jwt',\n        save: true,\n      })\n\n      expect(verifiableCredential.proof.jwt).toBeDefined()\n    })\n\n    it('should accept empty issuers array', async () => {\n      const credentials = await agent.getVerifiableCredentialsForSdr({\n        sdr: {\n          claims: [\n            {\n              claimType: 'name',\n              issuers: [],\n            },\n          ],\n        },\n      })\n\n      expect(credentials[0].credentials[0]).toHaveProperty('hash')\n      expect(credentials[0].credentials[0]).toHaveProperty('verifiableCredential.proof')\n    })\n\n    it('should create verifiable presentation', async () => {\n      const credentials = await agent.getVerifiableCredentialsForSdr({\n        sdr: {\n          claims: [\n            {\n              claimType: 'name',\n            },\n          ],\n        },\n      })\n\n      const verifiablePresentation = await agent.createVerifiablePresentation({\n        presentation: {\n          verifier: [originalRequestSender],\n          holder: identifier.did,\n          '@context': ['https://www.w3.org/2018/credentials/v1'],\n          type: ['VerifiablePresentation'],\n          issuanceDate: new Date().toISOString(),\n          verifiableCredential: credentials[0].credentials.map((c) => c.verifiableCredential),\n        },\n        proofFormat: 'jwt',\n        save: true,\n      })\n\n      expect(verifiablePresentation).toHaveProperty('proof.jwt')\n\n      const validated = await agent.validatePresentationAgainstSdr({\n        presentation: verifiablePresentation,\n        sdr: {\n          issuer: '',\n          claims: [\n            {\n              claimType: 'name',\n            },\n          ],\n        },\n      })\n      expect(validated.valid).toEqual(true)\n    })\n  })\n}\n"
  },
  {
    "path": "__tests__/shared/keyManager.ts",
    "content": "// noinspection ES6PreferShortImport\n\nimport {\n  IAgentOptions,\n  IDIDManager,\n  IKeyManager,\n  IResolver,\n  TAgent,\n  TKeyType,\n} from '../../packages/core-types/src'\nimport { mapIdentifierKeysToDoc } from '../../packages/utils/src'\nimport { recoverTypedSignature, SignTypedDataVersion } from '@metamask/eth-sig-util'\nimport {computeAddress, Transaction} from \"ethers\";\n\ntype ConfiguredAgent = TAgent<IDIDManager & IKeyManager & IResolver>\n\nexport default (testContext: {\n  getAgent: () => ConfiguredAgent\n  setup: (options?: IAgentOptions) => Promise<boolean>\n  tearDown: () => Promise<boolean>\n}) => {\n  describe('key manager', () => {\n    let agent: ConfiguredAgent\n\n    beforeAll(async () => {\n      await testContext.setup()\n      agent = testContext.getAgent()\n      return true\n    })\n    afterAll(testContext.tearDown)\n\n    it('should get a list of available key management systems', async () => {\n      const keyManagementSystems = await agent.keyManagerGetKeyManagementSystems()\n      expect(keyManagementSystems).toEqual(['local', 'web3'])\n    })\n\n    it('should create Secp256k1 key', async () => {\n      const key = await agent.keyManagerCreate({\n        kms: 'local',\n        type: 'Secp256k1',\n      })\n\n      expect(key).toHaveProperty('kid')\n      expect(key).toHaveProperty('publicKeyHex')\n      expect(key).not.toHaveProperty('privateKeyHex')\n      expect(key.kms).toEqual('local')\n      expect(key.type).toEqual('Secp256k1')\n    })\n\n    it('should create Ed25519 key', async () => {\n      const key = await agent.keyManagerCreate({\n        kms: 'local',\n        type: 'Ed25519',\n      })\n\n      expect(key).toHaveProperty('kid')\n      expect(key).toHaveProperty('publicKeyHex')\n      expect(key).not.toHaveProperty('privateKeyHex')\n      expect(key.kms).toEqual('local')\n      expect(key.type).toEqual('Ed25519')\n    })\n\n    it('should create X25519 key', async () => {\n      const key = await agent.keyManagerCreate({\n        kms: 'local',\n        type: 'X25519',\n      })\n\n      expect(key).toHaveProperty('kid')\n      expect(key).toHaveProperty('publicKeyHex')\n      expect(key).not.toHaveProperty('privateKeyHex')\n      expect(key.kms).toEqual('local')\n      expect(key.type).toEqual('X25519')\n    })\n\n    it('should throw an error for unsupported kms', async () => {\n      expect.assertions(1)\n      await expect(\n        agent.keyManagerCreate({\n          kms: 'foobar',\n          type: 'Secp256k1',\n        }),\n      ).rejects.toThrow(\n        `invalid_argument: This agent has no registered KeyManagementSystem with name='foobar'`,\n      )\n    })\n\n    it('should throw an error for unsupported key type', async () => {\n      expect.assertions(1)\n      await expect(\n        agent.keyManagerCreate({\n          kms: 'local',\n          // @ts-ignore\n          type: 'foobar',\n        }),\n      ).rejects.toThrow('Key type not supported: foobar')\n    })\n\n    it('should create key with meta data', async () => {\n      const key = await agent.keyManagerCreate({\n        kms: 'local',\n        type: 'Secp256k1',\n        meta: {\n          foo: 'bar',\n          bar: 'baz',\n        },\n      })\n\n      expect(key).toHaveProperty('kid')\n      expect(key).toHaveProperty('publicKeyHex')\n      expect(key).not.toHaveProperty('privateKeyHex')\n      expect(key.kms).toEqual('local')\n      expect(key.type).toEqual('Secp256k1')\n      expect(key.meta).toEqual({\n        foo: 'bar',\n        bar: 'baz',\n        algorithms: [\n          'ES256K',\n          'ES256K-R',\n          'eth_signTransaction',\n          'eth_signTypedData',\n          'eth_signMessage',\n          'eth_rawSign',\n        ],\n      })\n    })\n\n    it('should get key by key id', async () => {\n      const key = await agent.keyManagerCreate({\n        kms: 'local',\n        type: 'Secp256k1',\n      })\n\n      const key2 = await agent.keyManagerGet({\n        kid: key.kid,\n      })\n\n      expect(key2).toHaveProperty('kid')\n      expect(key2).toHaveProperty('kms')\n      expect(key2).toHaveProperty('publicKeyHex')\n      expect(key2).toHaveProperty('type')\n      expect(key2).not.toHaveProperty('privateKeyHex')\n      expect(key2).toEqual(key)\n    })\n\n    it('should delete key', async () => {\n      const key = await agent.keyManagerCreate({\n        kms: 'local',\n        type: 'Secp256k1',\n      })\n\n      const result = await agent.keyManagerDelete({\n        kid: key.kid,\n      })\n\n      expect(result).toEqual(true)\n\n      await expect(\n        agent.keyManagerGet({\n          kid: key.kid,\n        }),\n      ).rejects.toThrow('Key not found')\n\n      await expect(\n        agent.keyManagerDelete({\n          kid: key.kid,\n        }),\n      ).rejects.toThrow('Key not found')\n    })\n\n    it('should import key', async () => {\n      const keyData = {\n        kid: 'myImportedKey',\n        kms: 'local',\n        type: <TKeyType>'Secp256k1',\n        privateKeyHex: 'e63886b5ba367dc2aff9acea6d955ee7c39115f12eaf2aa6b1a2eaa852036668',\n        meta: { foo: 'bar' },\n      }\n\n      const expectedImport = {\n        kid: 'myImportedKey',\n        kms: 'local',\n        type: 'Secp256k1',\n        publicKeyHex:\n          '04dd467afb12bdb797303e7f3f0c8cd0ba80d518dc4e339e0e2eb8f2d99a9415cac537854a30d31a854b7af0b4fcb54c3954047390fa9500d3cc2e15a3e09017bb',\n        meta: {\n          algorithms: [\n            'ES256K',\n            'ES256K-R',\n            'eth_signTransaction',\n            'eth_signTypedData',\n            'eth_signMessage',\n            'eth_rawSign',\n          ],\n          foo: 'bar',\n        },\n      }\n\n      const result = await agent.keyManagerImport(keyData)\n      expect(result).toEqual(expectedImport)\n\n      const key2 = await agent.keyManagerGet({\n        kid: keyData.kid,\n      })\n\n      expect(key2).toEqual(expectedImport)\n    })\n\n    it('should sign JWT', async () => {\n      const key = await agent.keyManagerCreate({\n        kms: 'local',\n        type: 'Secp256k1',\n      })\n\n      const signature = await agent.keyManagerSignJWT({\n        kid: key.kid,\n        data: 'test',\n      })\n\n      expect(signature).toBeDefined()\n    })\n\n    it('should sign EthTX', async () => {\n      const key = await agent.keyManagerCreate({\n        kms: 'local',\n        type: 'Secp256k1',\n      })\n\n      const rawTx = await agent.keyManagerSignEthTX({\n        kid: key.kid,\n        transaction: {\n          to: '0xcE31a19193D4b23F4E9D6163d7247243BAF801C3',\n          value: 300000,\n          gasLimit: 43092000,\n          gasPrice: 20000000000,\n          nonce: 1,\n        },\n      })\n\n      expect(typeof rawTx).toEqual('string')\n    })\n\n    it('should allow signing EthTX with matching from', async () => {\n      const key = await agent.keyManagerCreate({\n        kms: 'local',\n        type: 'Secp256k1',\n      })\n      const keyAddress = computeAddress('0x' + key.publicKeyHex)\n\n      const rawTx = await agent.keyManagerSignEthTX({\n        kid: key.kid,\n        transaction: {\n          to: '0xcE31a19193D4b23F4E9D6163d7247243BAF801C3',\n          from: keyAddress,\n          value: 300000,\n          gasLimit: 43092000,\n          gasPrice: 20000000000,\n          nonce: 1,\n        },\n      })\n\n      expect(typeof rawTx).toEqual('string')\n    })\n\n    it('should NOT sign EthTX with mismatching from field', async () => {\n      expect.assertions(1)\n      const key = await agent.keyManagerCreate({\n        kms: 'local',\n        type: 'Secp256k1',\n      })\n\n      await expect(\n        agent.keyManagerSignEthTX({\n          kid: key.kid,\n          transaction: {\n            to: '0xcE31a19193D4b23F4E9D6163d7247243BAF801C3',\n            from: '0xcE31a19193D4b23F4E9D6163d7247243BAF801C3',\n            value: 300000,\n            gasLimit: 43092000,\n            gasPrice: 20000000000,\n            nonce: 1,\n          },\n        }),\n      ).rejects.toThrow(\n        'invalid_arguments: keyManagerSignEthTX `from` field does not match the chosen key. `from` field should be omitted.',\n      )\n    })\n\n    it('Should Encrypt/Decrypt', async () => {\n      const message = 'foo bar'\n      const senderKey = await agent.keyManagerCreate({\n        kms: 'local',\n        type: 'Ed25519',\n      })\n      const recipientKey = await agent.keyManagerCreate({\n        kms: 'local',\n        type: 'Ed25519',\n      })\n      const encrypted = await agent.keyManagerEncryptJWE({\n        kid: senderKey.kid,\n        to: recipientKey,\n        data: message,\n      })\n      expect(typeof encrypted).toEqual('string')\n      const decrypted = await agent.keyManagerDecryptJWE({\n        kid: recipientKey.kid,\n        data: encrypted,\n      })\n      expect(decrypted).toEqual(message)\n    })\n\n    it('Should compute sharedSecret', async () => {\n      const kmsArray = await agent.keyManagerGetKeyManagementSystems()\n      const kms = kmsArray[0] || 'local'\n      await agent.keyManagerImport({\n        type: 'X25519',\n        kid: 'senderKey1',\n        publicKeyHex: 'c4f35b52cc5309e70a1954b00e757d2b134f3cde9beb8179312b5ce4198a1379',\n        privateKeyHex: 'c796444e0ee9ec8e1c57ae1334a5900c287426fa5177aa093ed9199573e34aca',\n        kms,\n      })\n      const receiverKey = {\n        type: <TKeyType>'X25519',\n        publicKeyHex: 'c1d9ca35bd2c86ad0d61f682c30b24c73045a96773d82ff3b21ebadf85c39244',\n      }\n      const secret = await agent.keyManagerSharedSecret({\n        secretKeyRef: 'senderKey1',\n        publicKey: receiverKey,\n      })\n      expect(secret).toEqual('ee94c7fcf5298291029a3c3d59a8a05367a1806f36668a1f67f5ea8149097476')\n    })\n\n    describe('using Secp256k1 test vectors', () => {\n      const importedKey = {\n        kid: 'imported',\n        kms: 'local',\n        type: <TKeyType>'Secp256k1',\n        publicKeyHex:\n          '04155ee0cbefeecd80de63a62b4ed8f0f97ac22a58f76a265903b9acab79bf018c7037e2bd897812170c92a4c978d6a10481491a37299d74c4bd412a111a4ac875',\n        privateKeyHex: '31d1ec15ff8110442012fef0d1af918c0e09b2e2ab821bba52ecc85f8655ec63',\n      }\n\n      beforeAll(async () => {\n        const imported = await agent.keyManagerImport(importedKey)\n      })\n\n      it('should sign JWT using legacy method', async () => {\n        const signature = await agent.keyManagerSignJWT({\n          kid: importedKey.kid,\n          data: 'bla.bla',\n        })\n        expect(signature).toEqual(\n          'pNAFkgmuKhqMbb_6Km--ZmY7UCkWunWUuNajSfF6rv5lEa5nNXCU7cnZBZVptU7u8h150qetqkqUaahAf-Cepw',\n        )\n      })\n\n      it('should sign EthTX using legacy method', async () => {\n        const rawTx = await agent.keyManagerSignEthTX({\n          kid: importedKey.kid,\n          transaction: {\n            to: '0xcE31a19193D4b23F4E9D6163d7247243BAF801C3',\n            value: 300000,\n            gasLimit: 43092000,\n            gasPrice: 20000000000,\n            nonce: 1,\n          },\n        })\n        expect(rawTx).toEqual(\n          '0x01f86b80018504a817c800840291882094ce31a19193d4b23f4e9d6163d7247243baf801c3830493e080c001a05a46cdfe2102e81e90f89d8896ddaf32aee5473bad994bc1767f0d2af9afa160a01c028daaf737d69f6933d2dfef5e739f459cfb9e8ce1d9ba9ea7bb0c6006518c',\n        )\n      })\n\n      it('should sign JWT using generic signer', async () => {\n        const signature = await agent.keyManagerSign({\n          algorithm: 'ES256K',\n          data: 'bla.bla',\n          encoding: 'utf-8',\n          keyRef: importedKey.kid,\n        })\n        expect(signature).toEqual(\n          'pNAFkgmuKhqMbb_6Km--ZmY7UCkWunWUuNajSfF6rv5lEa5nNXCU7cnZBZVptU7u8h150qetqkqUaahAf-Cepw',\n        )\n      })\n\n      it('should sign EthTX using generic signer', async () => {\n        const transaction = new Transaction()\n        transaction.to = '0xcE31a19193D4b23F4E9D6163d7247243BAF801C3'\n        transaction.value = 300000\n        transaction.gasLimit = 43092000\n        transaction.gasPrice = 20000000000\n        transaction.nonce = 1\n\n        const txData = transaction.unsignedSerialized\n\n        const rawTx = await agent.keyManagerSign({\n          algorithm: 'eth_signTransaction',\n          data: txData,\n          encoding: 'hex',\n          keyRef: importedKey.kid,\n        })\n\n        expect(rawTx).toEqual(\n          '0x01f86b80018504a817c800840291882094ce31a19193d4b23f4e9d6163d7247243baf801c3830493e080c001a05a46cdfe2102e81e90f89d8896ddaf32aee5473bad994bc1767f0d2af9afa160a01c028daaf737d69f6933d2dfef5e739f459cfb9e8ce1d9ba9ea7bb0c6006518c',\n        )\n      })\n\n      it('should sign EthTX using generic signer and specific type', async () => {\n        const transaction = Transaction.from({\n          to: '0xcE31a19193D4b23F4E9D6163d7247243BAF801C3',\n          value: 300000,\n          gasLimit: 43092000,\n          gasPrice: 20000000000,\n          nonce: 1,\n          type: 0, // enforce legacy serialization\n        })\n\n        const txData = transaction.unsignedSerialized\n\n        const rawTx = await agent.keyManagerSign({\n          algorithm: 'eth_signTransaction',\n          data: txData,\n          encoding: 'hex',\n          keyRef: importedKey.kid,\n        })\n\n        expect(rawTx).toEqual(\n            '0xf869018504a817c800840291882094ce31a19193d4b23f4e9d6163d7247243baf801c3830493e0801ba0f16e2206290181c3feaa04051dad19089105c24339dbdf0d80147b48a59fa152a0770e8751ec77ccc78e8b207023f168444f7cfb67055c55c70ef75234458a3d51',\n        )\n      })\n    })\n\n    describe('using Ed25519 test vectors', () => {\n      const importedKey = {\n        kid: 'ea75250531f6834328ac210618253288e4c54632962a9708ca82e4a399f79000',\n        kms: 'local',\n        type: <TKeyType>'Ed25519',\n        publicKeyHex: 'ea75250531f6834328ac210618253288e4c54632962a9708ca82e4a399f79000',\n        privateKeyHex:\n          '65f341541643070564bb48d9fc10556f2dec246fa056e436a8ec1cdef8c74766ea75250531f6834328ac210618253288e4c54632962a9708ca82e4a399f79000',\n      }\n\n      beforeAll(async () => {\n        const imported = await agent.keyManagerImport(importedKey)\n      })\n\n      it('should sign JWT using legacy method', async () => {\n        const signature = await agent.keyManagerSignJWT({\n          kid: importedKey.kid,\n          data: 'bla.bla',\n        })\n        expect(signature).toEqual(\n          '_2P0iukN2CPH1nQ6LeBm1zQHHp3U4wSYDrpeWTWkp7yuzJex6O60Z4OhdfD5I9WPHV734US8n5vyD2VDbT1UCg',\n        )\n      })\n\n      it('should sign JWT using generic signer', async () => {\n        const signature = await agent.keyManagerSign({\n          keyRef: importedKey.kid,\n          data: 'bla.bla',\n          algorithm: 'EdDSA',\n          encoding: 'utf-8',\n        })\n        expect(signature).toEqual(\n          '_2P0iukN2CPH1nQ6LeBm1zQHHp3U4wSYDrpeWTWkp7yuzJex6O60Z4OhdfD5I9WPHV734US8n5vyD2VDbT1UCg',\n        )\n      })\n    })\n\n    it('should sign with eth_signTypedData', async () => {\n      // https://github.com/MetaMask/test-dapp/blob/5719808b2a589be92b50fecc1d479fb1e63341c1/src/index.js#L1097\n      const msgParams = {\n        domain: {\n          chainId: 4,\n          name: 'Ether Mail',\n          verifyingContract: '0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC',\n          version: '1',\n        },\n        message: {\n          contents: 'Hello, Bob!',\n          from: {\n            name: 'Cow',\n            wallets: [\n              '0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826',\n              '0xDeaDbeefdEAdbeefdEadbEEFdeadbeEFdEaDbeeF',\n            ],\n          },\n          to: [\n            {\n              name: 'Bob',\n              wallets: [\n                '0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB',\n                '0xB0BdaBea57B0BDABeA57b0bdABEA57b0BDabEa57',\n                '0xB0B0b0b0b0b0B000000000000000000000000000',\n              ],\n            },\n          ],\n        },\n        types: {\n          Mail: [\n            { name: 'from', type: 'Person' },\n            { name: 'to', type: 'Person[]' },\n            { name: 'contents', type: 'string' },\n          ],\n          Person: [\n            { name: 'name', type: 'string' },\n            { name: 'wallets', type: 'address[]' },\n          ],\n        },\n      }\n\n      const identifier = await agent.didManagerCreate({ kms: 'local', provider: 'did:pkh' })\n\n      const extendedKeys = await mapIdentifierKeysToDoc(identifier, 'verificationMethod', { agent })\n      const extendedKey = extendedKeys[0]\n\n      const signature = await agent.keyManagerSign({\n        data: JSON.stringify(msgParams),\n        keyRef: extendedKey.kid,\n        algorithm: 'eth_signTypedData',\n      })\n\n      const address = extendedKey.meta.ethereumAddress\n\n      const data = {\n        ...msgParams,\n        primaryType: 'Mail',\n        types: {\n          ...msgParams.types,\n          EIP712Domain: [\n            // Order of these elements matters!\n            // https://github.com/ethers-io/ethers.js/blob/a71f51825571d1ea0fa997c1352d5b4d85643416/packages/hash/src.ts/typed-data.ts#L385\n            { name: 'name', type: 'string' },\n            { name: 'version', type: 'string' },\n            { name: 'chainId', type: 'uint256' },\n            { name: 'verifyingContract', type: 'address' },\n          ],\n        },\n      }\n\n      // @ts-ignore\n      const recovered = recoverTypedSignature({\n        data: data as any,\n        signature: signature,\n        version: SignTypedDataVersion.V4,\n      })\n      expect(address.toLowerCase()).toEqual(recovered)\n    })\n\n    it('should sign credential with eth_signTypedData', async () => {\n      const msgParams = {\n        domain: {\n          chainId: 4,\n          name: 'VerifiableCredential',\n          version: '1',\n        },\n        types: {\n          CredentialSubject: [\n            {\n              name: 'id',\n              type: 'string',\n            },\n            {\n              name: 'you',\n              type: 'string',\n            },\n          ],\n          Issuer: [\n            {\n              name: 'id',\n              type: 'string',\n            },\n          ],\n          VerifiableCredential: [\n            {\n              name: '@context',\n              type: 'string[]',\n            },\n            {\n              name: 'credentialSubject',\n              type: 'CredentialSubject',\n            },\n            {\n              name: 'issuanceDate',\n              type: 'string',\n            },\n            {\n              name: 'issuer',\n              type: 'Issuer',\n            },\n            {\n              name: 'type',\n              type: 'string[]',\n            },\n          ],\n        },\n        message: {\n          issuer: {\n            id: 'did:fake:123',\n          },\n          '@context': ['https://www.w3.org/2018/credentials/v1', 'https://example.com/1/2/3'],\n          type: ['VerifiableCredential', 'Custom'],\n          issuanceDate: '2022-05-31T14:02:06.109Z',\n          credentialSubject: {\n            id: 'did:web:example.com',\n            you: 'Rock',\n          },\n        },\n      }\n\n      const identifier = await agent.didManagerCreate({\n        kms: 'local',\n        provider: 'did:pkh',\n      })\n\n      const extendedKeys = await mapIdentifierKeysToDoc(identifier, 'verificationMethod', { agent })\n      const extendedKey = extendedKeys[0]\n\n      const signature = await agent.keyManagerSign({\n        data: JSON.stringify(msgParams),\n        keyRef: extendedKey.kid,\n        algorithm: 'eth_signTypedData',\n      })\n\n      const address = extendedKey.meta.ethereumAddress\n\n      const data = {\n        ...msgParams,\n        primaryType: 'VerifiableCredential',\n        types: {\n          ...msgParams.types,\n          EIP712Domain: [\n            // Order of these elements matters!\n            // https://github.com/ethers-io/ethers.js/blob/a71f51825571d1ea0fa997c1352d5b4d85643416/packages/hash/src.ts/typed-data.ts#L385\n            { name: 'name', type: 'string' },\n            { name: 'version', type: 'string' },\n            { name: 'chainId', type: 'uint256' },\n          ],\n        },\n      }\n\n      const args = { data, signature: signature, version: SignTypedDataVersion.V4 }\n      // @ts-ignore\n      const recovered = recoverTypedSignature(args)\n      expect(address.toLowerCase()).toEqual(recovered)\n    })\n\n    it('should sign keccak hash with eth_rawSign', async () => {\n      const importedKey = {\n        kid: 'imported_raw',\n        kms: 'local',\n        type: <TKeyType>'Secp256k1',\n        publicKeyHex:\n          '04155ee0cbefeecd80de63a62b4ed8f0f97ac22a58f76a265903b9acab79bf018c7037e2bd897812170c92a4c978d6a10481491a37299d74c4bd412a111a4ac875',\n        privateKeyHex: '31d1ec15ff8110442012fef0d1af918c0e09b2e2ab821bba52ecc85f8655ec63',\n      }\n\n      const key = await agent.keyManagerImport(importedKey)\n\n      const signature = await agent.keyManagerSign({\n        algorithm: 'eth_rawSign',\n        data: '9c22ff5f21f0b81b113e63f7db6da94fedef11b2119b4088b89664fb9a3cb658',\n        encoding: 'hex',\n        keyRef: key.kid,\n      })\n\n      expect(signature).toEqual(\n        '0x9d9e6c705cfa5f348de0c5174e70234c3b372d6bfca05fd11ffc5fe46eab996a3e4780d403b611395fd8548f2b101c3542c5e43848e486ea238da18fe0ffe6d0',\n      )\n    })\n  })\n}\n"
  },
  {
    "path": "__tests__/shared/messageHandler.ts",
    "content": "// noinspection ES6PreferShortImport\n\nimport { IDataStore, IDataStoreORM, IMessage, IMessageHandler, TAgent } from '../../packages/core-types/src'\n\ntype ConfiguredAgent = TAgent<IDataStore & IMessageHandler & IDataStoreORM>\n\nexport default (testContext: {\n  getAgent: () => ConfiguredAgent\n  setup: () => Promise<boolean>\n  tearDown: () => Promise<boolean>\n}) => {\n  describe('message handler', () => {\n    let agent: ConfiguredAgent\n\n    beforeAll(async () => {\n      await testContext.setup()\n      agent = testContext.getAgent()\n      return true\n    })\n    afterAll(testContext.tearDown)\n\n    let parsedMessage: IMessage\n\n    it('should parse raw message', async () => {\n      const raw =\n        'eyJhbGciOiJFZERTQSIsInR5cCI6IkpXVCJ9.eyJ2YyI6eyJAY29udGV4dCI6WyJodHRwczovL3d3dy53My5vcmcvMjAxOC9jcmVkZW50aWFscy92MSJdLCJ0eXBlIjpbIlZlcmlmaWFibGVDcmVkZW50aWFsIl0sImNyZWRlbnRpYWxTdWJqZWN0Ijp7Im5hbWUiOiJBbGljZSJ9fSwic3ViIjoiZGlkOmtleTp6Nk1rakRVR29STDFTVVdGWVkzRmF6SkZYd1JpeVZQeHNwS3NraTlCSlZzRFpIQmkiLCJuYmYiOjE3MTc3NDY3MzUsImlzcyI6ImRpZDprZXk6ejZNa2pEVUdvUkwxU1VXRllZM0ZhekpGWHdSaXlWUHhzcEtza2k5QkpWc0RaSEJpIn0.USuGnZCTwqDUXRaPBlQN_c8LZxl03zf8TkEqP6xC4I6I-ruj5NNbQ_bYhOCUTi9LER_FO5zDU8V0MmaPCxnNBA'\n      parsedMessage = await agent.handleMessage({\n        raw,\n        save: false,\n        metaData: [{ type: 'test' }],\n      })\n      expect(typeof parsedMessage.id).toEqual('string')\n    })\n\n    it('should save message', async () => {\n      const id = await agent.dataStoreSaveMessage({ message: parsedMessage })\n      expect(id).toEqual(parsedMessage.id)\n    })\n\n    it('should get message from db', async () => {\n      const message = await agent.dataStoreGetMessage({ id: parsedMessage.id })\n      // message has empty `presentations` array (not present in `parsedMessage`), when \n      // using db (not json store)\n      // expect(message).toEqual(parsedMessage)\n      expect(message.raw).toEqual(parsedMessage.raw)\n      expect(message.data).toEqual(parsedMessage.data)\n      expect(message.metaData).toEqual(parsedMessage.metaData)\n    })\n\n    it('should throw error for non existing message', async () => {\n      await expect(\n        agent.dataStoreGetMessage({\n          id: 'foobar',\n        }),\n      ).rejects.toThrow('Message not found')\n    })\n\n    it('should count messages', async () => {\n      const allMessages = await agent.dataStoreORMGetMessages()\n      const count = await agent.dataStoreORMGetMessagesCount()\n      expect(allMessages.length).toEqual(count)\n    })\n  })\n}\n"
  },
  {
    "path": "__tests__/shared/resolveDid.ts",
    "content": "// noinspection ES6PreferShortImport\n\nimport { IIdentifier } from '../../packages/core-types/src'\nimport { IAgentOptions, IDIDManager, IResolver, TAgent } from '../../packages/core-types/src'\n\ntype ConfiguredAgent = TAgent<IResolver & IDIDManager>\n\nexport default (testContext: {\n  getAgent: (options?: IAgentOptions) => ConfiguredAgent\n  setup: (options?: IAgentOptions) => Promise<boolean>\n  tearDown: () => Promise<boolean>\n}) => {\n  describe('resolving didUrl', () => {\n    let agent: ConfiguredAgent\n\n    beforeAll(async () => {\n      await testContext.setup()\n      agent = testContext.getAgent()\n      return true\n    })\n    afterAll(testContext.tearDown)\n\n    it('should resolve didUrl', async () => {\n      const didUrl = 'did:ethr:ganache:0xb09b66026ba5909a7cfe99b76875431d2b8d5190'\n      const didDoc = (await agent.resolveDid({ didUrl })).didDocument\n      expect(didDoc?.id).toEqual(didUrl)\n    })\n\n    it('should resolve did:key github #681', async () => {\n      const didUrl = 'did:key:z6Mkk7yqnGF3YwTrLpqrW6PGsKci7dNqh1CjnvMbzrMerSeL'\n      const result = await agent.resolveDid({ didUrl })\n      const didDoc = result.didDocument\n      expect(didDoc?.id).toEqual(didUrl)\n      expect(result).toHaveProperty('didDocumentMetadata')\n      expect(result).toHaveProperty('didResolutionMetadata')\n    })\n\n    it('should resolve did:pkh', async () => {\n      let identifier: IIdentifier = await agent.didManagerCreate({\n        // this expects the `did:ethr` provider to matchPrefix and use the `arbitrum:goerli` network specifier\n        provider: 'did:pkh',\n        options: { chainId: '1' },\n      })\n\n      const result = await agent.resolveDid({ didUrl: identifier.did })\n      const didDoc = result.didDocument\n      expect(didDoc?.id).toEqual(identifier.did)\n      expect(result).toHaveProperty('didDocumentMetadata')\n      expect(result).toHaveProperty('didResolutionMetadata')\n\n      //let cred = await agent.createVerifiableCredential()\n    })\n\n    it('should resolve did:jwk', async () => {\n      let identifier: IIdentifier = await agent.didManagerCreate({\n        provider: 'did:jwk',\n        // keyType supports 'Secp256k1', 'Secp256r1', 'Ed25519', 'X25519'\n        options: {\n          keyType: 'Ed25519',\n        },\n      })\n      const result = await agent.resolveDid({ didUrl: identifier.did })\n      const didDoc = result.didDocument\n      expect(didDoc?.id).toEqual(identifier.did)\n      expect(result).toHaveProperty('didDocumentMetadata')\n      expect(result).toHaveProperty('didResolutionMetadata')\n    })\n\n    it('should resolve imported fake did', async () => {\n      const did = 'did:fake:myfakedid'\n      await agent.didManagerImport({\n        did,\n        keys: [\n          {\n            type: 'Ed25519',\n            kid: 'fake-key-1',\n            publicKeyHex: '1fe9b397c196ab33549041b29cf93be29b9f2bdd27322f05844112fad97ff92a',\n            privateKeyHex:\n              'b57103882f7c66512dc96777cbafbeb2d48eca1e7a867f5a17a84e9a6740f7dc1fe9b397c196ab33549041b29cf93be29b9f2bdd27322f05844112fad97ff92a',\n            kms: 'local',\n          },\n        ],\n        services: [\n          {\n            id: 'fake-service-1',\n            type: 'fakeService',\n            serviceEndpoint: 'http://it.is.fake.all.the.way.down',\n          },\n        ],\n        provider: 'did:fake',\n        alias: 'faker',\n      })\n      const resolved = await agent.resolveDid({ didUrl: did })\n      expect(resolved.didDocument).toEqual({\n        id: did,\n        service: [\n          {\n            id: 'did:fake:myfakedid#fake-service-1',\n            type: 'fakeService',\n            serviceEndpoint: 'http://it.is.fake.all.the.way.down',\n          },\n        ],\n        verificationMethod: [\n          {\n            type: 'Ed25519VerificationKey2018',\n            publicKeyHex: '1fe9b397c196ab33549041b29cf93be29b9f2bdd27322f05844112fad97ff92a',\n            kms: 'local',\n            controller: 'did:fake:myfakedid',\n            id: 'did:fake:myfakedid#fake-key-1',\n          },\n        ],\n        keyAgreement: ['did:fake:myfakedid#fake-key-1'],\n        authentication: ['did:fake:myfakedid#fake-key-1'],\n        assertionMethod: ['did:fake:myfakedid#fake-key-1'],\n        '@context': ['https://www.w3.org/ns/did/v1', 'https://w3id.org/security/suites/ed25519-2018/v1'],\n      })\n      expect(resolved).toHaveProperty('didDocumentMetadata')\n      expect(resolved).toHaveProperty('didResolutionMetadata')\n    })\n\n    it('should resolve created fake did', async () => {\n      const alias = 'allfake'\n      const did = `did:fake:${alias}`\n      const createdDID = await agent.didManagerCreate({ alias, provider: 'did:fake' })\n      const modified = await agent.didManagerAddService({\n        did,\n        service: { id: 'fake-service-x', type: 'FakeService', serviceEndpoint: 'none' },\n      })\n      const resolved = await agent.resolveDid({ didUrl: did })\n      expect(resolved?.didDocument?.service).toEqual([\n        { id: `${did}#fake-service-x`, type: 'FakeService', serviceEndpoint: 'none' },\n      ])\n    })\n\n    it('should return an error for unsupported did methods', async () => {\n      expect.assertions(1)\n      await expect(agent.resolveDid({ didUrl: 'did:foo:bar' })).resolves.toEqual({\n        didDocument: null,\n        didResolutionMetadata: { error: 'unsupportedDidMethod' },\n        didDocumentMetadata: {},\n      })\n    })\n\n    it('should throw error when resolving garbage', async () => {\n      expect.assertions(3)\n      // @ts-ignore\n      await expect(agent.resolveDid()).resolves.toEqual({\n        didDocument: null,\n        didDocumentMetadata: {},\n        didResolutionMetadata: { error: 'invalidDid' },\n      })\n      // @ts-ignore\n      await expect(agent.resolveDid({})).resolves.toEqual({\n        didDocument: null,\n        didDocumentMetadata: {},\n        didResolutionMetadata: { error: 'invalidDid' },\n      })\n      // @ts-ignore\n      await expect(agent.resolveDid({ didUrl: 'garbage' })).resolves.toEqual({\n        didDocument: null,\n        didDocumentMetadata: {},\n        didResolutionMetadata: { error: 'invalidDid' },\n      })\n    })\n  })\n\n  describe('resolving didUrl with validation', () => {\n    let agent: ConfiguredAgent\n\n    beforeAll(async () => {\n      await testContext.setup({ schemaValidation: true })\n      agent = testContext.getAgent({ schemaValidation: true })\n      return true\n    })\n    afterAll(testContext.tearDown)\n\n    it('should throw validation error', async () => {\n      expect.assertions(3)\n      // @ts-ignore\n      await expect(agent.resolveDid()).rejects.toHaveProperty('name', 'ValidationError')\n      // @ts-ignore\n      await expect(agent.resolveDid({})).rejects.toHaveProperty('name', 'ValidationError')\n      // @ts-ignore\n      await expect(agent.resolveDid({ didUrl: 1 })).rejects.toHaveProperty('name', 'ValidationError')\n    })\n  })\n}\n"
  },
  {
    "path": "__tests__/shared/saveClaims.ts",
    "content": "// noinspection ES6PreferShortImport\n\nimport {\n  FindCredentialsArgs,\n  ICredentialIssuer,\n  IDataStore,\n  IDataStoreORM,\n  IDIDManager,\n  IIdentifier,\n  IMessageHandler,\n  TAgent,\n} from '../../packages/core-types/src'\nimport { ISelectiveDisclosure } from '../../packages/selective-disclosure/src'\n\ntype ConfiguredAgent = TAgent<\n  IDIDManager & ICredentialIssuer & IDataStoreORM & IDataStore & IMessageHandler & ISelectiveDisclosure\n>\n\nexport default (testContext: {\n  getAgent: () => ConfiguredAgent\n  setup: () => Promise<boolean>\n  tearDown: () => Promise<boolean>\n}) => {\n  describe('Save credentials and query by claim type', () => {\n    let agent: ConfiguredAgent\n    let identifier: IIdentifier\n\n    beforeAll(async () => {\n      await testContext.setup()\n      agent = testContext.getAgent()\n    })\n    afterAll(testContext.tearDown)\n\n    it('should create identifier', async () => {\n      identifier = await agent.didManagerCreate({ kms: 'local' })\n      expect(identifier).toHaveProperty('did')\n    })\n\n    it('should create verifiable credentials', async () => {\n      // Looping these in a map/forEach throws SQL UNIQUE CONSTRAINT errors\n\n      await agent.createVerifiableCredential({\n        credential: {\n          issuer: { id: identifier.did },\n          '@context': ['https://www.w3.org/2018/credentials/v1'],\n          type: ['VerifiableCredential'],\n          issuanceDate: '2023-09-15T10:22:07.506Z',\n          id: 'a',\n          credentialSubject: {\n            id: identifier.did,\n            topic: 'math',\n          },\n        },\n        proofFormat: 'jwt',\n        save: true,\n      })\n\n      await agent.createVerifiableCredential({\n        credential: {\n          issuer: { id: identifier.did },\n          '@context': ['https://www.w3.org/2018/credentials/v1'],\n          type: ['VerifiableCredential'],\n          issuanceDate: '2023-09-16T10:22:07.506Z',\n          id: 'b',\n          credentialSubject: {\n            id: identifier.did,\n            topic: 'science',\n          },\n        },\n        proofFormat: 'jwt',\n        save: true,\n      })\n\n      await agent.createVerifiableCredential({\n        credential: {\n          issuer: { id: identifier.did },\n          '@context': ['https://www.w3.org/2018/credentials/v1'],\n          type: ['VerifiableCredential'],\n          issuanceDate: '2023-09-17T10:22:07.506Z',\n          id: 'c',\n          credentialSubject: {\n            id: identifier.did,\n            topic: 'art',\n          },\n        },\n        proofFormat: 'jwt',\n        save: true,\n      })\n    })\n\n    it('should be able to find all the credentials', async () => {\n      const credentials = await agent.dataStoreORMGetVerifiableCredentials({\n        where: [{ column: 'issuer', value: [identifier.did] }],\n      })\n      expect(credentials).toHaveLength(3)\n    })\n\n    it('should be able to find all the credentials when query by claim type', async () => {\n      const credentials = await agent.dataStoreORMGetVerifiableCredentialsByClaims({\n        where: [{ column: 'type', value: ['topic'] }],\n      })\n      expect(credentials).toHaveLength(3)\n      const count = await agent.dataStoreORMGetVerifiableCredentialsByClaimsCount({\n        where: [{ column: 'type', value: ['topic'] }],\n      })\n      expect(count).toEqual(credentials.length)\n    })\n\n    it('blocks injection attempts', async () => {\n      expect.assertions(1);\n      const query = agent.dataStoreORMGetVerifiableCredentialsByClaims({\n        where: [\n          {\n            value: ['string'],\n            not: true,\n            op: 'zx' as any,\n            column: 'isObj',\n          },\n        ],\n        skip: 0,\n        take: 0,\n        order: [\n          {\n            direction: 'ASC',\n            column:\n              'issuanceDate\" AS \"issuanceDate\" FROM \"claim\" \"claim\" LEFT JOIN \"identifier\" \"issuer\" ON \"issuer\".\"did\"=\"claim\".\"issuerDid\"  LEFT JOIN \"identifier\" \"subject\" ON \"subject\".\"did\"=\"claim\".\"subjectDid\"  LEFT JOIN \"credential\" \"credential\" ON \"credential\".\"hash\"=\"claim\".\"credentialHash\" where not(claim.isObj in (?)) and 1=0 UNION ALL SELECT 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,(SELECT json_object(\\'alias\\', alias, \\'type\\', type, \\'privateKeyHex\\', privateKeyHex) ),22,23,24,25,26,27,28,29 from `private-key`-- -' as any,\n          },\n        ],\n      })\n      await expect(query).rejects.toThrow(/Invalid column name/);\n    })\n\n    it('should be able to find all the credentials when query by claim type and value', async () => {\n      const credentials = await agent.dataStoreORMGetVerifiableCredentialsByClaims({\n        where: [\n          { column: 'type', value: ['topic'] },\n          { column: 'value', value: ['math', 'art'] },\n        ],\n      })\n      expect(credentials).toHaveLength(2)\n    })\n\n    it('should be able to limit credentials when query by claim type and value', async () => {\n      const credentials = await agent.dataStoreORMGetVerifiableCredentialsByClaims({\n        where: [\n          { column: 'type', value: ['topic'] },\n          { column: 'value', value: ['math', 'art'] },\n        ],\n        order: [{ column: 'issuanceDate', direction: 'DESC' }],\n        take: 1\n      })\n      expect(credentials).toHaveLength(1)\n    })\n    it('should be able to limit credentials when searching and sorting', async () => {\n      const credentials = await agent.dataStoreORMGetVerifiableCredentials({\n        where: [\n          { column: 'type', value: ['VerifiableCredential'] },\n        ],\n        order: [{ column: 'issuanceDate', direction: 'DESC' }],\n        take: 1,\n        skip: 1\n      })\n      expect(credentials).toHaveLength(1)\n    })\n\n    it('should be able to limit credentials when sorting', async () => {\n      const credentialsAllDesc = await agent.dataStoreORMGetVerifiableCredentials({\n        order: [{ column: 'issuanceDate', direction: 'DESC' }]\n      })\n\n      const credentialsAllAsc = await agent.dataStoreORMGetVerifiableCredentials({\n        order: [{ column: 'issuanceDate', direction: 'ASC' }]\n      })\n\n      const credentialsIdAllDesc = await agent.dataStoreORMGetVerifiableCredentials({\n        order: [{ column: 'id', direction: 'DESC' }]\n      })\n\n      const credentialsIdAllAsc = await agent.dataStoreORMGetVerifiableCredentials({\n        order: [{ column: 'id', direction: 'ASC' }]\n      })\n\n\n      const credentials1 = await agent.dataStoreORMGetVerifiableCredentials({\n        order: [{ column: 'issuanceDate', direction: 'DESC' }],\n        take: 1,\n        skip: 0\n      })\n      const credentials2 = await agent.dataStoreORMGetVerifiableCredentials({\n        order: [{ column: 'issuanceDate', direction: 'DESC' }],\n        take: 1,\n        skip: 1\n      })\n      const credentials3 = await agent.dataStoreORMGetVerifiableCredentials({\n        order: [{ column: 'issuanceDate', direction: 'ASC' }],\n        take: 2,\n        skip: 0\n      })\n      const credentials4 = await agent.dataStoreORMGetVerifiableCredentials({\n        order: [{ column: 'issuanceDate', direction: 'ASC' }],\n        take: 2,\n        skip: 1\n      })\n\n      expect(credentialsAllDesc).toHaveLength(3)\n      expect(credentials1).toHaveLength(1)\n      expect(credentials2).toHaveLength(1)\n\n      expect(credentialsIdAllAsc[0].verifiableCredential.id).toEqual('a')\n      expect(credentialsIdAllAsc[1].verifiableCredential.id).toEqual('b')\n      expect(credentialsIdAllAsc[2].verifiableCredential.id).toEqual('c')\n\n      expect(credentialsIdAllDesc[0].verifiableCredential.id).toEqual('c')\n      expect(credentialsIdAllDesc[1].verifiableCredential.id).toEqual('b')\n      expect(credentialsIdAllDesc[2].verifiableCredential.id).toEqual('a')\n\n      expect(credentialsAllDesc[0].verifiableCredential.issuanceDate).toEqual(credentials1[0].verifiableCredential.issuanceDate)\n      expect(credentialsAllDesc[1].verifiableCredential.issuanceDate).toEqual(credentials2[0].verifiableCredential.issuanceDate)\n\n      expect(credentialsAllDesc[0].verifiableCredential.issuanceDate).toEqual(credentialsAllAsc[2].verifiableCredential.issuanceDate)\n      expect(credentialsAllDesc[1].verifiableCredential.issuanceDate).toEqual(credentialsAllAsc[1].verifiableCredential.issuanceDate)\n      expect(credentialsAllDesc[2].verifiableCredential.issuanceDate).toEqual(credentialsAllAsc[0].verifiableCredential.issuanceDate)\n\n      expect(new Date(credentials1[0].verifiableCredential.issuanceDate).getTime())\n      .toBeGreaterThan(new Date(credentials2[0].verifiableCredential.issuanceDate).getTime())\n\n      expect(new Date(credentials4[0].verifiableCredential.issuanceDate).getTime())\n      .toBeGreaterThan(new Date(credentials3[0].verifiableCredential.issuanceDate).getTime())\n    })\n\n    it('should be able to delete credential', async () => {\n      const findOptions: FindCredentialsArgs = { where: [{ column: 'issuer', value: [identifier.did] }] }\n      const credentials = await agent.dataStoreORMGetVerifiableCredentials(findOptions)\n      expect(credentials).toHaveLength(3)\n\n      const result = await agent.dataStoreDeleteVerifiableCredential({ hash: credentials[0].hash })\n      expect(result).toEqual(true)\n\n      const credentials2 = await agent.dataStoreORMGetVerifiableCredentials(findOptions)\n      expect(credentials2).toHaveLength(2)\n    })\n  })\n}\n"
  },
  {
    "path": "__tests__/shared/utils.ts",
    "content": "// noinspection ES6PreferShortImport\n\nimport {\n  IAgentOptions,\n  IDIDManager,\n  IResolver,\n  MinimalImportableKey,\n  TAgent,\n} from '../../packages/core-types/src'\nimport { getChainId, mapIdentifierKeysToDoc, resolveDidOrThrow } from '../../packages/utils/src'\n\ntype ConfiguredAgent = TAgent<IResolver & IDIDManager>\n\nexport default (testContext: {\n  getAgent: (options?: IAgentOptions) => ConfiguredAgent\n  setup: (options?: IAgentOptions) => Promise<boolean>\n  tearDown: () => Promise<boolean>\n}) => {\n  describe('utilities', () => {\n    let agent: ConfiguredAgent\n\n    beforeAll(async () => {\n      await testContext.setup()\n      agent = testContext.getAgent()\n      return true\n    })\n    afterAll(testContext.tearDown)\n\n    it('should get chainId for ethr did', async () => {\n      const didUrl = 'did:ethr:ganache:0xb09b66026ba5909a7cfe99b76875431d2b8d5190'\n      const didDoc = await resolveDidOrThrow(didUrl, { agent })\n      if (didDoc.verificationMethod) {\n        const chainId = getChainId(didDoc.verificationMethod[0])\n        expect(chainId).toEqual(1337)\n      }\n    })\n\n    it('should map identifier keys to did doc', async () => {\n      const account = `0xb09b66026ba5909a7cfe99b76875431d2b8d5190`\n      const did = `did:ethr:ganache:${account}`\n      const controllerKeyId = `metamask-${account}`\n      await agent.didManagerImport({\n        did,\n        provider: 'did:ethr',\n        controllerKeyId,\n        keys: [\n          {\n            kid: controllerKeyId,\n            type: 'Secp256k1',\n            kms: 'web3',\n            privateKeyHex: '',\n            publicKeyHex: '',\n            meta: {\n              account,\n              provider: 'metamask',\n              algorithms: ['eth_signMessage', 'eth_signTypedData'],\n            },\n          } as MinimalImportableKey,\n        ],\n      })\n\n      const identifier = await agent.didManagerGet({ did })\n      const extendedKeys = await mapIdentifierKeysToDoc(identifier, 'verificationMethod', { agent })\n      expect(extendedKeys[0].meta.verificationMethod?.blockchainAccountId?.toLocaleLowerCase()).toEqual(\n        `eip155:1337:${account}`,\n      )\n    })\n\n    it('should verify JWT credential signed by did:peer (multibase + multicodec) (github #1248)', async () => {\n      // did:peer uses publicKeyMultibase\n      const issuer = await agent.didManagerCreate({\n        provider: 'did:peer',\n        options: {\n          num_algo: 0,\n        },\n      })\n      const payload = {\n        issuer: issuer.did,\n        credentialSubject: {\n          nothing: 'else matters',\n        },\n      }\n      const credential = await agent.createVerifiableCredential({\n        credential: payload,\n        proofFormat: 'jwt',\n      })\n\n      const verifyResult = await agent.verifyCredential({ credential })\n      expect(verifyResult.verified).toBeTruthy()\n    })\n  })\n}\n"
  },
  {
    "path": "__tests__/shared/verifiableDataEIP712.ts",
    "content": "// noinspection ES6PreferShortImport\n\nimport {\n  ICredentialPlugin,\n  IDataStore,\n  IDataStoreORM,\n  IDIDManager,\n  IIdentifier,\n  TAgent,\n  VerifiableCredential,\n  VerifiablePresentation,\n} from '../../packages/core-types/src'\n\ntype ConfiguredAgent = TAgent<\n  IDIDManager & ICredentialPlugin & IDataStore & IDataStoreORM\n>\n\nexport default (testContext: {\n  getAgent: () => ConfiguredAgent\n  setup: () => Promise<boolean>\n  tearDown: () => Promise<boolean>\n}) => {\n  describe('creating Verifiable Credentials in EIP712', () => {\n    let agent: ConfiguredAgent\n    let identifier: IIdentifier\n    let verifiableCredential: VerifiableCredential\n    let verifiablePresentation: VerifiablePresentation\n\n    beforeAll(async () => {\n      await testContext.setup()\n      agent = testContext.getAgent()\n      identifier = await agent.didManagerCreate({\n        kms: 'local',\n        provider: 'did:pkh'\n      })\n    })\n    afterAll(testContext.tearDown)\n\n    it('should create identifier', async () => {\n      expect(identifier).toHaveProperty('did')\n      expect(identifier?.keys[0]?.meta?.algorithms).toContain('eth_signTypedData')\n    })\n\n    it('should create verifiable credential with EthereumEip712Signature2021 proof type', async () => {\n      verifiableCredential = await agent.createVerifiableCredential({\n        credential: {\n          issuer: { id: identifier.did },\n          '@context': ['https://www.w3.org/2018/credentials/v1', 'https://example.com/1/2/3'],\n          type: ['VerifiableCredential', 'Custom'],\n          issuanceDate: new Date().toISOString(),\n          credentialSubject: {\n            id: 'did:web:example.com',\n            you: 'Rock',\n          },\n        },\n        proofFormat: 'EthereumEip712Signature2021',\n      })\n\n      expect(verifiableCredential).toHaveProperty('proof.proofValue')\n      expect(verifiableCredential['@context']).toEqual([\n        'https://www.w3.org/2018/credentials/v1',\n        'https://example.com/1/2/3',\n      ])\n      expect(verifiableCredential['type']).toEqual(['VerifiableCredential', 'Custom'])\n\n      const hash = await agent.dataStoreSaveVerifiableCredential({ verifiableCredential })\n      expect(typeof hash).toEqual('string')\n\n      const verifiableCredential2 = await agent.dataStoreGetVerifiableCredential({ hash })\n      expect(verifiableCredential).toEqual(verifiableCredential2)\n    })\n\n    it('should verify credential with EthereumEip712Signature2021 proof type', async () => {\n      const result = await agent.verifyCredential({\n        credential: verifiableCredential,\n      })\n\n      expect(result.verified).toEqual(true)\n    })\n\n    it('should create verifiable presentation with EthereumEip712Signature2021 proof type', async () => {\n      const jwt_vc =\n        'eyJhbGciOiJFUzI1NksiLCJ0eXAiOiJKV1QifQ.eyJ2YyI6eyJAY29udGV4dCI6WyJodHRwczovL3d3dy53My5vcmcvMjAxOC9jcmVkZW50aWFscy92MSJdLCJ0eXBlIjpbIlZlcmlmaWFibGVDcmVkZW50aWFsIiwiRGlzY29yZFJvbGUiXSwiY3JlZGVudGlhbFN1YmplY3QiOnsiZGlzY29yZFVzZXJJZCI6IjQxMjgxNDQ4NjMzMjg5OTMzOCIsImRpc2NvcmRVc2VyTmFtZSI6IkFnbmVzIHwgQ29sbGFiLkxhbmQjMjYyMyIsImRpc2NvcmRVc2VyQXZhdGFyIjoiaHR0cHM6Ly9jZG4uZGlzY29yZGFwcC5jb20vYXZhdGFycy80MTI4MTQ0ODYzMzI4OTkzMzgvMTRmMDIwZWY3NTZhMzcyODQyODFlYmJiYThlYTg0YTkud2VicCIsImRpc2NvcmRHdWlsZElkIjoiOTQzMjU2MzA4MTcyMzQ1NDA1IiwiZGlzY29yZEd1aWxkTmFtZSI6IkNvbGxhYkxhbmQgVkMgR2F0ZWQgU2VydmVyIiwiZGlzY29yZEd1aWxkQXZhdGFyIjoiaHR0cHM6Ly9jZG4uZGlzY29yZGFwcC5jb20vaWNvbnMvOTQzMjU2MzA4MTcyMzQ1NDA1L2ZlMmVhMzBkZWIyZTMzMjQyNjVhZGY0Y2U3N2NjZWU2LndlYnAiLCJkaXNjb3JkUm9sZUlkIjoiOTQzMjU4OTY3MDUwNzAyODY5IiwiZGlzY29yZFJvbGVOYW1lIjoiQ29sbGFiTGFuZCBQYXRyb24iLCJkZXNjcmlwdGlvbiI6IkFnbmVzIHwgQ29sbGFiLkxhbmQjMjYyMyBoYXMgcm9sZSBDb2xsYWJMYW5kIFBhdHJvbiBpbiBEaXNjb3JkIGNvbW11bml0eSBDb2xsYWJMYW5kIFZDIEdhdGVkIFNlcnZlciJ9fSwic3ViIjoiNDEyODE0NDg2MzMyODk5MzM4IiwianRpIjoiMDIwMDQ0ZWQtMzkyYi00YjIwLThmY2MtYzgxYWNkNjQzYjc4IiwibmJmIjoxNjQ3MDE5MDgzLCJpc3MiOiJkaWQ6ZXRocjpyaW5rZWJ5OjB4MDJlM2RhMGFjN2VkZmJkNzViYjU1M2Y0YzYxODAxODVjNjQ2ODVkYzhjOWI1ZDBiOTBiZTlmMzdhNzE2MzkzZjNhIn0.N0j805D0Wiwv3hnd8S5sHdRpketHHCmth7G5bVuU4QFX03iwH1dclFD01bbmI3TXnfcLANpQhCINSJDAd9My5g'\n\n      verifiablePresentation = await agent.createVerifiablePresentation({\n        presentation: {\n          holder: identifier.did,\n          '@context': ['https://www.w3.org/2018/credentials/v1', 'https://example.com/1/2/3'],\n          type: ['VerifiablePresentation', 'Custom'],\n          issuanceDate: new Date().toISOString(),\n          verifiableCredential: [jwt_vc],\n        },\n        proofFormat: 'EthereumEip712Signature2021',\n      })\n\n      expect(verifiablePresentation).toHaveProperty('proof.proofValue')\n      expect(verifiablePresentation['@context']).toEqual([\n        'https://www.w3.org/2018/credentials/v1',\n        'https://example.com/1/2/3',\n      ])\n      expect(verifiablePresentation['type']).toEqual(['VerifiablePresentation', 'Custom'])\n\n      const hash = await agent.dataStoreSaveVerifiablePresentation({ verifiablePresentation })\n      expect(typeof hash).toEqual('string')\n\n      const vp2 = await agent.dataStoreGetVerifiablePresentation({ hash })\n      expect(verifiablePresentation).toEqual(vp2)\n    })\n\n    it.todo('should throw error when trying to sign presentation with unsuported attributes')\n\n    it('should verify presentation with EthereumEip712Signature2021 proof type', async () => {\n      const result = await agent.verifyPresentation({\n        presentation: verifiablePresentation,\n      })\n\n      expect(result.verified).toEqual(true)\n    })\n  })\n}\n"
  },
  {
    "path": "__tests__/shared/verifiableDataJWT.ts",
    "content": "// noinspection ES6PreferShortImport\n\nimport {\n  ICredentialPlugin,\n  IDataStore,\n  IDataStoreORM,\n  IDIDManager,\n  IIdentifier,\n  TAgent,\n  TKeyType,\n  VerifiableCredential,\n  VerifiablePresentation,\n} from '../../packages/core-types/src'\nimport { decodeJWT } from 'did-jwt'\nimport { VC_JWT_ERROR } from 'did-jwt-vc'\n\ntype ConfiguredAgent = TAgent<IDIDManager & ICredentialPlugin & IDataStore & IDataStoreORM>\n\nexport default (testContext: {\n  getAgent: () => ConfiguredAgent\n  setup: () => Promise<boolean>\n  tearDown: () => Promise<boolean>\n}) => {\n  describe('creating Verifiable Credentials in JWT', () => {\n    let agent: ConfiguredAgent\n    let identifier: IIdentifier\n\n    beforeAll(async () => {\n      await testContext.setup()\n      agent = testContext.getAgent()\n      identifier = await agent.didManagerCreate({ kms: 'local', provider: 'did:key' })\n    })\n    afterAll(testContext.tearDown)\n\n    it('should create verifiable credential in JWT', async () => {\n      const verifiableCredential = await agent.createVerifiableCredential({\n        credential: {\n          issuer: { id: identifier.did },\n          '@context': ['https://www.w3.org/2018/credentials/v1', 'https://example.com/1/2/3'],\n          type: ['VerifiableCredential', 'Custom'],\n          issuanceDate: new Date().toISOString(),\n          credentialSubject: {\n            id: 'did:web:example.com',\n            you: 'Rock',\n          },\n        },\n        proofFormat: 'jwt',\n      })\n\n      expect(verifiableCredential).toHaveProperty('proof.jwt')\n      expect(verifiableCredential['@context']).toEqual([\n        'https://www.w3.org/2018/credentials/v1',\n        'https://example.com/1/2/3',\n      ])\n      expect(verifiableCredential['type']).toEqual(['VerifiableCredential', 'Custom'])\n\n      const hash = await agent.dataStoreSaveVerifiableCredential({ verifiableCredential })\n      expect(typeof hash).toEqual('string')\n\n      const verifiableCredential2 = await agent.dataStoreGetVerifiableCredential({ hash })\n      expect(verifiableCredential).toEqual(verifiableCredential2)\n    })\n\n    it('should create verifiable credential (simple)', async () => {\n      const verifiableCredential = await agent.createVerifiableCredential({\n        credential: {\n          issuer: { id: identifier.did },\n          type: ['Example'],\n          credentialSubject: {\n            id: 'did:web:example.com',\n            you: 'Rock',\n          },\n        },\n        proofFormat: 'jwt',\n      })\n\n      expect(verifiableCredential).toHaveProperty('proof.jwt')\n      expect(verifiableCredential).toHaveProperty('issuanceDate')\n      expect(verifiableCredential['@context']).toEqual(['https://www.w3.org/2018/credentials/v1'])\n      expect(verifiableCredential['type']).toEqual(['VerifiableCredential', 'Example'])\n\n      const token = verifiableCredential.proof.jwt\n      const { payload } = decodeJWT(token)\n      expect(payload.vc.credentialSubject.id).not.toBeDefined()\n    })\n\n    it('should create verifiable credential (simple) using did:jwk identifier', async () => {\n      const ident = await agent.didManagerCreate({\n        kms: 'local',\n        provider: 'did:jwk',\n      })\n      const verifiableCredential = await agent.createVerifiableCredential({\n        credential: {\n          issuer: { id: ident.did },\n          type: ['Example'],\n          credentialSubject: {\n            id: 'did:web:example.com',\n            you: 'Rock',\n          },\n        },\n        proofFormat: 'jwt',\n      })\n      const verifyResult = await agent.verifyCredential({ credential: verifiableCredential })\n\n      expect(verifyResult.verified).toBe(true)\n      expect(verifiableCredential).toHaveProperty('proof.jwt')\n      expect(verifiableCredential).toHaveProperty('issuanceDate')\n      expect(verifiableCredential['@context']).toEqual(['https://www.w3.org/2018/credentials/v1'])\n      expect(verifiableCredential['type']).toEqual(['VerifiableCredential', 'Example'])\n\n      const token = verifiableCredential.proof.jwt\n      const { payload } = decodeJWT(token)\n      expect(payload.vc.credentialSubject.id).not.toBeDefined()\n    })\n\n    it('should create verifiable credential keeping original fields', async () => {\n      expect.assertions(5)\n      const verifiableCredential = await agent.createVerifiableCredential({\n        credential: {\n          issuer: { id: identifier.did },\n          type: ['Example'],\n          credentialSubject: {\n            id: 'did:web:example.com',\n            you: 'Rock',\n          },\n        },\n        proofFormat: 'jwt',\n        removeOriginalFields: false,\n      })\n\n      expect(verifiableCredential).toHaveProperty('proof.jwt')\n      expect(verifiableCredential).toHaveProperty('issuanceDate')\n      expect(verifiableCredential['@context']).toEqual(['https://www.w3.org/2018/credentials/v1'])\n      expect(verifiableCredential['type']).toEqual(['VerifiableCredential', 'Example'])\n\n      const token = verifiableCredential.proof.jwt\n      const { payload } = decodeJWT(token)\n      expect(payload.vc.credentialSubject.id).toEqual('did:web:example.com')\n    })\n\n    it('should create verifiable presentation', async () => {\n      const verifiableCredential = await agent.createVerifiableCredential({\n        credential: {\n          issuer: { id: identifier.did },\n          '@context': ['https://www.w3.org/2018/credentials/v1'],\n          type: ['VerifiableCredential'],\n          issuanceDate: new Date().toISOString(),\n          credentialSubject: {\n            id: 'did:web:example.com',\n            you: 'Rock',\n          },\n        },\n        proofFormat: 'jwt',\n      })\n\n      const verifiablePresentation = await agent.createVerifiablePresentation({\n        presentation: {\n          holder: identifier.did,\n          verifier: [],\n          '@context': ['https://www.w3.org/2018/credentials/v1', 'https://example.com/1/2/3'],\n          type: ['VerifiablePresentation', 'Custom'],\n          issuanceDate: new Date().toISOString(),\n          verifiableCredential: [verifiableCredential],\n        },\n        proofFormat: 'jwt',\n      })\n\n      expect(verifiablePresentation).toHaveProperty('proof.jwt')\n      expect(verifiablePresentation['@context']).toEqual([\n        'https://www.w3.org/2018/credentials/v1',\n        'https://example.com/1/2/3',\n      ])\n      expect(verifiablePresentation['type']).toEqual(['VerifiablePresentation', 'Custom'])\n\n      const hash = await agent.dataStoreSaveVerifiablePresentation({ verifiablePresentation })\n      expect(typeof hash).toEqual('string')\n\n      const verifiablePresentation2 = await agent.dataStoreGetVerifiablePresentation({ hash })\n      expect(verifiablePresentation).toEqual(verifiablePresentation2)\n    })\n\n    it('should create verifiable presentation (simple)', async () => {\n      const verifiableCredential = await agent.createVerifiableCredential({\n        credential: {\n          issuer: { id: identifier.did },\n          type: ['Example'],\n          credentialSubject: {\n            id: 'did:web:example.com',\n            you: 'Rock',\n          },\n        },\n        proofFormat: 'jwt',\n      })\n\n      const verifiablePresentation = await agent.createVerifiablePresentation({\n        presentation: {\n          holder: identifier.did,\n          type: ['Example'],\n          verifier: [],\n          verifiableCredential: [verifiableCredential],\n        },\n        proofFormat: 'jwt',\n      })\n\n      expect(verifiablePresentation).toHaveProperty('proof.jwt')\n      expect(verifiablePresentation['@context']).toEqual(['https://www.w3.org/2018/credentials/v1'])\n      expect(verifiablePresentation['type']).toEqual(['VerifiablePresentation', 'Example'])\n\n      const hash = await agent.dataStoreSaveVerifiablePresentation({ verifiablePresentation })\n      expect(typeof hash).toEqual('string')\n\n      const verifiablePresentation2 = await agent.dataStoreGetVerifiablePresentation({ hash })\n      expect(verifiablePresentation).toEqual(verifiablePresentation2)\n\n      const token = verifiablePresentation.proof.jwt\n      const { payload } = decodeJWT(token)\n      expect(payload.holder).not.toBeDefined()\n    })\n\n    it('should create verifiable presentation (simple) keeping original fields', async () => {\n      const verifiableCredential = await agent.createVerifiableCredential({\n        credential: {\n          issuer: { id: identifier.did },\n          type: ['Example'],\n          credentialSubject: {\n            id: 'did:web:example.com',\n            you: 'Rock',\n          },\n        },\n        proofFormat: 'jwt',\n      })\n\n      const verifiablePresentation = await agent.createVerifiablePresentation({\n        presentation: {\n          holder: identifier.did,\n          type: ['Example'],\n          verifier: [],\n          verifiableCredential: [verifiableCredential],\n        },\n        proofFormat: 'jwt',\n        removeOriginalFields: false,\n      })\n\n      expect(verifiablePresentation).toHaveProperty('proof.jwt')\n      expect(verifiablePresentation['@context']).toEqual(['https://www.w3.org/2018/credentials/v1'])\n      expect(verifiablePresentation['type']).toEqual(['VerifiablePresentation', 'Example'])\n\n      const token = verifiablePresentation.proof.jwt\n      const { payload } = decodeJWT(token)\n      expect(payload.holder).toEqual(identifier.did)\n    })\n\n    it('should query for credentials', async () => {\n      const allCredentials = await agent.dataStoreORMGetVerifiableCredentials({})\n      expect(allCredentials[0]).toHaveProperty('hash')\n      expect(allCredentials[0]).toHaveProperty('verifiableCredential')\n      const credentialCount = await agent.dataStoreORMGetVerifiableCredentialsCount()\n      expect(allCredentials.length).toEqual(credentialCount)\n    })\n\n    it('should query for presentations', async () => {\n      const allPresentations = await agent.dataStoreORMGetVerifiablePresentations({})\n      expect(allPresentations[0]).toHaveProperty('hash')\n      expect(allPresentations[0]).toHaveProperty('verifiablePresentation')\n      const presentationCount = await agent.dataStoreORMGetVerifiablePresentationsCount()\n      expect(allPresentations.length).toEqual(presentationCount)\n    })\n\n    it('should throw error for non existing verifiable credential', async () => {\n      await expect(\n        agent.dataStoreGetVerifiableCredential({\n          hash: 'foobar',\n        }),\n      ).rejects.toThrow('Verifiable credential not found')\n    })\n\n    it('should throw error for non existing verifiable presentation', async () => {\n      await expect(\n        agent.dataStoreGetVerifiablePresentation({\n          hash: 'foobar',\n        }),\n      ).rejects.toThrow('Verifiable presentation not found')\n    })\n\n    describe('using testvectors', () => {\n      const importedDID = {\n        did: 'did:ethr:sepolia:0x03155ee0cbefeecd80de63a62b4ed8f0f97ac22a58f76a265903b9acab79bf018c',\n        provider: 'did:ethr:sepolia',\n        controllerKeyId:\n          '04155ee0cbefeecd80de63a62b4ed8f0f97ac22a58f76a265903b9acab79bf018c7037e2bd897812170c92a4c978d6a10481491a37299d74c4bd412a111a4ac875',\n        keys: [\n          {\n            kid: '04155ee0cbefeecd80de63a62b4ed8f0f97ac22a58f76a265903b9acab79bf018c7037e2bd897812170c92a4c978d6a10481491a37299d74c4bd412a111a4ac875',\n            kms: 'local',\n            type: <TKeyType>'Secp256k1',\n            publicKeyHex:\n              '04155ee0cbefeecd80de63a62b4ed8f0f97ac22a58f76a265903b9acab79bf018c7037e2bd897812170c92a4c978d6a10481491a37299d74c4bd412a111a4ac875',\n            privateKeyHex: '31d1ec15ff8110442012fef0d1af918c0e09b2e2ab821bba52ecc85f8655ec63',\n          },\n        ],\n        services: [],\n      }\n\n      beforeAll(async () => {\n        await agent.didManagerImport(importedDID)\n      })\n\n      it('signs JWT with ES256K', async () => {\n        const credentialInput = {\n          credentialSubject: { id: 'did:example:subject', name: 'Alice' },\n          issuer: { id: importedDID.did },\n          type: ['Example'],\n        }\n        const { proof, issuanceDate, ...comparableOutput } = await agent.createVerifiableCredential({\n          credential: credentialInput,\n          proofFormat: 'jwt',\n          save: false,\n          removeOriginalFields: true,\n        })\n        expect(comparableOutput).toEqual({\n          credentialSubject: { name: 'Alice', id: 'did:example:subject' },\n          issuer: {\n            id: 'did:ethr:sepolia:0x03155ee0cbefeecd80de63a62b4ed8f0f97ac22a58f76a265903b9acab79bf018c',\n          },\n          type: ['VerifiableCredential', 'Example'],\n          '@context': ['https://www.w3.org/2018/credentials/v1'],\n        })\n      })\n    })\n\n    describe('credential verification policies', () => {\n      let credential: VerifiableCredential\n\n      beforeAll(async () => {\n        const issuanceDate = '2019-08-19T09:15:20.000Z' // 1566206120\n        const expirationDate = '2019-08-20T10:42:31.000Z' // 1566297751\n        credential = await agent.createVerifiableCredential({\n          proofFormat: 'jwt',\n          credential: {\n            issuer: identifier.did,\n            issuanceDate,\n            expirationDate,\n            credentialSubject: {\n              hello: 'world',\n            },\n          },\n        })\n      })\n\n      it('can verify credential at a particular time', async () => {\n        const result = await agent.verifyCredential({ credential })\n        expect(result.verified).toBe(false)\n        expect(result?.error?.errorCode).toEqual(VC_JWT_ERROR.INVALID_JWT)\n\n        const result2 = await agent.verifyCredential({\n          credential,\n          policies: { now: 1566297000 },\n        })\n        expect(result2.verified).toBe(true)\n      })\n\n      it('can override expiry check', async () => {\n        const result = await agent.verifyCredential({\n          credential,\n          policies: { expirationDate: false },\n        })\n        expect(result.verified).toBe(true)\n      })\n\n      it('can override issuance check', async () => {\n        const result = await agent.verifyCredential({\n          credential,\n          policies: { issuanceDate: false, now: 1565000000 },\n        })\n        expect(result.verified).toBe(true)\n      })\n\n      it('can override audience check', async () => {\n        const cred = await agent.createVerifiableCredential({\n          proofFormat: 'jwt',\n          credential: {\n            issuer: identifier.did,\n            aud: 'override me',\n            credentialSubject: {\n              hello: 'world',\n            },\n          },\n        })\n        const result = await agent.verifyCredential({ credential: cred })\n        expect(result.verified).toBe(false)\n        expect(result.error?.errorCode).toEqual(VC_JWT_ERROR.INVALID_AUDIENCE)\n\n        const result2 = await agent.verifyCredential({ credential: cred, policies: { audience: false } })\n        expect(result2.verified).toBe(true)\n      })\n\n      it('can override credentialStatus check', async () => {\n        const cred = await agent.createVerifiableCredential({\n          proofFormat: 'jwt',\n          credential: {\n            issuer: identifier.did,\n            credentialSubject: {\n              hello: 'world',\n            },\n            credentialStatus: {\n              id: 'override:me',\n              type: 'ThisMethodDoesNotExist2022',\n            },\n          },\n        })\n        await expect(agent.verifyCredential({ credential: cred })).rejects.toThrow(/^invalid_setup:/)\n\n        const result2 = await agent.verifyCredential({\n          credential: cred,\n          policies: { credentialStatus: false },\n        })\n        expect(result2.verified).toBe(true)\n      })\n    })\n\n    describe('presentation verification policies', () => {\n      let credential: VerifiableCredential\n      let presentation: VerifiablePresentation\n\n      beforeAll(async () => {\n        const issuanceDate = '2019-08-19T09:15:20.000Z' // 1566206120\n        const expirationDate = '2019-08-20T10:42:31.000Z' // 1566297751\n        credential = await agent.createVerifiableCredential({\n          proofFormat: 'jwt',\n          credential: {\n            issuer: identifier.did,\n            credentialSubject: {\n              hello: 'world',\n            },\n          },\n        })\n        presentation = await agent.createVerifiablePresentation({\n          proofFormat: 'jwt',\n          presentation: {\n            holder: identifier.did,\n            verifiableCredential: [credential],\n            issuanceDate,\n            expirationDate,\n          },\n        })\n      })\n\n      it('can verify presentation at a particular time', async () => {\n        const result = await agent.verifyPresentation({ presentation })\n        expect(result.verified).toBe(false)\n        expect(result?.error?.errorCode).toEqual(VC_JWT_ERROR.INVALID_JWT)\n\n        const result2 = await agent.verifyPresentation({\n          presentation,\n          policies: { now: 1566297000 },\n        })\n        expect(result2.verified).toBe(true)\n      })\n\n      it('can override expiry check', async () => {\n        const result = await agent.verifyPresentation({\n          presentation,\n          policies: { expirationDate: false },\n        })\n        expect(result.verified).toBe(true)\n      })\n\n      it('can override issuance check', async () => {\n        const result = await agent.verifyPresentation({\n          presentation,\n          policies: { issuanceDate: false, now: 1565000000 },\n        })\n        expect(result.verified).toBe(true)\n      })\n\n      it('can override audience check', async () => {\n        const pres = await agent.createVerifiablePresentation({\n          proofFormat: 'jwt',\n          presentation: {\n            holder: identifier.did,\n            verifiableCredential: [credential],\n          },\n          challenge: '1234',\n          domain: 'example.com',\n        })\n        const result = await agent.verifyPresentation({ presentation: pres })\n        expect(result.verified).toBe(false)\n        expect(result.error?.errorCode).toEqual(VC_JWT_ERROR.INVALID_AUDIENCE)\n\n        const result2 = await agent.verifyPresentation({\n          presentation: pres,\n          policies: { audience: false },\n        })\n        expect(result2.verified).toBe(true)\n      })\n    })\n  })\n}\n"
  },
  {
    "path": "__tests__/shared/verifiableDataLD.ts",
    "content": "// noinspection ES6PreferShortImport\n\nimport {\n  ICredentialPlugin,\n  IDataStore,\n  IDataStoreORM,\n  IDIDManager,\n  IIdentifier,\n  IMessageHandler,\n  TAgent,\n} from '../../packages/core-types/src'\nimport { IDIDComm } from '../../packages/did-comm/src'\n// @ts-ignore\nimport nock from 'nock'\n\ntype ConfiguredAgent = TAgent<\n  IDIDManager & ICredentialPlugin & IDataStore & IDataStoreORM & IDIDComm & IMessageHandler\n>\n\nexport default (testContext: {\n  getAgent: () => ConfiguredAgent\n  setup: () => Promise<boolean>\n  tearDown: () => Promise<boolean>\n}) => {\n  describe('creating Verifiable Credentials in LD', () => {\n    let agent: ConfiguredAgent\n    let didEthrIdentifier: IIdentifier\n    let didKeyIdentifier: IIdentifier\n    let pkhIdentifier: IIdentifier\n    let storedCredentialHash: string\n    let storedPkhCredentialHash: string\n    let challenge: string\n\n    beforeAll(async () => {\n      await testContext.setup()\n      agent = testContext.getAgent()\n      challenge = 'TEST_CHALLENGE_STRING'\n      didEthrIdentifier = await agent.didManagerCreate({ kms: 'local', provider: 'did:ethr:ganache' })\n      didKeyIdentifier = await agent.didManagerCreate({ kms: 'local', provider: 'did:key' })\n      pkhIdentifier = await agent.didManagerCreate({\n        kms: 'local',\n        provider: 'did:pkh',\n        options: { chainId: '1' },\n      })\n    })\n    afterAll(testContext.tearDown)\n\n    it('should create verifiable credential in LD', async () => {\n      const verifiableCredential = await agent.createVerifiableCredential({\n        credential: {\n          issuer: { id: didEthrIdentifier.did },\n          '@context': ['https://www.w3.org/2018/credentials/v1', 'https://veramo.io/contexts/profile/v1'],\n          type: ['VerifiableCredential', 'Profile'],\n          issuanceDate: new Date().toISOString(),\n          credentialSubject: {\n            name: 'Martin, the great',\n          },\n        },\n        save: false,\n        proofFormat: 'lds',\n      })\n\n      // Check credential:\n      expect(verifiableCredential).toHaveProperty('proof')\n      expect(verifiableCredential).toHaveProperty('proof.jws')\n      expect(verifiableCredential.proof.verificationMethod).toEqual(`${didEthrIdentifier.did}#controller`)\n\n      expect(verifiableCredential['@context']).toEqual([\n        'https://www.w3.org/2018/credentials/v1',\n        'https://veramo.io/contexts/profile/v1',\n        'https://w3id.org/security/suites/secp256k1recovery-2020/v2',\n      ])\n      expect(verifiableCredential['type']).toEqual(['VerifiableCredential', 'Profile'])\n\n      storedCredentialHash = await agent.dataStoreSaveVerifiableCredential({ verifiableCredential })\n\n      const verifiableCredential2 = await agent.dataStoreGetVerifiableCredential({\n        hash: storedCredentialHash,\n      })\n      expect(verifiableCredential).toEqual(verifiableCredential2)\n    })\n\n    it('should verify a verifiable credential in LD', async () => {\n      const verifiableCredential = await agent.dataStoreGetVerifiableCredential({\n        hash: storedCredentialHash,\n      })\n\n      // check that verification works\n      const result = await agent.verifyCredential({\n        credential: verifiableCredential,\n      })\n\n      expect(result.verified).toEqual(true)\n    })\n\n    it('should handleMessage with VC (non-JWT)', async () => {\n      const verifiableCredential = await agent.dataStoreGetVerifiableCredential({\n        hash: storedCredentialHash,\n      })\n\n      const parsedMessage = await agent.handleMessage({\n        raw: JSON.stringify({\n          body: verifiableCredential,\n          type: 'w3c.vc',\n        }),\n        save: false,\n        metaData: [{ type: 'LDS' }],\n      })\n      expect(typeof parsedMessage.id).toEqual('string')\n    })\n\n    it('should fail handleMessage with wrong VC (non-JWT)', async () => {\n      expect.assertions(1)\n\n      const verifiableCredential = await agent.dataStoreGetVerifiableCredential({\n        hash: storedCredentialHash,\n      })\n\n      // tamper with credential\n      verifiableCredential.credentialSubject.name = 'Martin, the not so greats'\n\n      await expect(\n        agent.handleMessage({\n          raw: JSON.stringify({\n            body: verifiableCredential,\n            type: 'w3c.vc',\n          }),\n          save: false,\n          metaData: [{ type: 'LDS' }],\n        }),\n      ).rejects.toThrow(/Verification error/)\n    })\n\n    it('should sign a verifiable presentation in LD', async () => {\n      const verifiableCredential = await agent.dataStoreGetVerifiableCredential({\n        hash: storedCredentialHash,\n      })\n\n      const verifiablePresentation = await agent.createVerifiablePresentation({\n        presentation: {\n          holder: didEthrIdentifier.did,\n          verifier: [],\n          '@context': ['https://www.w3.org/2018/credentials/v1'],\n          type: ['VerifiablePresentation'],\n          verifiableCredential: [verifiableCredential],\n        },\n        challenge,\n        // TODO: QueryFailedError: SQLITE_CONSTRAINT: NOT NULL constraint failed: presentation.issuanceDate\n        // Currently LD Presentations are NEVER saved. (they have no issuanceDate)\n        save: true,\n        proofFormat: 'lds',\n      })\n\n      expect(verifiablePresentation).toHaveProperty('proof.jws')\n    })\n\n    it('should sign and verify a verifiable presentation in LD', async () => {\n      const verifiableCredential = await agent.dataStoreGetVerifiableCredential({\n        hash: storedCredentialHash,\n      })\n\n      const domain = 'TEST_DOMAIN'\n      const verifiablePresentation = await agent.createVerifiablePresentation({\n        presentation: {\n          holder: didEthrIdentifier.did,\n          verifier: [],\n          '@context': ['https://www.w3.org/2018/credentials/v1'],\n          type: ['VerifiablePresentation'],\n          verifiableCredential: [verifiableCredential],\n        },\n        challenge,\n        domain,\n        proofFormat: 'lds',\n      })\n\n      // console.log(JSON.stringify(verifiablePresentation, null,  2))\n\n      const result = await agent.verifyPresentation({\n        presentation: verifiablePresentation,\n        challenge,\n        domain,\n      })\n\n      expect(result.verified).toEqual(true)\n    })\n\n    it('should handleMessage with VPs (non-JWT)', async () => {\n      const verifiableCredential = await agent.dataStoreGetVerifiableCredential({\n        hash: storedCredentialHash,\n      })\n\n      const verifiablePresentation = await agent.createVerifiablePresentation({\n        presentation: {\n          holder: didEthrIdentifier.did,\n          verifier: [],\n          '@context': ['https://www.w3.org/2018/credentials/v1'],\n          type: ['VerifiablePresentation'],\n          verifiableCredential: [verifiableCredential],\n        },\n        challenge: 'VERAMO',\n        domain: 'VERAMO',\n        proofFormat: 'lds',\n      })\n\n      const parsedMessage = await agent.handleMessage({\n        raw: JSON.stringify({\n          body: verifiablePresentation,\n          type: 'w3c.vp',\n        }),\n        save: false,\n        metaData: [{ type: 'LDS' }],\n      })\n      expect(typeof parsedMessage.id).toEqual('string')\n    })\n\n    it('should create verifiable credential in LD with did:key', async () => {\n      const verifiableCredential = await agent.createVerifiableCredential({\n        credential: {\n          issuer: { id: didKeyIdentifier.did },\n          '@context': ['https://www.w3.org/2018/credentials/v1', 'https://veramo.io/contexts/profile/v1'],\n          type: ['VerifiableCredential', 'Profile'],\n          issuanceDate: new Date().toISOString(),\n          credentialSubject: {\n            id: didKeyIdentifier.did,\n            name: 'Martin, the great',\n          },\n        },\n        proofFormat: 'lds',\n      })\n\n      // Check credential:\n      expect(verifiableCredential).toHaveProperty('proof')\n      const proofValue = verifiableCredential.proof.jws ?? verifiableCredential.proof.proofValue\n      expect(proofValue).toBeDefined()\n      expect(verifiableCredential.proof.verificationMethod).toEqual(\n        `${didKeyIdentifier.did}#${didKeyIdentifier.did.substring(\n          didKeyIdentifier.did.lastIndexOf(':') + 1,\n        )}`,\n      )\n\n      expect(verifiableCredential['@context']).toEqual([\n        'https://www.w3.org/2018/credentials/v1',\n        'https://veramo.io/contexts/profile/v1',\n      ])\n      expect(verifiableCredential['type']).toEqual(['VerifiableCredential', 'Profile'])\n\n      storedCredentialHash = await agent.dataStoreSaveVerifiableCredential({ verifiableCredential })\n      expect(typeof storedCredentialHash).toEqual('string')\n\n      const verifiableCredential2 = await agent.dataStoreGetVerifiableCredential({\n        hash: storedCredentialHash,\n      })\n      expect(verifiableCredential).toEqual(verifiableCredential2)\n    })\n\n    it('should verify a verifiable credential in LD with did:key', async () => {\n      const verifiableCredential = await agent.dataStoreGetVerifiableCredential({\n        hash: storedCredentialHash,\n      })\n\n      const result = await agent.verifyCredential({\n        credential: verifiableCredential,\n      })\n\n      expect(result.verified).toEqual(true)\n    })\n\n    it('should create verifiable credential in LD with did:pkh', async () => {\n      const verifiableCredential = await agent.createVerifiableCredential({\n        credential: {\n          issuer: { id: pkhIdentifier.did },\n          '@context': ['https://www.w3.org/2018/credentials/v1', 'https://veramo.io/contexts/profile/v1'],\n          type: ['VerifiableCredential', 'Profile'],\n          issuanceDate: new Date().toISOString(),\n          credentialSubject: {\n            id: pkhIdentifier.did,\n            name: 'Martin, the great',\n          },\n        },\n        proofFormat: 'lds',\n      })\n\n      // Check credential:\n      expect(verifiableCredential).toHaveProperty('proof')\n      expect(verifiableCredential).toHaveProperty('proof.jws')\n      expect(verifiableCredential['type']).toEqual(['VerifiableCredential', 'Profile'])\n\n      storedPkhCredentialHash = await agent.dataStoreSaveVerifiableCredential({ verifiableCredential })\n      expect(typeof storedPkhCredentialHash).toEqual('string')\n\n      const verifiableCredential2 = await agent.dataStoreGetVerifiableCredential({\n        hash: storedPkhCredentialHash,\n      })\n      expect(verifiableCredential).toEqual(verifiableCredential2)\n    })\n\n    it('should create verifiable credential with external context', async () => {\n      const credential = await agent.createVerifiableCredential({\n        credential: {\n          issuer: { id: pkhIdentifier.did },\n          '@context': [\n            'https://www.w3.org/2018/credentials/v1',\n            'https://veramo.io/contexts/discord-kudos/v1',\n          ],\n          type: ['VerifiableCredential', 'DiscordKudos'],\n          issuanceDate: new Date().toISOString(),\n          credentialSubject: {\n            id: pkhIdentifier.did,\n            kudos: 'Thank you',\n          },\n        },\n        proofFormat: 'lds',\n        fetchRemoteContexts: true,\n      })\n\n      // Check credential:\n      expect(credential).toHaveProperty('proof')\n      expect(credential).toHaveProperty('proof.jws')\n      expect(credential['type']).toEqual(['VerifiableCredential', 'DiscordKudos'])\n\n      const result = await agent.verifyCredential({\n        credential,\n        fetchRemoteContexts: true,\n      })\n      expect(result.verified).toBe(true)\n    })\n\n    it('should create and verify verifiable credential in LD with did:key Ed25519VerificationKey2020', async () => {\n      const iss = await agent.didManagerCreate({ provider: 'did:key', options: { keyType: 'Ed25519' } })\n      const credential = await agent.createVerifiableCredential({\n        credential: {\n          issuer: { id: iss.did },\n          '@context': ['https://www.w3.org/2018/credentials/v1', 'https://veramo.io/contexts/profile/v1'],\n          type: ['VerifiableCredential', 'Profile'],\n          issuanceDate: new Date().toISOString(),\n          credentialSubject: {\n            id: didKeyIdentifier.did,\n            name: 'of the game',\n          },\n        },\n        proofFormat: 'lds',\n        resolutionOptions: {\n          publicKeyFormat: 'Ed25519VerificationKey2020',\n        },\n      })\n\n      // Check credential:\n      expect(credential).toHaveProperty('proof')\n      const proofValue = credential.proof.jws ?? credential.proof.proofValue\n      expect(proofValue).toBeDefined()\n\n      expect(credential.proof.type).toEqual('Ed25519Signature2020')\n\n      const verification = await agent.verifyCredential({\n        credential: credential,\n        resolutionOptions: {\n          publicKeyFormat: 'Ed25519VerificationKey2020',\n        },\n      })\n      expect(verification.verified).toBe(true)\n    })\n\n    describe('credential verification policies', () => {\n      it('can verify credential at a particular time', async () => {\n        const issuanceDate = '2019-08-19T09:15:20.000Z' // 1566206120\n        const expirationDate = '2019-08-20T10:42:31.000Z' // 1566297751\n        let credential = await agent.createVerifiableCredential({\n          proofFormat: 'lds',\n          credential: {\n            issuer: { id: didKeyIdentifier.did },\n            '@context': ['https://veramo.io/contexts/profile/v1'],\n            type: ['Profile'],\n            issuanceDate,\n            expirationDate,\n            credentialSubject: {\n              id: didKeyIdentifier.did,\n              name: 'hello',\n            },\n          },\n          now: 1566206120,\n        })\n\n        const result = await agent.verifyCredential({ credential })\n        expect(result.verified).toBe(false)\n\n        const result2 = await agent.verifyCredential({\n          credential,\n          policies: { now: 1566297000 },\n        })\n        expect(result2.verified).toBe(true)\n      })\n\n      it('can override credentialStatus check', async () => {\n        const cred = await agent.createVerifiableCredential({\n          proofFormat: 'lds',\n          credential: {\n            issuer: { id: didKeyIdentifier.did },\n            '@context': ['https://veramo.io/contexts/profile/v1'],\n            type: ['Profile'],\n            credentialSubject: {\n              id: didKeyIdentifier.did,\n              name: 'hello',\n            },\n            credentialStatus: {\n              id: 'override:me',\n              type: 'ThisMethodDoesNotExist2022',\n            },\n          },\n          now: 1566206120,\n        })\n        await expect(agent.verifyCredential({ credential: cred })).rejects.toThrow(/^invalid_setup:/)\n\n        const result2 = await agent.verifyCredential({\n          credential: cred,\n          policies: { credentialStatus: false },\n        })\n        expect(result2.verified).toBe(true)\n      })\n    })\n  })\n\n  // Mock the external context URL\n  beforeAll(() => {\n    nock('https://veramo.io')\n      .persist() // Allow the mock to be used multiple times\n      .get('/contexts/discord-kudos/v1')\n      .reply(200, {\n        '@context': {\n          'w3ccred': 'https://www.w3.org/2018/credentials#',\n          'schema-id': 'https://veramo.io/contexts/discord-kudos#',\n          DiscordKudos: {\n            '@id': 'schema-id',\n          },\n          kudos: {\n            '@id': 'schema-id:kudos',\n            '@type': 'http://schema.org/Text',\n          },\n          url: {\n            '@id': 'schema-id:url',\n            '@type': 'http://schema.org/Text',\n          },\n          discordUserId: {\n            '@id': 'schema-id:discordUserId',\n            '@type': 'http://schema.org/Text',\n          },\n          discordUserName: {\n            '@id': 'schema-id:discordUserName',\n            '@type': 'http://schema.org/Text',\n          },\n          discordUserAvatar: {\n            '@id': 'schema-id:discordUserAvatar',\n            '@type': 'http://schema.org/URL',\n          },\n          discordAuthorId: {\n            '@id': 'schema-id:discordAuthorId',\n            '@type': 'http://schema.org/Text',\n          },\n          discordAuthorName: {\n            '@id': 'schema-id:discordAuthorName',\n            '@type': 'http://schema.org/Text',\n          },\n          discordAuthorAvatar: {\n            '@id': 'schema-id:discordAuthorAvatar',\n            '@type': 'http://schema.org/URL',\n          },\n          discordChannelId: {\n            '@id': 'schema-id:discordChannelId',\n            '@type': 'http://schema.org/Text',\n          },\n          discordChannelName: {\n            '@id': 'schema-id:discordChannelName',\n            '@type': 'http://schema.org/Text',\n          },\n          discordGuildId: {\n            '@id': 'schema-id:discordGuildId',\n            '@type': 'http://schema.org/Text',\n          },\n          discordGuildName: {\n            '@id': 'schema-id:discordGuildName',\n            '@type': 'http://schema.org/Text',\n          },\n          discordGuildAvatar: {\n            '@id': 'schema-id:discordGuildAvatar',\n            '@type': 'http://schema.org/URL',\n          },\n          '@version': 1.1,\n        },\n      })\n  })\n\n  // Clean up nock after tests\n  afterAll(() => {\n    nock.cleanAll()\n  })\n}\n"
  },
  {
    "path": "__tests__/shared/web3.ts",
    "content": "// noinspection ES6PreferShortImport\n\nimport {\n  IAgentOptions,\n  IDIDManager,\n  IIdentifier,\n  IKeyManager,\n  IResolver,\n  MinimalImportableKey,\n  TAgent,\n  VerifiableCredential,\n} from '../../packages/core-types/src'\n\ntype ConfiguredAgent = TAgent<IResolver & IDIDManager & IKeyManager>\n\nexport default (testContext: {\n  getAgent: (options?: IAgentOptions) => ConfiguredAgent\n  setup: (options?: IAgentOptions) => Promise<boolean>\n  tearDown: () => Promise<boolean>\n}) => {\n  describe('web3', () => {\n    let agent: ConfiguredAgent\n    let identifier: IIdentifier\n    let verifiableCredential: VerifiableCredential\n\n    beforeAll(async () => {\n      await testContext.setup()\n      agent = testContext.getAgent()\n      return true\n    })\n    afterAll(testContext.tearDown)\n\n    it('should import ethers did', async () => {\n      const account = `0x71CB05EE1b1F506fF321Da3dac38f25c0c9ce6E1`\n      const did = `did:ethr:ganache:${account}`\n      const controllerKeyId = `ethers-${account}`\n      identifier = await agent.didManagerImport({\n        did,\n        provider: 'did:ethr',\n        controllerKeyId,\n        keys: [\n          {\n            kid: controllerKeyId,\n            type: 'Secp256k1',\n            kms: 'web3',\n            privateKeyHex: '',\n            publicKeyHex: '',\n            meta: {\n              account,\n              provider: 'ethers',\n              algorithms: ['eth_signMessage', 'eth_signTypedData'],\n            },\n          } as MinimalImportableKey,\n        ],\n      })\n    })\n\n    it('should sign a message', async () => {\n      if (identifier.controllerKeyId) {\n        const signature = await agent.keyManagerSign({\n          data: 'Hello world',\n          keyRef: identifier.controllerKeyId,\n          algorithm: 'eth_signMessage',\n        })\n        expect(signature).toBeTruthy()\n      }\n    })\n\n    it('should create verifiable credential with EthereumEip712Signature2021 proof type', async () => {\n      verifiableCredential = await agent.createVerifiableCredential({\n        credential: {\n          issuer: { id: identifier.did },\n          '@context': ['https://www.w3.org/2018/credentials/v1', 'https://example.com/1/2/3'],\n          type: ['VerifiableCredential', 'Custom'],\n          issuanceDate: new Date().toISOString(),\n          credentialSubject: {\n            id: 'did:web:example.com',\n            you: 'Rock',\n          },\n        },\n        proofFormat: 'EthereumEip712Signature2021',\n      })\n\n      expect(verifiableCredential).toHaveProperty('proof.proofValue')\n      expect(verifiableCredential['@context']).toEqual([\n        'https://www.w3.org/2018/credentials/v1',\n        'https://example.com/1/2/3',\n      ])\n      expect(verifiableCredential['type']).toEqual(['VerifiableCredential', 'Custom'])\n\n      const hash = await agent.dataStoreSaveVerifiableCredential({ verifiableCredential })\n      expect(typeof hash).toEqual('string')\n\n      const verifiableCredential2 = await agent.dataStoreGetVerifiableCredential({ hash })\n      expect(verifiableCredential).toEqual(verifiableCredential2)\n    })\n  })\n}\n"
  },
  {
    "path": "__tests__/shared/webDidFlow.ts",
    "content": "// noinspection ES6PreferShortImport\n\nimport { ICredentialIssuer, IDIDManager, IIdentifier, IKey, TAgent } from '../../packages/core-types/src'\n\ntype ConfiguredAgent = TAgent<IDIDManager & ICredentialIssuer>\n\nexport default (testContext: {\n  getAgent: () => ConfiguredAgent\n  setup: () => Promise<boolean>\n  tearDown: () => Promise<boolean>\n}) => {\n  describe('web did flow', () => {\n    let agent: ConfiguredAgent\n    let serviceIdentifier: IIdentifier\n    let serviceIdentifierKey: IKey\n    let alice: IIdentifier\n    let bob: IIdentifier\n\n    beforeAll(async () => {\n      await testContext.setup()\n      agent = testContext.getAgent()\n    })\n    afterAll(testContext.tearDown)\n\n    it('should create service identifier', async () => {\n      serviceIdentifier = await agent.didManagerGetOrCreate({\n        provider: 'did:web',\n        alias: 'webdidflow.example.com',\n      })\n\n      expect(serviceIdentifier.provider).toEqual('did:web')\n      expect(serviceIdentifier.alias).toEqual('webdidflow.example.com')\n      expect(serviceIdentifier.did).toEqual('did:web:webdidflow.example.com')\n      serviceIdentifierKey = serviceIdentifier.keys[0]\n    })\n\n    it('should add service endpoint', async () => {\n      const service = {\n        id: 'did:web:webdidflow.example.com#1',\n        type: 'Messaging',\n        description: 'Post any RAW message here',\n        serviceEndpoint: 'https://example.com/messaging',\n      }\n\n      await agent.didManagerAddService({\n        did: 'did:web:webdidflow.example.com',\n        service,\n      })\n\n      const testIdentifier = await agent.didManagerGet({ did: 'did:web:webdidflow.example.com' })\n      expect(testIdentifier.services[0]).toEqual(service)\n    })\n\n    it('should get existing service identifier', async () => {\n      const testIdentifier = await agent.didManagerGetOrCreate({\n        provider: 'did:web',\n        alias: 'webdidflow.example.com',\n      })\n\n      expect(testIdentifier.keys[0]).toEqual(serviceIdentifierKey)\n      expect(testIdentifier.provider).toEqual('did:web')\n      expect(testIdentifier.alias).toEqual('webdidflow.example.com')\n      expect(testIdentifier.did).toEqual('did:web:webdidflow.example.com')\n    })\n\n    it('should create identifier with alias: alice', async () => {\n      alice = await agent.didManagerGetOrCreate({\n        alias: 'alice',\n      })\n\n      expect(alice.alias).toEqual('alice')\n      expect(alice.did).toBeDefined()\n    })\n\n    it('should create identifier with alias: bob', async () => {\n      bob = await agent.didManagerGetOrCreate({\n        alias: 'bob',\n      })\n\n      expect(bob.alias).toEqual('bob')\n      expect(bob.did).toBeDefined()\n    })\n\n    it('should query identifiers', async () => {\n      const identifiers = await agent.didManagerFind()\n      expect(identifiers.length).toBeGreaterThanOrEqual(3)\n    })\n\n    describe('should create verifiable credential', () => {\n      it('issuer: serviceIdentifier', async () => {\n        const verifiableCredential = await agent.createVerifiableCredential({\n          save: true,\n          credential: {\n            issuer: { id: serviceIdentifier.did },\n            '@context': ['https://www.w3.org/2018/credentials/v1'],\n            type: ['VerifiableCredential', 'Profile'],\n            issuanceDate: new Date().toISOString(),\n            credentialSubject: {\n              id: alice.did,\n              name: 'Alice',\n            },\n          },\n          proofFormat: 'jwt',\n        })\n\n        expect(verifiableCredential.issuer).toEqual({ id: serviceIdentifier.did })\n        expect(verifiableCredential.credentialSubject).toEqual({ id: alice.did, name: 'Alice' })\n        expect(verifiableCredential).toHaveProperty('proof.jwt')\n      })\n\n      it('issuer - Alice, subject - Bob', async () => {\n        const a = await agent.didManagerGetOrCreate({\n          alias: 'alice',\n        })\n\n        const b = await agent.didManagerGetOrCreate({\n          alias: 'bob',\n        })\n\n        const verifiableCredential = await agent.createVerifiableCredential({\n          save: true,\n          credential: {\n            issuer: { id: a.did },\n            '@context': ['https://www.w3.org/2018/credentials/v1'],\n            type: ['VerifiableCredential'],\n            issuanceDate: new Date().toISOString(),\n            credentialSubject: {\n              id: b.did,\n              name: 'Bob',\n            },\n          },\n          proofFormat: 'jwt',\n        })\n\n        expect(verifiableCredential.issuer).toEqual({ id: alice.did })\n        expect(verifiableCredential.credentialSubject).toEqual({ id: bob.did, name: 'Bob' })\n        expect(verifiableCredential).toHaveProperty('proof.jwt')\n      })\n\n      it('should be able to query credentials', async () => {\n        const credentials = await agent.dataStoreORMGetVerifiableCredentials({\n          where: [\n            { column: 'subject', value: [alice.did], op: 'Equal' },\n            { column: 'type', value: ['VerifiableCredential,Profile'], op: 'Equal' },\n          ],\n          order: [{ column: 'issuanceDate', direction: 'DESC' }],\n        })\n\n        expect(credentials.length).toEqual(1)\n      })\n    })\n  })\n}\n"
  },
  {
    "path": "__tests__/utils/json-file-store.ts",
    "content": "// noinspection ES6PreferShortImport\n\nimport {\n  ClaimTableEntry,\n  CredentialTableEntry,\n  DiffCallback,\n  PresentationTableEntry,\n  VeramoJsonCache,\n  VeramoJsonStore,\n} from '../../packages/data-store-json/src'\nimport * as fs from 'fs'\nimport { IIdentifier, IMessage, ManagedKeyInfo } from '../../packages/core-types/src'\nimport { ManagedPrivateKey } from '../../packages/key-manager/src'\n\n/**\n * A utility class that shows how a File based JSON storage system could work.\n * This is not recommended for large databases since every write operation rewrites the entire database.\n */\nexport class JsonFileStore implements VeramoJsonStore {\n  notifyUpdate: DiffCallback\n  dids: Record<string, IIdentifier>\n  keys: Record<string, ManagedKeyInfo>\n  privateKeys: Record<string, ManagedPrivateKey>\n  credentials: Record<string, CredentialTableEntry>\n  claims: Record<string, ClaimTableEntry>\n  presentations: Record<string, PresentationTableEntry>\n  messages: Record<string, IMessage>\n  private file: fs.PathLike\n\n  private constructor(file: fs.PathLike) {\n    this.file = file\n    this.notifyUpdate = async (oldState: VeramoJsonCache, newState: VeramoJsonCache) => {\n      await this.save(newState)\n    }\n    this.dids = {}\n    this.keys = {}\n    this.privateKeys = {}\n    this.credentials = {}\n    this.claims = {}\n    this.presentations = {}\n    this.messages = {}\n  }\n\n  public static async fromFile(file: fs.PathLike): Promise<JsonFileStore> {\n    const store = new JsonFileStore(file)\n    return await store.load()\n  }\n\n  private async load(): Promise<JsonFileStore> {\n    await this.checkFile()\n    const rawCache = await fs.promises.readFile(this.file, { encoding: 'utf8' })\n    let cache: VeramoJsonCache\n    try {\n      cache = JSON.parse(rawCache)\n    } catch (e: any) {\n      cache = {}\n    }\n    ; ({\n      dids: this.dids,\n      keys: this.keys,\n      credentials: this.credentials,\n      claims: this.claims,\n      presentations: this.presentations,\n      messages: this.messages,\n      privateKeys: this.privateKeys,\n    } = {\n      dids: {},\n      keys: {},\n      credentials: {},\n      claims: {},\n      presentations: {},\n      messages: {},\n      privateKeys: {},\n      ...cache,\n    })\n    return this\n  }\n\n  private async save(newState: VeramoJsonCache): Promise<void> {\n    await fs.promises.writeFile(this.file, JSON.stringify(newState), {\n      encoding: 'utf8',\n    })\n  }\n\n  private async checkFile() {\n    const file = await fs.promises.open(this.file, 'w+')\n    await file.close()\n  }\n}\n"
  },
  {
    "path": "__tests__/utils/third.party.types.d.ts",
    "content": "declare module 'ganache-cli'\ndeclare module 'ethr-did-registry'\n"
  },
  {
    "path": "authors.md",
    "content": "# Contributors Highlight \n\n### Veramolabs Team, including former members\n- [Mircea Nistor](https://github.com/mirceanis)\n- [Simonas Karuzas](https://github.com/simonas-notcat)\n- [Nick Reynolds](https://github.com/nickreynolds)\n- [Italo Borsatto](https://github.com/italobb)\n- [Oliver Terbu](https://github.com/awoie)\n- [Jason Healy](https://github.com/jasheal)\n- [Greg Bugyis](https://github.com/gbugyis)\n- [Martin Riedel](https://github.com/rado0x54)\n\nSpecial thanks to the following extraordinary individuals, for their contributions to the Veramo project:\n\n- [Nick L.](https://github.com/nick-verida)\n- [Richard Braman](https://github.com/fhirfly)\n- [Tasos Derisiotis](https://github.com/Eengineer1)\n- [Ron Kreutzer](https://github.com/rkreutzer)\n- [Duranteau Ludovic](https://github.com/duranteau-l-i)\n- [Ilya Nevolin](https://github.com/inevolin)\n- [Andraz](https://github.com/andyv09)\n- [Konstantin Tsabolov](https://github.com/tsabolov)\n- [Emile Baizel](https://github.com/ebaizel)\n- [Moe Jangda](https://github.com/mistermoe)\n- [Martijn de Bruijn](https://github.com/martijndebruijn)\n- [Leo Ribeiro](https://github.com/leordev)\n- [Oriel Steele](https://github.com/OR13)\n- [Trent Larson](https://github.com/trentlarson)\n- [Andres Junge](https://github.com/ajunge)\n- [Roderik van der Veer](https://github.com/roderik)\n- [Jan Christoph Ebersbach](https://github.com/jceb)\n- [Dan Bolser](https://github.com/CholoTook)\n- [Walker Flynn](https://github.com/walfly)\n- [Devraj Singh Rawat](https://github.com/devrajsinghrawat)\n- [Eseoghene Mentie](https://github.com/Eseoghene)\n- [Ilan Olkies](https://github.com/ilanolkies)\n- [Niels Klomp](https://github.com/nklomp)\n"
  },
  {
    "path": "commitlint.config.js",
    "content": "module.exports = {\n  extends: ['@commitlint/config-conventional'],\n  rules: {\n    //    'subject-case': [2, 'always', ['sentence-case']],\n  },\n}\n"
  },
  {
    "path": "docsconfig.json",
    "content": "{\n    \"documentPackages\": [\n        \"core\",\n        \"core-types\",\n        \"credential-eip712\",\n        \"credential-ld\",\n        \"credential-status\",\n        \"credential-w3c\",\n        \"data-store\",\n        \"data-store-json\",\n        \"did-comm\",\n        \"did-discovery\",\n        \"did-jwt\",\n        \"did-manager\",\n        \"did-provider-ethr\",\n        \"did-provider-ion\",\n        \"did-provider-jwk\",\n        \"did-provider-key\",\n        \"did-provider-peer\",\n        \"did-provider-pkh\",\n        \"did-provider-web\",\n        \"did-resolver\",\n        \"key-manager\",\n        \"kms-local\",\n        \"kms-web3\",\n        \"message-handler\",\n        \"remote-client\",\n        \"remote-server\",\n        \"selective-disclosure\",\n        \"url-handler\",\n        \"utils\"\n    ]\n}\n"
  },
  {
    "path": "jest.config.mjs",
    "content": "import { defaults } from 'jest-config'\n\n// @type {import('jest-config').InitialOptions}\nconst config = {\n  rootDir: './',\n  moduleFileExtensions: [...defaults.moduleFileExtensions, 'mts'],\n  collectCoverage: false,\n  collectCoverageFrom: [\n    'packages/**/src/**/*.ts',\n    '!**/examples/**',\n    '!packages/cli/**',\n    '!**/types/**',\n    '!**/build/**',\n    '!**/node_modules/**',\n    '!packages/test-react-app/**',\n    '!packages/test-utils/**',\n  ],\n  coverageReporters: ['json'],\n  coverageDirectory: './coverage',\n  coverageProvider: 'v8',\n  testMatch: ['**/__tests__/**/*.test.ts'],\n  automock: false,\n  // // typescript 5 removes the need to specify relative imports as .js, so we should no longer need this workaround\n  // // but webpack still requires .js specifiers, so we are keeping it for now\n  moduleNameMapper: {\n    '^(\\\\.{1,2}/.*)\\\\.js$': '$1',\n  },\n  transform: {\n    '^.+\\\\.m?tsx?$': [\n      'ts-jest',\n      {\n        useESM: true,\n        tsconfig: './packages/tsconfig.settings.json',\n      },\n    ],\n  },\n  extensionsToTreatAsEsm: ['.ts'],\n  testEnvironment: 'node',\n}\n\nexport default config\n"
  },
  {
    "path": "lerna.json",
    "content": "{\n  \"version\": \"7.0.0\",\n  \"npmClient\": \"pnpm\",\n  \"changelog\": {\n    \"repo\": \"decentralized-identity/veramo\",\n    \"cacheDir\": \".changelog\"\n  },\n  \"command\": {\n    \"publish\": {\n      \"allowBranch\": [\n        \"main\",\n        \"next\",\n        \"master\",\n        \"unstable\"\n      ],\n      \"conventionalCommits\": true,\n      \"gitRemote\": \"origin\",\n      \"message\": \"chore(release): %s [skip ci]\"\n    }\n  }\n}\n"
  },
  {
    "path": "package.json",
    "content": "{\n  \"name\": \"veramo\",\n  \"private\": true,\n  \"scripts\": {\n    \"build\": \"cross-env NODE_OPTIONS=\\\"--experimental-vm-modules --experimental-json-modules\\\" pnpm build:js && pnpm build:api && pnpm build:schema\",\n    \"build:js\": \"pnpm -r --stream build\",\n    \"build:api\": \"pnpm -r --stream extract-api\",\n    \"build:schema\": \"pnpm -r --stream generate-plugin-schema\",\n    \"lint\": \"echo \\\"linting not yet enabled\\\"\",\n    \"test:integration-build\": \"pnpm test:integration-prepare && pnpm test:integration-pretty\",\n    \"test:integration-prepare\": \"cross-env NODE_OPTIONS=--experimental-vm-modules ts-node --project packages/tsconfig.settings.json ./scripts/prepare-integration-tests.ts\",\n    \"test:integration-pretty\": \"prettier --write __tests__/shared/documentationExamples.ts\",\n    \"test:integration\": \"pnpm test:integration-build && pnpm test:ci\",\n    \"test:ci\": \"pnpm test --coverage=true\",\n    \"test\": \"cross-env NODE_OPTIONS=\\\"--experimental-vm-modules --experimental-import-meta-resolve\\\" jest\",\n    \"test:watch\": \"pnpm test --watch --verbose\",\n    \"test:browser\": \"cd packages/test-react-app && pnpm test:browser\",\n    \"veramo\": \"cross-env NODE_NO_WARNINGS=1 ./packages/cli/bin/veramo.js\",\n    \"prettier\": \"prettier --write \\\"{packages,docs,__tests__,!build}/**/*.{ts,js,json,md,yml}\\\"\",\n    \"build-clean\": \"rimraf --glob ./packages/*/build ./packages/*/api ./packages/*/node_modules ./packages/*/tsconfig.tsbuildinfo ./temp ./tmp && jest --clearCache\",\n    \"publish:latest\": \"lerna publish --conventional-commits --include-merged-tags --create-release github --yes --dist-tag latest\",\n    \"publish:next\": \"lerna publish --conventional-prerelease --force-publish --canary --no-git-tag-version --include-merged-tags --preid next --pre-dist-tag next --yes\",\n    \"publish:unstable\": \"lerna publish --conventional-prerelease --force-publish --canary --no-git-tag-version --include-merged-tags --preid unstable --pre-dist-tag unstable --yes\",\n    \"docs\": \"pnpm docs:copy && pnpm docs:build\",\n    \"docs:copy\": \"ts-node --project tsconfig.scripts.json ./scripts/docs-copy.ts\",\n    \"docs:build\": \"ts-node --project tsconfig.scripts.json ./scripts/docs-build.ts && pnpm docs:pretty\",\n    \"docs:pretty\": \"prettier --write docs/**/*.md\"\n  },\n  \"devDependencies\": {\n    \"@jest/globals\": \"29.7.0\",\n    \"@metamask/eth-sig-util\": \"7.0.1\",\n    \"@microsoft/api-documenter\": \"7.26.5\",\n    \"@microsoft/api-extractor\": \"7.49.1\",\n    \"@microsoft/api-extractor-model\": \"7.30.2\",\n    \"@microsoft/tsdoc\": \"0.15.0\",\n    \"@noble/hashes\": \"1.7.1\",\n    \"@stablelib/ed25519\": \"1.0.3\",\n    \"@transmute/credentials-context\": \"0.7.0-unstable.82\",\n    \"@types/express\": \"4.17.21\",\n    \"@types/fs-extra\": \"11.0.4\",\n    \"@types/jest\": \"29.5.12\",\n    \"@types/node\": \"20.17.4\",\n    \"@types/uuid\": \"9.0.8\",\n    \"caip\": \"1.1.0\",\n    \"credential-status\": \"3.0.4\",\n    \"cross-env\": \"7.0.3\",\n    \"did-jwt\": \"8.0.8\",\n    \"did-jwt-vc\": \"4.0.6\",\n    \"did-resolver\": \"4.1.0\",\n    \"ethers\": \"6.13.4\",\n    \"ethr-did-resolver\": \"11.0.3\",\n    \"express\": \"4.21.1\",\n    \"ganache\": \"7.9.2\",\n    \"jest\": \"29.7.0\",\n    \"jest-config\": \"29.7.0\",\n    \"jest-environment-jsdom\": \"29.7.0\",\n    \"jest-environment-node\": \"29.7.0\",\n    \"json-schema\": \"0.4.0\",\n    \"lerna\": \"8.1.2\",\n    \"lerna-changelog\": \"2.2.0\",\n    \"nock\": \"14.0.10\",\n    \"openapi-types\": \"12.1.3\",\n    \"prettier\": \"3.4.2\",\n    \"rimraf\": \"5.0.5\",\n    \"semantic-release\": \"23.1.1\",\n    \"sqlite3\": \"5.1.7\",\n    \"ts-jest\": \"29.4.1\",\n    \"ts-json-schema-generator\": \"1.5.0\",\n    \"ts-node\": \"10.9.2\",\n    \"typeorm\": \"0.3.20\",\n    \"typescript\": \"5.7.3\",\n    \"uint8arrays\": \"5.1.0\",\n    \"uuid\": \"9.0.1\",\n    \"web-did-resolver\": \"2.0.29\"\n  },\n  \"repository\": {\n    \"type\": \"git\",\n    \"url\": \"https://github.com/decentralized-identity/veramo.git\"\n  },\n  \"publishConfig\": {\n    \"access\": \"public\"\n  },\n  \"resolutions\": {\n    \"@types/eslint\": \"^9.0.0\",\n    \"jsonld\": \"npm:@digitalcredentials/jsonld@^6.0.0\",\n    \"node-gyp\": \"^10.0.0\"\n  },\n  \"engines\": {\n    \"node\": \">= 18.0.0\"\n  },\n  \"workspaces\": [\n    \"packages/*\"\n  ]\n}\n"
  },
  {
    "path": "packages/cli/CHANGELOG.md",
    "content": "# Change Log\n\nAll notable changes to this project will be documented in this file.\nSee [Conventional Commits](https://conventionalcommits.org) for commit guidelines.\n\n# [7.0.0](https://github.com/decentralized-identity/veramo/compare/v6.0.2...v7.0.0) (2026-02-11)\n\n\n### Bug Fixes\n\n* **cli:** update @veramo/cli setup and credential example for ICredentialProvider refactor ([#1489](https://github.com/decentralized-identity/veramo/issues/1489)) ([0fa0bdc](https://github.com/decentralized-identity/veramo/commit/0fa0bdcb8baab0fa8097eb5fa8a112974c998e6b)), closes [#1488](https://github.com/decentralized-identity/veramo/issues/1488) [#1395](https://github.com/decentralized-identity/veramo/issues/1395)\n* **deps:** bump ethr-did-resolver to v11 ([#1422](https://github.com/decentralized-identity/veramo/issues/1422)) ([2f0b06d](https://github.com/decentralized-identity/veramo/commit/2f0b06ddcce87dfeea1d5ab843eb33276dac071d))\n* **deps:** update dependency ts-json-schema-generator to v2 ([e690f3c](https://github.com/decentralized-identity/veramo/commit/e690f3c44b6f8e07e64ae612f69c36931b638846))\n* **deps:** update devdeps and bump typeorm to 0.3.20 ([#1272](https://github.com/decentralized-identity/veramo/issues/1272)) ([7d17f37](https://github.com/decentralized-identity/veramo/commit/7d17f37ea7cc4e73a8cdae028681ae1be5c4d11c))\n\n\n### Features\n\n* **credential-w3c:** remove hardcoded proof formats ([#1395](https://github.com/decentralized-identity/veramo/issues/1395)) ([5b7d3fa](https://github.com/decentralized-identity/veramo/commit/5b7d3fad7d2ada4954f8020a6474df13d9fe51dc))\n\n\n### BREAKING CHANGES\n\n* **credential-w3c:** The credential plugins specializing in JSON-LD / EIP712 are no longer top level veramo plugins but are now managed by the `@veramo/credential-w3c` plugin which will be able to use multiple proof formats and multiplex accordingly. The constructor for the `CredentialPlugin` has changed to accept different implementations of proof formats.\n\n\n\n\n\n## [6.0.2](https://github.com/decentralized-identity/veramo/compare/v6.0.1...v6.0.2) (2026-01-16)\n\n**Note:** Version bump only for package @veramo/cli\n\n\n\n\n\n## [6.0.1](https://github.com/decentralized-identity/veramo/compare/v6.0.0...v6.0.1) (2026-01-16)\n\n**Note:** Version bump only for package @veramo/cli\n\n\n\n\n\n# [6.0.0](https://github.com/decentralized-identity/veramo/compare/v5.6.0...v6.0.0) (2024-04-02)\n\n\n### Bug Fixes\n\n* **cli:** remove `revocable` and `send` options from credential create command ([#1345](https://github.com/decentralized-identity/veramo/issues/1345)) ([e1beeaf](https://github.com/decentralized-identity/veramo/commit/e1beeafb289946ee46ce4bacfbd44544b1a5d3d5)), closes [#1342](https://github.com/decentralized-identity/veramo/issues/1342)\n* **cli:** remove interactive prompting on CLI execute command ([#1347](https://github.com/decentralized-identity/veramo/issues/1347)) ([5accc6b](https://github.com/decentralized-identity/veramo/commit/5accc6b60f8a69155842eaeb5aed80fb65d154a1)), closes [#1281](https://github.com/decentralized-identity/veramo/issues/1281)\n* **deps:** update dependency ethr-did-resolver to v10 ([#1291](https://github.com/decentralized-identity/veramo/issues/1291)) ([99c53e5](https://github.com/decentralized-identity/veramo/commit/99c53e52d3e5f5f9c50d7fc20775e519c2e75589)), closes [#1295](https://github.com/decentralized-identity/veramo/issues/1295)\n* **deps:** Update dependency ethr-did-resolver to v9 ([533a9e6](https://github.com/decentralized-identity/veramo/commit/533a9e6870d5a3479a3c61d7d5b85386b706a2ef))\n* export const plugin schemas instead of defaults ([#1327](https://github.com/decentralized-identity/veramo/issues/1327)) ([7896cea](https://github.com/decentralized-identity/veramo/commit/7896ceaf2c79993eee44e46950814bea74bfe647)), closes [#1318](https://github.com/decentralized-identity/veramo/issues/1318) [#1317](https://github.com/decentralized-identity/veramo/issues/1317) [#1315](https://github.com/decentralized-identity/veramo/issues/1315)\n\n\n### Code Refactoring\n\n* generate plugin schemas as TS instead of JSON ([#1315](https://github.com/decentralized-identity/veramo/issues/1315)) ([65c2d4b](https://github.com/decentralized-identity/veramo/commit/65c2d4bc814daa9a3a89f4f7b8e8c6973b8ce2f0)), closes [#1254](https://github.com/decentralized-identity/veramo/issues/1254)\n\n\n### Features\n\n* **cli:** add support for did:jwk and did:peer to CLI ([#1320](https://github.com/decentralized-identity/veramo/issues/1320)) ([3ac343e](https://github.com/decentralized-identity/veramo/commit/3ac343e52dbd744c137bbe610cba9f5409a6100c))\n* **coordinate-mediation:** implement did-comm coordinate-mediation v3.0 ([#1282](https://github.com/decentralized-identity/veramo/issues/1282)) ([462735d](https://github.com/decentralized-identity/veramo/commit/462735d138bc4984c0fcf3f72ca7d49e3187ceb7))\n\n\n### BREAKING CHANGES\n\n* The `plugin.schema.json` files are now generated as `plugin.schema.ts`.\n\n\n\n\n\n# [5.6.0](https://github.com/decentralized-identity/veramo/compare/v5.5.3...v5.6.0) (2024-01-16)\n\n\n### Features\n\n* **remote-client:** allow dynamic headers param for AgentRestClient constructor ([#1314](https://github.com/decentralized-identity/veramo/issues/1314)) ([1b8a0a2](https://github.com/decentralized-identity/veramo/commit/1b8a0a2718dd63492ad3a312a6ebe5f6e7849935)), closes [#1313](https://github.com/decentralized-identity/veramo/issues/1313)\n\n\n\n\n\n## [5.5.3](https://github.com/decentralized-identity/veramo/compare/v5.5.2...v5.5.3) (2023-10-09)\n\n\n### Bug Fixes\n\n* use DIF URLs in packages ([#1271](https://github.com/decentralized-identity/veramo/issues/1271)) ([3dfc601](https://github.com/decentralized-identity/veramo/commit/3dfc6014cdee7902c59d8db76b4c8507b870f227))\n\n\n\n\n\n## [5.5.2](https://github.com/uport-project/veramo/compare/v5.5.1...v5.5.2) (2023-10-06)\n\n**Note:** Version bump only for package @veramo/cli\n\n\n\n\n\n## [5.5.1](https://github.com/uport-project/veramo/compare/v5.5.0...v5.5.1) (2023-09-21)\n\n**Note:** Version bump only for package @veramo/cli\n\n\n\n\n\n# [5.5.0](https://github.com/uport-project/veramo/compare/v5.4.1...v5.5.0) (2023-09-19)\n\n\n### Bug Fixes\n\n* **deps:** update dependency cross-fetch to v4 ([1c14d34](https://github.com/uport-project/veramo/commit/1c14d34f48a51bef373541e84ed89f2f44711406))\n* **deps:** update dependency swagger-ui-express to v5 ([7e070cc](https://github.com/uport-project/veramo/commit/7e070cc487f7f671276fee6a5b99f4d517728f29))\n* **did-provider-key:** use compressed keys for creating Secp256k1 did:key ([#1217](https://github.com/uport-project/veramo/issues/1217)) ([ba8f6f5](https://github.com/uport-project/veramo/commit/ba8f6f5b9b701e57af86491504ecd209ca0c1c1d)), closes [#1213](https://github.com/uport-project/veramo/issues/1213)\n\n\n\n\n\n## [5.4.1](https://github.com/uport-project/veramo/compare/v5.4.0...v5.4.1) (2023-08-04)\n\n\n### Bug Fixes\n\n* **ci:** benign change meant to tag all packages for another patch release ([#1211](https://github.com/uport-project/veramo/issues/1211)) ([41b5c90](https://github.com/uport-project/veramo/commit/41b5c90277171b7b38c5cf49ca01db5cf75b6300))\n\n\n\n\n\n# [5.4.0](https://github.com/uport-project/veramo/compare/v5.3.0...v5.4.0) (2023-08-01)\n\n\n### Features\n\n* **credential-w3c:** allow issuers with query parameters for credentials and presentations ([#1207](https://github.com/uport-project/veramo/issues/1207)) ([688f59d](https://github.com/uport-project/veramo/commit/688f59d6b492bc25bc51bbe73be969d6c30a958d)), closes [#1201](https://github.com/uport-project/veramo/issues/1201)\n* **did-comm:** add support for the AES based content and key encryption algorithms ([#1180](https://github.com/uport-project/veramo/issues/1180)) ([5294a81](https://github.com/uport-project/veramo/commit/5294a812ee578c0712b54f216416c3ef78c848da))\n\n\n\n\n\n# [5.3.0](https://github.com/uport-project/veramo/compare/v5.2.0...v5.3.0) (2023-07-27)\n\n\n### Bug Fixes\n\n* **cli:** prevent `ExperimentalWarning` messages form being printed ([#1186](https://github.com/uport-project/veramo/issues/1186)) ([a2971aa](https://github.com/uport-project/veramo/commit/a2971aaf0b1f263415e938cc459e55a366075ffb))\n* **deps:** update dependency commander to v11 ([e2d7966](https://github.com/uport-project/veramo/commit/e2d79668b0bbd834d462fae867220f6cf44c5282))\n\n\n### Features\n\n* **kv-store:** add key-value store based on a typescript port of the keyv package ([#1150](https://github.com/uport-project/veramo/issues/1150)) ([e7138d3](https://github.com/uport-project/veramo/commit/e7138d377c4f6ea242cea645cda4d26eb7d7d377))\n\n\n\n\n\n# [5.2.0](https://github.com/uport-project/veramo/compare/v5.1.4...v5.2.0) (2023-05-02)\n\n\n### Bug Fixes\n\n* add did-provider-peer to CLI dependencies ([#1161](https://github.com/uport-project/veramo/issues/1161)) ([38827c3](https://github.com/uport-project/veramo/commit/38827c3a12483f6791fcb3784f2a1ef27a21495f))\n* **cli:** NODE_NO_WARNINGS on windows ([#1164](https://github.com/uport-project/veramo/issues/1164)) ([e9474e2](https://github.com/uport-project/veramo/commit/e9474e2882d9019677f227437702c226c79bbc87))\n* **deps:** update dependency express-handlebars to v7 ([2621947](https://github.com/uport-project/veramo/commit/26219471a117d0ec3d7a691e082022253aae6cd6))\n\n\n### Features\n\n* add did-peer provider and resolver ([#1156](https://github.com/uport-project/veramo/issues/1156)) ([9502063](https://github.com/uport-project/veramo/commit/95020632f741bd4640b3496b7b1bf19f5e6641d0))\n\n\n\n\n\n## [5.1.4](https://github.com/uport-project/veramo/compare/v5.1.3...v5.1.4) (2023-03-16)\n\n\n### Bug Fixes\n\n* **cli:** fix `credential verify` command for JWT credentials ([#1148](https://github.com/uport-project/veramo/issues/1148)) ([697a14c](https://github.com/uport-project/veramo/commit/697a14c5f0377afb8f836cde9ff3956121247780))\n\n\n\n\n\n## [5.1.3](https://github.com/uport-project/veramo/compare/v5.1.2...v5.1.3) (2023-03-16)\n\n\n### Bug Fixes\n\n* **cli:** load server config asynchronously ([#1145](https://github.com/uport-project/veramo/issues/1145)) ([2a0aef1](https://github.com/uport-project/veramo/commit/2a0aef1e1911ffba85c043a878f60d7bc672e86a)), closes [#1144](https://github.com/uport-project/veramo/issues/1144)\n\n\n\n\n\n## [5.1.2](https://github.com/uport-project/veramo/compare/v5.1.1...v5.1.2) (2023-02-25)\n\n\n### Bug Fixes\n\n* **ci:** minor changes to trigger release alignment ([9db312f](https://github.com/uport-project/veramo/commit/9db312f8f049ec13ef394dc77fe6e2759143790d))\n\n\n\n\n\n# [5.1.0](https://github.com/uport-project/veramo/compare/v5.0.0...v5.1.0) (2023-02-24)\n\n\n### Bug Fixes\n\n* **cli:** create veramo instance async in CLI ([#1126](https://github.com/uport-project/veramo/issues/1126)) ([05ab106](https://github.com/uport-project/veramo/commit/05ab10653aac4cb37b00a9be6cc0c7be910f1827)), closes [#1125](https://github.com/uport-project/veramo/issues/1125)\n* **cli:** typo in explore command ([279168d](https://github.com/uport-project/veramo/commit/279168d4fc2b9809090666b6ffb5d4494c9e5cca))\n* P256 key parity corrections ([#1137](https://github.com/uport-project/veramo/issues/1137)) ([d0eca2b](https://github.com/uport-project/veramo/commit/d0eca2b3cd9ca6741f7f056e28bb9799910bc5ec)), closes [#1136](https://github.com/uport-project/veramo/issues/1136) [#1135](https://github.com/uport-project/veramo/issues/1135)\n\n\n### Features\n\n* **cli:**  export config methods and adopt `Command` instances instead of global `program`([#1130](https://github.com/uport-project/veramo/issues/1130)) ([9c73d98](https://github.com/uport-project/veramo/commit/9c73d98fd217ed9a612767f49a235cdbf43619cb))\n* **cli:** add did:3 resolver to CLI default config ([#1129](https://github.com/uport-project/veramo/issues/1129)) ([5887e04](https://github.com/uport-project/veramo/commit/5887e04802266bffe71c2a5f7c8d71fbe1f3a158))\n* **cli:** add did:pkh support to the default CLI config ([#1133](https://github.com/uport-project/veramo/issues/1133)) ([19cccc1](https://github.com/uport-project/veramo/commit/19cccc1f394a63505fc40d57a7c1d26d21abc3e5))\n\n\n\n\n\n# [5.0.0](https://github.com/uport-project/veramo/compare/v4.3.0...v5.0.0) (2023-02-09)\n\n\n### Build System\n\n* convert veramo modules to ESM instead of CommonJS ([#1103](https://github.com/uport-project/veramo/issues/1103)) ([b5cea3c](https://github.com/uport-project/veramo/commit/b5cea3c0d80d900a47bd1d9eea68f84b70a35e7b)), closes [#1099](https://github.com/uport-project/veramo/issues/1099)\n\n\n### Features\n\n* isolate `core-types` package from `core` ([#1116](https://github.com/uport-project/veramo/issues/1116)) ([ba7a303](https://github.com/uport-project/veramo/commit/ba7a303de91cf4cc568a3af1ddf8ca98ed022e9f))\n\n\n### BREAKING CHANGES\n\n* this is a breaking change as modules will have to be imported differently: \n* https://www.typescriptlang.org/docs/handbook/esm-node.html\n* https://nodejs.org/api/esm.html\n* https://caniuse.com/?search=modules\n\ntest(did-provider-ion): skip a couple of tests that fail with unreasonable errors\nchore: use ubuntu-latest on CI\nfix: temporarily remove puppeteer tests\nfix: use craco for test-react-app to enable babel config\ntest: fix unit and integration tests (browser tests still broken)\nfix: fix some build issues that prevented tests from working\nfix: missing deps flagged by pnpm\n\n\n\n\n\n# [4.3.0](https://github.com/uport-project/veramo/compare/v4.2.0...v4.3.0) (2023-01-27)\n\n\n### Features\n\n* **did-comm:** add trust ping protocol ([#1080](https://github.com/uport-project/veramo/issues/1080)) ([fb22e63](https://github.com/uport-project/veramo/commit/fb22e632ef6dcce6a7dfec9a229c7be4d6d5c894))\n\n\n\n\n\n# [4.2.0](https://github.com/uport-project/veramo/compare/v4.1.2...v4.2.0) (2022-12-05)\n\n\n### Bug Fixes\n\n* **cli:** fix bug in schema generator ([d4c63c1](https://github.com/uport-project/veramo/commit/d4c63c1d1c3acb2a2f576450384250163ae7e0a0))\n* **deps:** bump dependencies ([701b8ed](https://github.com/uport-project/veramo/commit/701b8edf981ea11c7ddb6a81d2817dbbdbb022f3))\n* **deps:** Update dependency ethr-did-resolver to v8 ([f475dbc](https://github.com/uport-project/veramo/commit/f475dbc1c2dbb4b7f6b3396c3e6947eac2931736))\n\n\n### Features\n\n* add eip712 issuer to CLI and default agent config ([#1065](https://github.com/uport-project/veramo/issues/1065)) ([33c7cee](https://github.com/uport-project/veramo/commit/33c7ceed3b9850cfd6f5677aeeb89aeda2be72e5))\n\n\n\n\n\n## [4.1.2](https://github.com/uport-project/veramo/compare/v4.1.1...v4.1.2) (2022-11-03)\n\n\n### Bug Fixes\n\n* **deps:** bump ethr-did to 2.3.6 and cosmetic changes in CLI config ([#1054](https://github.com/uport-project/veramo/issues/1054)) ([eb03b63](https://github.com/uport-project/veramo/commit/eb03b637ef5aecf57b0ee130d08689094b1956df))\n\n\n\n\n\n## [4.1.1](https://github.com/uport-project/veramo/compare/v4.1.0...v4.1.1) (2022-11-01)\n\n**Note:** Version bump only for package @veramo/cli\n\n\n\n\n\n# [4.1.0](https://github.com/uport-project/veramo/compare/v4.0.2...v4.1.0) (2022-10-31)\n\n\n### Bug Fixes\n\n* **deps:** add @veramo/credential-ld to the CLI dependencies ([#1043](https://github.com/uport-project/veramo/issues/1043)) ([0698185](https://github.com/uport-project/veramo/commit/0698185319382a173a3d10c197f785bdadb070c2)), closes [#1042](https://github.com/uport-project/veramo/issues/1042)\n* **deps:** Update dependency ethr-did-resolver to v7 ([#1038](https://github.com/uport-project/veramo/issues/1038)) ([d421c0f](https://github.com/uport-project/veramo/commit/d421c0f9f5934829df2930e58e98bcfce813ce84))\n* remove deprecated testnets ([#1028](https://github.com/uport-project/veramo/issues/1028)) ([2823738](https://github.com/uport-project/veramo/commit/28237383d0cc2eb20bcf8e10562221ea2ab32f94)), closes [#1025](https://github.com/uport-project/veramo/issues/1025)\n\n\n\n\n\n## [4.0.2](https://github.com/uport-project/veramo/compare/v4.0.1...v4.0.2) (2022-10-04)\n\n\n### Bug Fixes\n\n* **data-store:** use looser typeorm version range to fix [#1013](https://github.com/uport-project/veramo/issues/1013) ([#1016](https://github.com/uport-project/veramo/issues/1016)) ([83807f3](https://github.com/uport-project/veramo/commit/83807f31f845c8a0116f0300c51735ec406d9dd4))\n\n\n\n\n\n## [4.0.1](https://github.com/uport-project/veramo/compare/v4.0.0...v4.0.1) (2022-09-23)\n\n**Note:** Version bump only for package @veramo/cli\n\n\n\n\n\n# [4.0.0](https://github.com/uport-project/veramo/compare/v3.1.5...v4.0.0) (2022-09-22)\n\n\n### Bug Fixes\n\n* **cli:** fix typo in command description ([#913](https://github.com/uport-project/veramo/issues/913)) ([bfc61f3](https://github.com/uport-project/veramo/commit/bfc61f3a52b15e30bae0de681e5782f611900178))\n* **cli:** update default CLI config to account for renamed class ([#919](https://github.com/uport-project/veramo/issues/919)) ([d66c366](https://github.com/uport-project/veramo/commit/d66c36654fbc9ba02ed5914e18359180c0087cf9))\n* **deps:** update all non-major dependencies ([b537187](https://github.com/uport-project/veramo/commit/b537187ba04ba41cd45c18dfb58c92725b65b084))\n* **deps:** update all non-major dependencies ([a7a5b5d](https://github.com/uport-project/veramo/commit/a7a5b5dc3a2d90670927f4367bef2055a6d39f3b))\n* **deps:** update all non-major dependencies ([04c0053](https://github.com/uport-project/veramo/commit/04c00530963b1c4496374532bf74b73f3b22c825))\n* **deps:** update all non-major dependencies ([d8aa16a](https://github.com/uport-project/veramo/commit/d8aa16a36d2e63c65177bbf281f8d15fcc9dcb5a))\n* **deps:** update all non-major dependencies ([183b4bc](https://github.com/uport-project/veramo/commit/183b4bc5ca3dcf11dd111e7e1ae19636909ff4c7))\n* **deps:** update builders-and-testers ([a13f5f8](https://github.com/uport-project/veramo/commit/a13f5f8a01a8bd2d7ec2bb0e19b052b1a108881c))\n* **deps:** update builders-and-testers ([509001f](https://github.com/uport-project/veramo/commit/509001f6853c36dc49f5995508e9eb4167676c11))\n* **deps:** update builders-and-testers ([a72b33c](https://github.com/uport-project/veramo/commit/a72b33cf8dc6215311d7926f622be2d5b9fc516c))\n* **deps:** update builders-and-testers ([ef08c52](https://github.com/uport-project/veramo/commit/ef08c527198df36283b2a2987ea6c8080fd2867d))\n* **deps:** update builders-and-testers ([8a1884b](https://github.com/uport-project/veramo/commit/8a1884ba38f436c3eb7246a04a6c1e387dd71467))\n* **deps:** update builders-and-testers ([60b8f79](https://github.com/uport-project/veramo/commit/60b8f791a3af73bbe7c944bca719f2bdf34e60be))\n* **deps:** update builders-and-testers ([5202ef1](https://github.com/uport-project/veramo/commit/5202ef1dd51fd3b7ad57591fd726fdc571bc8492))\n* **deps:** update builders-and-testers ([4d5e912](https://github.com/uport-project/veramo/commit/4d5e912ee0aefb79e9198cb045cb9106af16a4b1))\n* **deps:** update builders-and-testers ([#930](https://github.com/uport-project/veramo/issues/930)) ([b3a5c52](https://github.com/uport-project/veramo/commit/b3a5c52d05061943e7cc01f06536c1761724017b))\n* **deps:** update dependency @microsoft/api-extractor to v7.23.1 ([4081051](https://github.com/uport-project/veramo/commit/408105191efe63cc8ab5caf8baa8f0cbb349ed63))\n* **deps:** update dependency commander to v9 ([28c35e1](https://github.com/uport-project/veramo/commit/28c35e187caa9e5d56e149e5be220f6c9e14e0fb))\n* **deps:** update dependency dotenv to v12 ([ea7641e](https://github.com/uport-project/veramo/commit/ea7641e4e21da0fc02535848c40ff81e644c069e))\n* **deps:** update dependency dotenv to v14 ([88bd6dc](https://github.com/uport-project/veramo/commit/88bd6dce4fc364e02c97aff7130c2685640f48cf))\n* **deps:** update dependency dotenv to v16 ([0ee5454](https://github.com/uport-project/veramo/commit/0ee545455deaeeca648c7f1c2266c34f094db053))\n* **deps:** update dependency express-handlebars to v6 ([4444828](https://github.com/uport-project/veramo/commit/4444828eddd68b7547cb5160a1970f35af0698b7))\n* **deps:** update dependency inquirer-autocomplete-prompt to v2 ([9bf0d0b](https://github.com/uport-project/veramo/commit/9bf0d0b0c95ad54404f39ffb54fd97880a569352))\n* **deps:** update dependency openapi-types to v10 ([3d9cf88](https://github.com/uport-project/veramo/commit/3d9cf8810cd04dbde394248a818e1e59eb251c67))\n* **deps:** update dependency openapi-types to v11 ([992ad40](https://github.com/uport-project/veramo/commit/992ad4041f54634203bd3017fd984f45a7c92012))\n* **deps:** update dependency openapi-types to v12 ([b8401f5](https://github.com/uport-project/veramo/commit/b8401f526b0771a98ab7987b773b9e9113710e9e))\n* **deps:** update dependency ts-json-schema-generator to v1 ([74d0a66](https://github.com/uport-project/veramo/commit/74d0a66a477ce7d425191a2d3343bc6192ba263a))\n* **deps:** update dependency typeorm to v0.2.41 ([61a8103](https://github.com/uport-project/veramo/commit/61a8103c15849dfd8574dda69692a7d8f7fa534e))\n* **deps:** update dependency yaml to v2 ([9d5ee7c](https://github.com/uport-project/veramo/commit/9d5ee7cb3963cae46c9f0f1fbbfcea20cae415b2))\n* **deps:** update did-libraries ([219cde2](https://github.com/uport-project/veramo/commit/219cde250e8d4f06d7978afcc38a04471342fd21))\n* **deps:** use did-jwt v6 and ethr-did-resolver v6 ([#925](https://github.com/uport-project/veramo/issues/925)) ([0c77d03](https://github.com/uport-project/veramo/commit/0c77d03ec5ec9e2091de3f74f67ab86a22cde197)), closes [#923](https://github.com/uport-project/veramo/issues/923) [#848](https://github.com/uport-project/veramo/issues/848)\n* **did-resolver:** use interface `Resolvable` instead of the `Resolver` class ([9c2e59f](https://github.com/uport-project/veramo/commit/9c2e59f3f23f808511c6c0e8e440b4d53ba5cb00))\n* fix inquirer prompt for subject DID during SDR ([20d6cab](https://github.com/uport-project/veramo/commit/20d6cabe1a86e0ba4521a9c8867471ea6840bf08)), closes [#790](https://github.com/uport-project/veramo/issues/790)\n* update and fix inline documentation of all exported types ([#921](https://github.com/uport-project/veramo/issues/921)) ([63e64e0](https://github.com/uport-project/veramo/commit/63e64e0e2693808c4704dca8cc511dc0bab3f3b1))\n\n\n### Features\n\n* add support for serviceEndpoint property as defined in latest DID Spec ([#988](https://github.com/uport-project/veramo/issues/988)) ([9bed70b](https://github.com/uport-project/veramo/commit/9bed70ba658aed34a97944e0dee27bca6c81d700))\n* **cli:** add choices when selecting credential Subject in CLI ([#898](https://github.com/uport-project/veramo/issues/898)) ([c47c08e](https://github.com/uport-project/veramo/commit/c47c08e2ce9ef676cc429bcaf063bbe8e38a352c))\n* **cli:** in explore, allow copy to clipboard the text of identifier or credential or presentation ([#902](https://github.com/uport-project/veramo/issues/902)) ([d3b87f5](https://github.com/uport-project/veramo/commit/d3b87f52f2707253449867d3a872ec60aa3fbc35))\n* **credential-ld:** add support for browser environments ([#916](https://github.com/uport-project/veramo/issues/916)) ([435e4d2](https://github.com/uport-project/veramo/commit/435e4d260b1774f96b182c1a75ab2f1c993f2291))\n* **credential-w3c:** add ICredentialPlugin interface in core package ([#1001](https://github.com/uport-project/veramo/issues/1001)) ([7b6d195](https://github.com/uport-project/veramo/commit/7b6d1950364c8b741dd958d29e506b95fa5b1cec)), closes [#941](https://github.com/uport-project/veramo/issues/941)\n* **credential-w3c:** add override policies to verifyPresentation ([#990](https://github.com/uport-project/veramo/issues/990)) ([06b3147](https://github.com/uport-project/veramo/commit/06b314717cbe35f696e706b1ebf5e54438115493)), closes [#375](https://github.com/uport-project/veramo/issues/375) [#954](https://github.com/uport-project/veramo/issues/954)\n* **credential-w3c:** align verification API between formats ([#996](https://github.com/uport-project/veramo/issues/996)) ([b987fc0](https://github.com/uport-project/veramo/commit/b987fc0903a31d3bbffb43fef872be4d6c62c2ad)), closes [#935](https://github.com/uport-project/veramo/issues/935) [#954](https://github.com/uport-project/veramo/issues/954) [#375](https://github.com/uport-project/veramo/issues/375) [#989](https://github.com/uport-project/veramo/issues/989)\n* **data-store:** use DataSource instead of Connection ([#970](https://github.com/uport-project/veramo/issues/970)) ([3377930](https://github.com/uport-project/veramo/commit/3377930189bcbd43dfd155992093d2bbeb883335)), closes [#947](https://github.com/uport-project/veramo/issues/947)\n* **date-store-json:** add JSON object storage implementation ([#819](https://github.com/uport-project/veramo/issues/819)) ([934b34a](https://github.com/uport-project/veramo/commit/934b34a18b194928f90e7797289cc6f2243789ec))\n\n\n### BREAKING CHANGES\n\n* the `did-resolver` and connected libraries change the data-type for `ServiceEndpoint` to `Service` and the previous semantic has changed. Services can have multiple endpoints, not just a single string.\n* **cli:** ProfileDiscoveryProvider has been renamed to DataStoreDiscoveryProvider in #597. Please update your config accordingly\n\n\n\n\n\n## [3.1.5](https://github.com/uport-project/veramo/compare/v3.1.4...v3.1.5) (2022-06-10)\n\n\n### Bug Fixes\n\n* **ci:** improve documentation CI workflows ([#922](https://github.com/uport-project/veramo/issues/922)) ([0579764](https://github.com/uport-project/veramo/commit/057976402f3d7ea64082f500a454546c809d8c50))\n\n\n\n\n\n## [3.1.4](https://github.com/uport-project/veramo/compare/v3.1.3...v3.1.4) (2022-06-02)\n\n\n### Bug Fixes\n\n* **deps:** bump sqlite3 to 5.0.8 to enable build on apple M1 chips ([#911](https://github.com/uport-project/veramo/issues/911)) ([daeadb7](https://github.com/uport-project/veramo/commit/daeadb7ce5a86a5ef01e1b1d507133f11fb35d29))\n\n\n\n\n\n## [3.1.3](https://github.com/uport-project/veramo/compare/v3.1.2...v3.1.3) (2022-06-01)\n\n**Note:** Version bump only for package @veramo/cli\n\n\n\n\n\n## [3.1.2](https://github.com/uport-project/veramo/compare/v3.1.1...v3.1.2) (2022-05-30)\n\n**Note:** Version bump only for package @veramo/cli\n\n\n\n\n\n## [3.1.1](https://github.com/uport-project/veramo/compare/v3.1.0...v3.1.1) (2022-01-13)\n\n**Note:** Version bump only for package @veramo/cli\n\n\n\n\n\n# [3.1.0](https://github.com/uport-project/veramo/compare/v3.0.0...v3.1.0) (2021-11-12)\n\n\n### Bug Fixes\n\n* **data-store:** add support for entityPrefix ([#725](https://github.com/uport-project/veramo/issues/725)) ([801bb95](https://github.com/uport-project/veramo/commit/801bb95ddd22abaa61c938b025834132d4e8d3be)), closes [#724](https://github.com/uport-project/veramo/issues/724)\n* **deps:** update all non-major dependencies ([a6614e8](https://github.com/uport-project/veramo/commit/a6614e8ba9b34c6fdb7a9e3960b6fa20090ce44a))\n* **deps:** update builders-and-testers ([5c4fa9e](https://github.com/uport-project/veramo/commit/5c4fa9e90def0beea9873e647a3bdd1410987e00))\n* **deps:** update builders-and-testers ([828bfa2](https://github.com/uport-project/veramo/commit/828bfa20c6181c2e3a405ab13a06249f5112eb72))\n* **deps:** update builders-and-testers ([e31a4be](https://github.com/uport-project/veramo/commit/e31a4beea645169e468824c26122d69cf5c4050f))\n* **deps:** update builders-and-testers ([ba97cf1](https://github.com/uport-project/veramo/commit/ba97cf139e4379308edefee09f9b1dd7f36bb026))\n* **deps:** update builders-and-testers ([2e4e6e5](https://github.com/uport-project/veramo/commit/2e4e6e56f1cde9213966ed95671d97b529c0f505))\n* **deps:** update dependency commander to v8 ([#587](https://github.com/uport-project/veramo/issues/587)) ([9fc5c50](https://github.com/uport-project/veramo/commit/9fc5c509b6475b19c1f49fdf31cf7d5ed3fcc16a))\n* **deps:** update dependency jsonpointer to v5 ([5c0ab9f](https://github.com/uport-project/veramo/commit/5c0ab9f2b0f377722abae6b3a175e22e7ad5471a))\n* **deps:** update dependency passport to ^0.5.0 ([a4dae24](https://github.com/uport-project/veramo/commit/a4dae24c8e8b2bf9e061e182076c1b89b71df306))\n* **deps:** update dependency ts-json-schema-generator to ^0.97.0 ([c20a409](https://github.com/uport-project/veramo/commit/c20a409d8bbc84bdd41809a722c1fd599707e46a))\n* **deps:** update did-libraries ([0ea73fc](https://github.com/uport-project/veramo/commit/0ea73fc1dba02c3d4c4df5befef265f7f573b2d1))\n* **deps:** update did-libraries ([417dc5d](https://github.com/uport-project/veramo/commit/417dc5dd157ee259b6f89f4987f1ecca444fb1d4))\n\n\n### Features\n\n* **cli:** add command to verify an agent configuration file ([#729](https://github.com/uport-project/veramo/issues/729)) ([2790ebc](https://github.com/uport-project/veramo/commit/2790ebcc2af72caa2a85f2068cdd832b548a2187))\n* **did-comm:** didcomm messaging using did:ethr ([#744](https://github.com/uport-project/veramo/issues/744)) ([1be5e04](https://github.com/uport-project/veramo/commit/1be5e04e09112c0823d776fe2d55117d71a7b448)), closes [#743](https://github.com/uport-project/veramo/issues/743)\n\n\n\n\n\n# [3.0.0](https://github.com/uport-project/veramo/compare/v2.1.3...v3.0.0) (2021-09-20)\n\n\n### Bug Fixes\n\n* **deps:** update builders-and-testers ([acef171](https://github.com/uport-project/veramo/commit/acef171a1845ed4b1022efc5a8cd7a893db4e73a))\n* **deps:** update builders-and-testers ([ca746d2](https://github.com/uport-project/veramo/commit/ca746d2450ca0d08703a219e4f17f3f2966bd0db))\n* **deps:** update dependency @microsoft/api-extractor to v7.18.6 ([80b8f67](https://github.com/uport-project/veramo/commit/80b8f673539c0fa62bc24490d9b09acecbd3e4d1))\n* **deps:** update dependency @microsoft/api-extractor to v7.18.7 ([28d7cf0](https://github.com/uport-project/veramo/commit/28d7cf09afdef1b0905dfbe6520dc953a2da27cd))\n\n\n### Features\n\n* **data-store:** initialize DB using migrations ([#679](https://github.com/uport-project/veramo/issues/679)) ([41f6240](https://github.com/uport-project/veramo/commit/41f6240d68a79338772230cbfff768189ab031ed)), closes [#676](https://github.com/uport-project/veramo/issues/676)\n* **key-manager:** move private key storage to kms-local ([#661](https://github.com/uport-project/veramo/issues/661)) ([6b1d135](https://github.com/uport-project/veramo/commit/6b1d135eedb1c58b715be8941d34312da39facb2)), closes [#539](https://github.com/uport-project/veramo/issues/539) [#540](https://github.com/uport-project/veramo/issues/540) [#680](https://github.com/uport-project/veramo/issues/680)\n\n\n### BREAKING CHANGES\n\n* **key-manager:** `keyManagetGet` no longer returns private key data\n* **key-manager:** `KeyStore` no longer requires a `SecretBox`\n* **key-manager:** `KeyManagementSystem` needs a `PrivateKeyStore`\n* **key-manager:** @veramo/cli configuration version update to 3.0\n\nIf you're already working with Veramo and wish to upgrade existing agents to veramo 3.0, you'll have to make some changes to your configuration, depending on how you're using the framework.\n\nIt boils down to these 3 steps:\n\n1. Update your database connection to use migrations\n2. Remove the `SecretBox` parameter from `KeyManager`\n3. Add a `PrivateKeyStore` parameter to `KeyManagementSystem` with a `SecretBox` that you were using before with `KeyManager` (and keep the same encryption key)\n\n* feat(key-manager): move private key storage to kms-local\n* **data-store:** database needs migrations for initialization. See #679 #676\nThe `@veramo/data-store` package relies on `typeorm` as a database abstraction.\nTypeorm has a connection flag `synchonize` which bootstraps the database along with schema and relations based on a set of `Entities` (annotated typescript classes).\nThis is very handy for fast development iterations but it is **not recommended for production** use because there is too much ambiguity possible when the `Entities` change, and there is a risk of data loss.\nThe recommended way to do things is to use the `migrations` mechanism. It allows you to migrate to new database schemas when necessary, and even customize the database to your own needs.\n\n**Going forward, this is the mechanism we will be recommending for connections.**\n\n\n\n\n\n## [2.1.3](https://github.com/uport-project/veramo/compare/v2.1.2...v2.1.3) (2021-09-01)\n\n**Note:** Version bump only for package @veramo/cli\n\n\n\n\n\n## [2.1.2](https://github.com/uport-project/veramo/compare/v2.1.1...v2.1.2) (2021-09-01)\n\n**Note:** Version bump only for package @veramo/cli\n\n\n\n\n\n## [2.1.1](https://github.com/uport-project/veramo/compare/v2.1.0...v2.1.1) (2021-08-11)\n\n\n### Bug Fixes\n\n* include tx type in eth_signTransaction ([#660](https://github.com/uport-project/veramo/issues/660)) ([d45129e](https://github.com/uport-project/veramo/commit/d45129ec7106c7fdb0ddfafc22bfa498d4e95d9d)), closes [#641](https://github.com/uport-project/veramo/issues/641)\n\n\n\n\n\n# [2.1.0](https://github.com/uport-project/veramo/compare/v2.0.1...v2.1.0) (2021-08-11)\n\n\n### Bug Fixes\n\n* **cli:** export recent methods from CLI local and remote ([44da085](https://github.com/uport-project/veramo/commit/44da0856bfdeb8f47ad85086e2d600d1e7e7f06a))\n* **deps:** update dependency @microsoft/api-extractor to v7.18.4 ([ec64d56](https://github.com/uport-project/veramo/commit/ec64d56eadf23a01946ad5cec3c4fcbd116ec073))\n* **deps:** update dependency ts-json-schema-generator to ^0.95.0 ([76e0133](https://github.com/uport-project/veramo/commit/76e0133ff818d805fe3ebbfb601073a568d1bd25))\n* **deps:** update dependency ws to v8 ([#643](https://github.com/uport-project/veramo/issues/643)) ([40fae61](https://github.com/uport-project/veramo/commit/40fae6198f427283c0db4db29fde53360deec37b))\n\n\n\n\n\n## [2.0.1](https://github.com/uport-project/veramo/compare/v2.0.0...v2.0.1) (2021-07-20)\n\n\n### Bug Fixes\n\n* **cli:** export recent methods from CLI local and remote ([#625](https://github.com/uport-project/veramo/issues/625)) ([36bce08](https://github.com/uport-project/veramo/commit/36bce08095104fe7a1cb97f506da857e18fb8dc2))\n\n\n\n\n\n# [2.0.0](https://github.com/uport-project/veramo/compare/v1.2.2...v2.0.0) (2021-07-14)\n\n\n### Bug Fixes\n\n* **deps:** update dependency @microsoft/api-extractor to v7.18.1 ([502c4c7](https://github.com/uport-project/veramo/commit/502c4c7ee6f674984e04adddcd555444cf6b94db))\n* **deps:** update dependency dotenv to v10 ([#530](https://github.com/uport-project/veramo/issues/530)) ([1bd2c3f](https://github.com/uport-project/veramo/commit/1bd2c3fc3b7ce0f6ea8fbee00990eb1f8e7cd39f))\n* **deps:** update dependency dotenv to v9 ([#506](https://github.com/uport-project/veramo/issues/506)) ([4d1b720](https://github.com/uport-project/veramo/commit/4d1b720e1335cca7fc403bb17e6936909b1aaaf3))\n* **deps:** update dependency openapi-types to v9 ([#517](https://github.com/uport-project/veramo/issues/517)) ([3c33265](https://github.com/uport-project/veramo/commit/3c33265d3ebf65d6bc64f1fccda5461a1109b25c))\n* **deps:** update dependency ts-json-schema-generator to v0.92.0 ([a232e3a](https://github.com/uport-project/veramo/commit/a232e3a1481ab18682d96a8b4855f9824341aa12))\n* improve subject selection and verification for SDR ([#512](https://github.com/uport-project/veramo/issues/512)) ([01cb44e](https://github.com/uport-project/veramo/commit/01cb44eee6753f7bd4f5c31c38c6f56a708ff94e)), closes [#415](https://github.com/uport-project/veramo/issues/415)\n\n\n### Features\n\n* **cli:** add DID discovery plugin to @veramo/cli ([#600](https://github.com/uport-project/veramo/issues/600)) ([a484f4c](https://github.com/uport-project/veramo/commit/a484f4c67e044d7c0299f128e15631cc8ae16f60))\n* **cli:** export new agent methods and request LD DIDDocument by default ([#617](https://github.com/uport-project/veramo/issues/617)) ([26d088b](https://github.com/uport-project/veramo/commit/26d088b86ecfd66a00cdef7c7bb926148f46fbc9))\n* implement didcomm v2 packing/unpacking ([#575](https://github.com/uport-project/veramo/issues/575)) ([249b07e](https://github.com/uport-project/veramo/commit/249b07eca8d2de9eb5252d71683d5f1fba319d60)), closes [#559](https://github.com/uport-project/veramo/issues/559) [#558](https://github.com/uport-project/veramo/issues/558)\n* **key-manager:** add generic signing capabilities ([#529](https://github.com/uport-project/veramo/issues/529)) ([5f10a1b](https://github.com/uport-project/veramo/commit/5f10a1bcea214cb593de12fa6ec3a91b3cb712bb)), closes [#522](https://github.com/uport-project/veramo/issues/522)\n* **sdr:** return UniqueVerifiableCredential for selective-disclosure ([#593](https://github.com/uport-project/veramo/issues/593)) ([9c6c090](https://github.com/uport-project/veramo/commit/9c6c0906607bc8f415042d3a855a2dd23a097725)), closes [#496](https://github.com/uport-project/veramo/issues/496)\n\n\n### BREAKING CHANGES\n\n* **sdr:** `getVerifiableCredentialsForSdr` and `validatePresentationAgainstSdr` now returns { hash: string, verifiableCredential: VerifiableCredential} instead of `VerifiableCredential`\n\n\n\n\n\n## [1.2.2](https://github.com/uport-project/veramo/compare/v1.2.1...v1.2.2) (2021-05-18)\n\n\n### Bug Fixes\n\n* **cli:** print entire JSON tree resulting from DID resolution ([#524](https://github.com/uport-project/veramo/issues/524)) ([e83d33c](https://github.com/uport-project/veramo/commit/e83d33cc0687a100587a439bdc8b8ed1219b9c24)), closes [#523](https://github.com/uport-project/veramo/issues/523)\n\n\n\n\n\n## [1.2.1](https://github.com/uport-project/veramo/compare/v1.2.0...v1.2.1) (2021-05-03)\n\n\n### Bug Fixes\n\n* integration tests and CLI config for did:key ([#498](https://github.com/uport-project/veramo/issues/498)) ([2ec0687](https://github.com/uport-project/veramo/commit/2ec068715d9fd4f2917c05f67755e226713cda1d))\n\n\n\n\n\n# [1.2.0](https://github.com/uport-project/veramo/compare/v1.1.2...v1.2.0) (2021-04-27)\n\n\n### Bug Fixes\n\n* **deps:** update all non-major dependencies ([#462](https://github.com/uport-project/veramo/issues/462)) ([4a2b206](https://github.com/uport-project/veramo/commit/4a2b20633810b45a155bf2149cbff57d157bda3c))\n* **deps:** update dependency inquirer to v8 ([#395](https://github.com/uport-project/veramo/issues/395)) ([96c2129](https://github.com/uport-project/veramo/commit/96c21295cbb7bddeb88711e77daadde77d4f1a4d))\n* **deps:** update dependency ngrok to v4 ([#433](https://github.com/uport-project/veramo/issues/433)) ([176e221](https://github.com/uport-project/veramo/commit/176e22144403ab3e2c885dc575394bae42d67a80))\n* **deps:** update dependency openapi-types to v8 ([#446](https://github.com/uport-project/veramo/issues/446)) ([7ab3737](https://github.com/uport-project/veramo/commit/7ab3737094beaf1312336b2ed31764121d59ccf1))\n* **deps:** update dependency ts-json-schema-generator to v0.90.0 ([d806ab5](https://github.com/uport-project/veramo/commit/d806ab5e7e934573796b84ec7adc54791b23efa5))\n* default CLI config OpenAPI schema ([#429](https://github.com/uport-project/veramo/issues/429)) ([c985d37](https://github.com/uport-project/veramo/commit/c985d37c63d5bfcc490f56ceead8c762c19142f0))\n* **deps:** update dependency ts-json-schema-generator to v0.84.0 ([#369](https://github.com/uport-project/veramo/issues/369)) ([86ec9b3](https://github.com/uport-project/veramo/commit/86ec9b378248945cb364ec2224235359f3ac9d32))\n\n\n### Features\n\n* adapt to did core spec ([#430](https://github.com/uport-project/veramo/issues/430)) ([9712db0](https://github.com/uport-project/veramo/commit/9712db0eea1a3f48cf0665d66ae715ea0c23cd4a)), closes [#418](https://github.com/uport-project/veramo/issues/418) [#428](https://github.com/uport-project/veramo/issues/428) [#417](https://github.com/uport-project/veramo/issues/417) [#416](https://github.com/uport-project/veramo/issues/416) [#412](https://github.com/uport-project/veramo/issues/412) [#397](https://github.com/uport-project/veramo/issues/397) [#384](https://github.com/uport-project/veramo/issues/384) [#394](https://github.com/uport-project/veramo/issues/394)\n* add native resolver for did:key ([#458](https://github.com/uport-project/veramo/issues/458)) ([a026f24](https://github.com/uport-project/veramo/commit/a026f247ad91dcb3a996e0e95b0fe253cf538f8b)), closes [#352](https://github.com/uport-project/veramo/issues/352)\n\n\n\n\n\n## [1.1.2](https://github.com/uport-project/veramo/compare/v1.1.1...v1.1.2) (2021-04-26)\n\n**Note:** Version bump only for package @veramo/cli\n\n\n\n\n\n## [1.1.1](https://github.com/uport-project/veramo/compare/v1.1.0...v1.1.1) (2021-03-09)\n\n\n### Bug Fixes\n\n* **cli:** validate config file version number ([#413](https://github.com/uport-project/veramo/issues/413)) ([fb5668c](https://github.com/uport-project/veramo/commit/fb5668cb95cee2b26bb06e55b20d0007f57a6a02))\n\n\n\n\n\n# [1.1.0](https://github.com/uport-project/veramo/compare/v1.0.1...v1.1.0) (2021-01-26)\n\n\n### Bug Fixes\n\n* **deps:** update dependency commander to v7 ([#330](https://github.com/uport-project/veramo/issues/330)) ([f8a7566](https://github.com/uport-project/veramo/commit/f8a75665f02bbee74c89554a67588a6a33968d85))\n\n\n\n\n\n## 1.0.1 (2020-12-18)\n\n**Note:** Version bump only for package @veramo/cli\n"
  },
  {
    "path": "packages/cli/LICENSE",
    "content": "                                 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 2019 Consensys AG\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"
  },
  {
    "path": "packages/cli/README.md",
    "content": "# Veramo command line interface\n\n## Install CLI\n\n```\nnpm -g i @veramo/cli\n```\n\n## Usage\n\n```\nUsage: veramo [options] [command]\n\nOptions:\n  -v, --version      output the version number\n  --config <path>    Configuration file (default: \"./agent.yml\")\n  -h, --help         display help for command\n\nCommands:\n  did                Decentralized identifiers\n  credential         W3C Verifiable Credential\n  presentation       W3C Verifiable Presentation\n  explore            launch Verifiable Data explorer\n  sdr                Selective Disclosure Request\n  message            Messages\n  execute [options]  Executes agent method\n  server [options]   Launch OpenAPI server\n  config             Agent configuration\n  dev                Plugin developer tools\n  help [command]     display help for command\n```\n\n## Developing\n\nWhen developing in this package, take care to call the local veramo CLI package, rather than the globally installed one.\n\nFor example, rather than doing this:\n\n```\nveramo credential create\n```\n\nyou will need to do this:\n\n```\nyarn build\nyarn veramo credential create\n```\n"
  },
  {
    "path": "packages/cli/bin/veramo.js",
    "content": "#!/usr/bin/env node\nconst originalEmit = process.emit;\nprocess.emit = function (name, data, ...args) {\n  if (\n    name === `warning` &&\n    typeof data === `object` &&\n    data.name === `ExperimentalWarning`\n    //if you want to only stop certain messages, test for the message here:\n    //&& data.message.includes(`Fetch API`)\n  ) {\n    return false;\n  }\n  return originalEmit.apply(process, arguments);\n};\n\nimport '../build/cli.js'\n"
  },
  {
    "path": "packages/cli/default/client.yml",
    "content": "version: 2.0\n\nagent:\n  $require: '@veramo/core#Agent'\n  $args:\n    - schemaValidation: false\n      plugins:\n        - $require: '@veramo/remote-client#AgentRestClient'\n          $args:\n            - url: http://localhost:3332\n              # headers:\n              #   Authorization: Bearer API_KEY\n              enabledMethods:\n                - keyManagerGetKeyManagementSystems\n                - keyManagerCreate\n                - keyManagerGet\n                - keyManagerDelete\n                - keyManagerImport\n                - keyManagerEncryptJWE\n                - keyManagerDecryptJWE\n                - keyManagerSign\n                - keyManagerSharedSecret\n                - keyManagerSignJWT\n                - keyManagerSignEthTX\n                - didManagerGetProviders\n                - didManagerFind\n                - didManagerGet\n                - didManagerCreate\n                - didManagerGetOrCreate\n                - didManagerImport\n                - didManagerDelete\n                - didManagerAddKey\n                - didManagerRemoveKey\n                - didManagerAddService\n                - didManagerRemoveService\n                - resolveDid\n                - getDIDComponentById\n                - discoverDid\n                - dataStoreGetMessage\n                - dataStoreSaveMessage\n                - dataStoreGetVerifiableCredential\n                - dataStoreSaveVerifiableCredential\n                - dataStoreGetVerifiablePresentation\n                - dataStoreSaveVerifiablePresentation\n                - dataStoreORMGetIdentifiers\n                - dataStoreORMGetIdentifiersCount\n                - dataStoreORMGetMessages\n                - dataStoreORMGetMessagesCount\n                - dataStoreORMGetVerifiableCredentialsByClaims\n                - dataStoreORMGetVerifiableCredentialsByClaimsCount\n                - dataStoreORMGetVerifiableCredentials\n                - dataStoreORMGetVerifiableCredentialsCount\n                - dataStoreORMGetVerifiablePresentations\n                - dataStoreORMGetVerifiablePresentationsCount\n                - handleMessage\n                - packDIDCommMessage\n                - unpackDIDCommMessage\n                - sendDIDCommMessage\n                - sendMessageDIDCommAlpha1\n                - createVerifiableCredential\n                - createVerifiablePresentation\n                - verifyCredential\n                - verifyPresentation\n                - createSelectiveDisclosureRequest\n                - getVerifiableCredentialsForSdr\n                - validatePresentationAgainstSdr\n\n"
  },
  {
    "path": "packages/cli/default/default.yml",
    "content": "version: 3.0\n\nconstants:\n  baseUrl: http://localhost:3332\n  port: 3332\n  # please use your own X25519 key, this is only an example\n  # you can generate a new key by running `veramo config gen-key` in a terminal\n  dbEncryptionKey: 29739248cad1bd1a0fc4d9b75cd4d2990de535baf5caadfdf8d8f86664aa830c\n  databaseFile: ./database.sqlite\n  methods:\n    - keyManagerGetKeyManagementSystems\n    - keyManagerCreate\n    - keyManagerGet\n    - keyManagerDelete\n    - keyManagerImport\n    - keyManagerEncryptJWE\n    - keyManagerDecryptJWE\n    - keyManagerSign\n    - keyManagerSharedSecret\n    - keyManagerSignJWT\n    - keyManagerSignEthTX\n    - didManagerGetProviders\n    - didManagerFind\n    - didManagerGet\n    - didManagerGetByAlias\n    - didManagerCreate\n    - didManagerGetOrCreate\n    - didManagerImport\n    - didManagerDelete\n    - didManagerAddKey\n    - didManagerRemoveKey\n    - didManagerAddService\n    - didManagerRemoveService\n    - resolveDid\n    - getDIDComponentById\n    - discoverDid\n    - dataStoreGetMessage\n    - dataStoreSaveMessage\n    - dataStoreGetVerifiableCredential\n    - dataStoreSaveVerifiableCredential\n    - dataStoreGetVerifiablePresentation\n    - dataStoreSaveVerifiablePresentation\n    - dataStoreORMGetIdentifiers\n    - dataStoreORMGetIdentifiersCount\n    - dataStoreORMGetMessages\n    - dataStoreORMGetMessagesCount\n    - dataStoreORMGetVerifiableCredentialsByClaims\n    - dataStoreORMGetVerifiableCredentialsByClaimsCount\n    - dataStoreORMGetVerifiableCredentials\n    - dataStoreORMGetVerifiableCredentialsCount\n    - dataStoreORMGetVerifiablePresentations\n    - dataStoreORMGetVerifiablePresentationsCount\n    - handleMessage\n    - packDIDCommMessage\n    - unpackDIDCommMessage\n    - sendDIDCommMessage\n    - sendMessageDIDCommAlpha1\n    - createVerifiableCredential\n    - createVerifiablePresentation\n    - verifyCredential\n    - verifyPresentation\n    - createSelectiveDisclosureRequest\n    - getVerifiableCredentialsForSdr\n    - validatePresentationAgainstSdr\n\n# Data base\ndbConnection:\n  $require: typeorm#DataSource\n  $args:\n    - type: sqlite\n      database:\n        $ref: /constants/databaseFile\n      synchronize: false\n      migrationsRun: true\n      migrations:\n        $require: \"@veramo/data-store?t=object#migrations\"\n      logging: false\n      entities:\n        $require: \"@veramo/data-store?t=object#Entities\"\n\n# Server configuration\nserver:\n  baseUrl:\n    $ref: /constants/baseUrl\n  port:\n    $ref: /constants/port\n  use:\n    # CORS\n    - - $require: \"cors?t=function#default\"\n\n    # Add agent to the request object\n    - - $require: \"@veramo/remote-server?t=function#RequestWithAgentRouter\"\n        $args:\n          - agent:\n              $ref: /agent\n\n    # DID Documents\n    - - $require: \"@veramo/remote-server?t=function#WebDidDocRouter\"\n\n    # API base path\n    - - /messaging\n      - $require: \"@veramo/remote-server?t=function#MessagingRouter\"\n        $args:\n          - metaData:\n              type: DIDComm\n              value: https\n\n    # API base path\n    - - /agent\n      - $require: \"@veramo/remote-server?t=function#apiKeyAuth\"\n        $args:\n          - apiKey: test123\n      - $require: \"@veramo/remote-server?t=function#AgentRouter\"\n        $args:\n          - exposedMethods:\n              $ref: /constants/methods\n\n    # Open API schema\n    - - /open-api.json\n      - $require: \"@veramo/remote-server?t=function#ApiSchemaRouter\"\n        $args:\n          - basePath: :3332/agent\n            securityScheme: bearer\n            apiName: Agent\n            apiVersion: \"1.0.0\"\n            exposedMethods:\n              $ref: /constants/methods\n\n    # Swagger docs\n    - - /api-docs\n      - $require: swagger-ui-express?t=object#serve\n      - $require: swagger-ui-express?t=function#setup\n        $args:\n          - null\n          - swaggerOptions:\n              url: \"/open-api.json\"\n\n  # Execute during server initialization\n  init:\n    - $require: \"@veramo/remote-server?t=function#createDefaultDid\"\n      $args:\n        - agent:\n            $ref: /agent\n          baseUrl:\n            $ref: /constants/baseUrl\n          messagingServiceEndpoint: /messaging\n\n# Message handler plugin\nmessageHandler:\n  $require: \"@veramo/message-handler#MessageHandler\"\n  $args:\n    - messageHandlers:\n        - $require: \"@veramo/did-comm#DIDCommMessageHandler\"\n        - $require: \"@veramo/did-comm#TrustPingMessageHandler\"\n        - $require: \"@veramo/did-jwt#JwtMessageHandler\"\n        - $require: \"@veramo/credential-w3c#W3cMessageHandler\"\n        - $require: \"@veramo/selective-disclosure#SdrMessageHandler\"\n\n# DID resolvers\ndidResolver:\n  $require: \"@veramo/did-resolver#DIDResolverPlugin\"\n  $args:\n    - ethr:\n        $ref: /ethr-did-resolver\n      web:\n        $ref: /web-did-resolver\n      key:\n        $ref: /did-key-resolver\n      peer:\n        $require: \"@veramo/did-provider-peer?t=function&p=/peer#getResolver\"\n      jwk:\n        $require: \"@veramo/did-provider-jwk?t=function&p=/jwk#getDidJwkResolver\"\n      pkh:\n        $require: \"@veramo/did-provider-pkh?t=function&p=/pkh#getDidPkhResolver\"\n      elem:\n        $ref: /universal-resolver\n      io:\n        $ref: /universal-resolver\n      ion:\n        $ref: /universal-resolver\n      sov:\n        $ref: /universal-resolver\n\nethr-did-resolver:\n  $require: ethr-did-resolver?t=function&p=/ethr#getResolver\n  $args:\n    - infuraProjectId: 3586660d179141e3801c3895de1c2eba\n\nweb-did-resolver:\n  $require: web-did-resolver?t=function&p=/web#getResolver\n\nuniversal-resolver:\n  $require: \"@veramo/did-resolver#UniversalResolver\"\n  $args:\n    - url: https://dev.uniresolver.io/1.0/identifiers/\n\ndid-key-resolver:\n  $require: \"@veramo/did-provider-key?t=function&p=/key#getDidKeyResolver\"\n\n# Key Manager\nkeyManager:\n  $require: \"@veramo/key-manager#KeyManager\"\n  $args:\n    - store:\n        $require: \"@veramo/data-store#KeyStore\"\n        $args:\n          - $ref: /dbConnection\n      kms:\n        local:\n          $require: \"@veramo/kms-local#KeyManagementSystem\"\n          $args:\n            - $require: \"@veramo/data-store#PrivateKeyStore\"\n              $args:\n                - $ref: /dbConnection\n                - $require: \"@veramo/kms-local#SecretBox\"\n                  $args:\n                    - $ref: /constants/dbEncryptionKey\n\n# DID Manager\ndidManager:\n  $require: \"@veramo/did-manager#DIDManager\"\n  $args:\n    - store:\n        $require: \"@veramo/data-store#DIDStore\"\n        $args:\n          - $ref: /dbConnection\n      defaultProvider: did:ethr:sepolia\n      providers:\n        did:ethr:\n          $require: \"@veramo/did-provider-ethr#EthrDIDProvider\"\n          $args:\n            - defaultKms: local\n              network: mainnet\n              rpcUrl: https://mainnet.infura.io/v3/3586660d179141e3801c3895de1c2eba\n              gas: 1000001\n              ttl: 31104001\n        did:ethr:sepolia:\n          $require: \"@veramo/did-provider-ethr#EthrDIDProvider\"\n          $args:\n            - defaultKms: local\n              network: sepolia\n              rpcUrl: https://sepolia.infura.io/v3/3586660d179141e3801c3895de1c2eba\n              gas: 1000001\n              ttl: 31104001\n        did:web:\n          $require: \"@veramo/did-provider-web#WebDIDProvider\"\n          $args:\n            - defaultKms: local\n        did:key:\n          $require: \"@veramo/did-provider-key#KeyDIDProvider\"\n          $args:\n            - defaultKms: local\n        did:jwk:\n          $require: \"@veramo/did-provider-jwk#JwkDIDProvider\"\n          $args:\n            - defaultKms: local\n        did:peer:\n          $require: \"@veramo/did-provider-peer#PeerDIDProvider\"\n          $args:\n            - defaultKms: local\n        did:pkh:\n          $require: \"@veramo/did-provider-pkh#PkhDIDProvider\"\n          $args:\n            - defaultKms: local\n              chainId: 1\n\ndidDiscovery:\n  $require: \"@veramo/did-discovery#DIDDiscovery\"\n  $args:\n    - providers:\n        - $require: \"@veramo/did-manager#AliasDiscoveryProvider\"\n        - $require: \"@veramo/data-store#DataStoreDiscoveryProvider\"\n\n# W3C credentialPlugin\nCredentialProviderLD:\n  $require: \"@veramo/credential-ld#CredentialProviderLD\"\n  $args:\n    - suites:\n        - $require: \"@veramo/credential-ld#VeramoEd25519Signature2018\"\n        - $require: \"@veramo/credential-ld#VeramoEd25519Signature2020\"\n        - $require: \"@veramo/credential-ld#VeramoJsonWebSignature2020\"\n        - $require: \"@veramo/credential-ld#VeramoEcdsaSecp256k1RecoverySignature2020\"\n      contextMaps:\n        # The LdDefaultContext is a \"catch-all\" for now.\n        - $require: \"@veramo/credential-ld?t=object#LdDefaultContexts\"\n        - $require: \"@transmute/credentials-context?t=object#contexts\"\n        #  others should be included here\n\nCredentialProviderJWT:\n  $require: \"@veramo/credential-jwt#CredentialProviderJWT\"\n\ncredentialPlugin:\n  $require: \"@veramo/credential-w3c#CredentialPlugin\"\n  $args:\n    - - $ref: /CredentialProviderLD\n      - $ref: /CredentialProviderJWT\n\n# Agent\nagent:\n  $require: \"@veramo/core#Agent\"\n  $args:\n    - schemaValidation: false\n      plugins:\n        - $ref: /keyManager\n        - $ref: /didManager\n        - $ref: /didResolver\n        - $ref: /didDiscovery\n        - $ref: /messageHandler\n        - $require: \"@veramo/did-comm#DIDComm\"\n        - $ref: /credentialPlugin\n        - $require: \"@veramo/selective-disclosure#SelectiveDisclosure\"\n        - $require: \"@veramo/data-store#DataStore\"\n          $args:\n            - $ref: /dbConnection\n        - $require: \"@veramo/data-store#DataStoreORM\"\n          $args:\n            - $ref: /dbConnection\n"
  },
  {
    "path": "packages/cli/package.json",
    "content": "{\n  \"name\": \"@veramo/cli\",\n  \"description\": \"Veramo command line application.\",\n  \"version\": \"7.0.0\",\n  \"exports\": {\n    \".\": {\n      \"types\": \"./build/cli.d.ts\",\n      \"import\": \"./build/cli.js\"\n    },\n    \"./build/setup\": {\n      \"types\": \"./build/setup.d.ts\",\n      \"import\": \"./build/setup.js\"\n    },\n    \"./build/lib/objectCreator\": {\n      \"types\": \"./build/lib/objectCreator.d.ts\",\n      \"import\": \"./build/lib/objectCreator.js\"\n    },\n    \"./build/lib/agentCreator\": {\n      \"types\": \"./build/lib/agentCreator.d.ts\",\n      \"import\": \"./build/lib/agentCreator.js\"\n    },\n    \"./package.json\": \"./package.json\"\n  },\n  \"main\": \"build/cli.js\",\n  \"types\": \"build/cli.d.ts\",\n  \"bin\": {\n    \"veramo\": \"bin/veramo.js\"\n  },\n  \"scripts\": {\n    \"build\": \"tsc\",\n    \"watch\": \"tsc -b --watch\",\n    \"update-veramo-next\": \"pnpm add @veramo/core@next @veramo/discovery@next @veramo/remote-client@next @veramo/remote-server@next @veramo/did-provider-key@next @veramo/did-resolver@next @veramo/did-jwt@next @veramo/credential-w3c@next @veramo/did-provider-ethr@next @veramo/did-provider-web@next @veramo/did-comm@next @veramo/kms-local@next @veramo/selective-disclosure@next @veramo/data-store@next @veramo/key-manager@next @veramo/message-handler@next @veramo/did-manager@next @veramo/url-handler@next @veramo/credential-eip712@next @veramo/utils@next\",\n    \"update-veramo-latest\": \"pnpm add @veramo/core@latest @veramo/discovery@latest @veramo/remote-client@latest @veramo/remote-server@latest @veramo/did-provider-key@latest @veramo/did-resolver@latest @veramo/did-jwt@latest @veramo/credential-w3c@latest @veramo/did-provider-ethr@latest @veramo/did-provider-web@latest @veramo/did-comm@latest @veramo/kms-local@latest @veramo/selective-disclosure@latest @veramo/data-store@latest @veramo/key-manager@latest @veramo/message-handler@latest @veramo/did-manager@latest @veramo/url-handler@latest @veramo/credential-eip712@latest @veramo/utils@latest\"\n  },\n  \"dependencies\": {\n    \"@microsoft/api-extractor\": \"^7.40.6\",\n    \"@microsoft/api-extractor-model\": \"^7.28.13\",\n    \"@transmute/credentials-context\": \"^0.7.0-unstable.82\",\n    \"@types/blessed\": \"^0.1.25\",\n    \"@types/swagger-ui-express\": \"^4.1.6\",\n    \"@veramo/core\": \"workspace:^\",\n    \"@veramo/core-types\": \"workspace:^\",\n    \"@veramo/credential-eip712\": \"workspace:^\",\n    \"@veramo/credential-jwt\": \"workspace:^\",\n    \"@veramo/credential-ld\": \"workspace:^\",\n    \"@veramo/credential-w3c\": \"workspace:^\",\n    \"@veramo/data-store\": \"workspace:^\",\n    \"@veramo/did-comm\": \"workspace:^\",\n    \"@veramo/did-discovery\": \"workspace:^\",\n    \"@veramo/did-jwt\": \"workspace:^\",\n    \"@veramo/did-manager\": \"workspace:^\",\n    \"@veramo/did-provider-ethr\": \"workspace:^\",\n    \"@veramo/did-provider-jwk\": \"workspace:^\",\n    \"@veramo/did-provider-key\": \"workspace:^\",\n    \"@veramo/did-provider-peer\": \"workspace:^\",\n    \"@veramo/did-provider-pkh\": \"workspace:^\",\n    \"@veramo/did-provider-web\": \"workspace:^\",\n    \"@veramo/did-resolver\": \"workspace:^\",\n    \"@veramo/key-manager\": \"workspace:^\",\n    \"@veramo/kms-local\": \"workspace:^\",\n    \"@veramo/kv-store\": \"workspace:^\",\n    \"@veramo/mediation-manager\": \"workspace:^\",\n    \"@veramo/message-handler\": \"workspace:^\",\n    \"@veramo/remote-client\": \"workspace:^\",\n    \"@veramo/remote-server\": \"workspace:^\",\n    \"@veramo/selective-disclosure\": \"workspace:^\",\n    \"@veramo/url-handler\": \"workspace:^\",\n    \"@veramo/utils\": \"workspace:^\",\n    \"blessed\": \"^0.1.81\",\n    \"commander\": \"^12.0.0\",\n    \"console-table-printer\": \"^2.12.0\",\n    \"cors\": \"^2.8.5\",\n    \"cross-fetch\": \"^4.0.0\",\n    \"date-fns\": \"^3.3.1\",\n    \"debug\": \"^4.3.4\",\n    \"did-resolver\": \"^4.1.0\",\n    \"dotenv\": \"^16.4.5\",\n    \"ethr-did-resolver\": \"^11.0.2\",\n    \"express\": \"^4.18.2\",\n    \"express-handlebars\": \"^7.1.2\",\n    \"fuzzy\": \"^0.1.3\",\n    \"handlebars\": \"^4.7.8\",\n    \"inquirer\": \"^9.2.15\",\n    \"inquirer-autocomplete-prompt\": \"^3.0.1\",\n    \"json-schema\": \"^0.4.0\",\n    \"json5\": \"^2.2.3\",\n    \"jsonpointer\": \"^5.0.1\",\n    \"openapi-types\": \"^12.1.3\",\n    \"passport\": \"^0.7.0\",\n    \"passport-http-bearer\": \"^1.0.1\",\n    \"pg\": \"^8.11.3\",\n    \"qrcode-terminal\": \"^0.12.0\",\n    \"sqlite3\": \"^5.1.7\",\n    \"swagger-ui-express\": \"^5.0.0\",\n    \"ts-json-schema-generator\": \"^2.0.0\",\n    \"typeorm\": \"^0.3.20\",\n    \"url-parse\": \"^1.5.10\",\n    \"web-did-resolver\": \"^2.0.27\",\n    \"ws\": \"^8.16.0\",\n    \"yaml\": \"^2.3.4\"\n  },\n  \"devDependencies\": {\n    \"@types/debug\": \"4.1.8\",\n    \"@types/express\": \"4.17.17\",\n    \"@types/inquirer\": \"9.0.3\",\n    \"@types/inquirer-autocomplete-prompt\": \"3.0.0\",\n    \"@types/node-fetch\": \"3.0.3\",\n    \"@types/passport-http-bearer\": \"1.0.37\",\n    \"@types/qrcode-terminal\": \"0.12.0\",\n    \"@types/url-parse\": \"1.4.8\",\n    \"@types/ws\": \"8.5.5\",\n    \"typescript\": \"5.7.3\"\n  },\n  \"files\": [\n    \"bin/**/*\",\n    \"build/**/*\",\n    \"default/**/*\",\n    \"src/**/*\",\n    \"views/**/*\",\n    \"README.md\",\n    \"LICENSE\"\n  ],\n  \"publishConfig\": {\n    \"access\": \"public\"\n  },\n  \"repository\": {\n    \"type\": \"git\",\n    \"url\": \"https://github.com/decentralized-identity/veramo.git\",\n    \"directory\": \"packages/cli\"\n  },\n  \"author\": \"Consensys Mesh R&D <hello@veramo.io>\",\n  \"contributors\": [\n    \"Simonas Karuzas <simonas.karuzas@mesh.xyz>\",\n    \"Mircea Nistor <mircea.nistor@mesh.xyz>\"\n  ],\n  \"keywords\": [\n    \"Veramo\",\n    \"CLI\",\n    \"DID\",\n    \"Verifiable Credential\"\n  ],\n  \"license\": \"Apache-2.0\",\n  \"type\": \"module\",\n  \"moduleDirectories\": [\n    \"node_modules\",\n    \"src\"\n  ]\n}\n"
  },
  {
    "path": "packages/cli/src/__tests__/cli.test.ts",
    "content": "import { veramo } from '../createCommand.js'\nimport { jest } from '@jest/globals'\nimport { createObjects } from '../lib/objectCreator'\nimport { getConfig } from '../setup'\n\ndescribe('cli version', () => {\n  const writeMock = jest.fn()\n\n  beforeAll(() => {\n    // veramo\n    //   .exitOverride()\n    //   .configureOutput({ writeOut: writeMock })\n  })\n\n  afterAll(() => {\n    jest.clearAllMocks()\n  })\n\n  it('should load the dbConnection', async () => {\n    const { dbConnection } = await createObjects(await getConfig('./packages/cli/default/default.yml'), {\n      dbConnection: '/dbConnection',\n    })\n    expect(dbConnection).toBeDefined()\n  })\n\n  // this seems to fail because of an incompatibility between jest and the `multiformats@11` transitive dependency\n  it('should load the agent', async () => {\n    const { agent } = await createObjects(await getConfig('./packages/cli/default/default.yml'), {\n      agent: '/agent',\n    })\n    expect(agent).toBeDefined()\n  })\n\n  // this seems to fail because of some timing issues or an incompatibility with the `chalk` transitive dependency\n  it.skip('should list version number', async () => {\n    expect(() => {\n      // veramo.parse(['--version'], { from: 'user' })\n    }).toThrow()\n    expect(writeMock).toHaveBeenCalledWith(expect.stringMatching(/^\\d\\.\\d\\.\\d\\n?$/))\n  })\n\n  // this seems to fail because of some timing issues or an incompatibility with the `chalk` transitive dependency\n  it.skip('should check the default config', async () => {\n    expect(() => {\n      // veramo.parse(['config', 'check', '-f', './packages/cli/default/default.yml'], { from: 'user' })\n    }).toThrow(/hello/)\n    expect(writeMock).toHaveBeenCalledWith(expect.stringMatching(/^\\d\\.\\d\\.\\d\\n?$/))\n  })\n})\n"
  },
  {
    "path": "packages/cli/src/cli.ts",
    "content": "import inquirer from 'inquirer'\nimport inquirerAutoPrompt from 'inquirer-autocomplete-prompt'\n\ninquirer.registerPrompt('autocomplete', inquirerAutoPrompt)\nimport { veramo } from './createCommand.js'\n\nif (!process.argv.slice(2).length) {\n  veramo.outputHelp()\n} else {\n  veramo.parse(process.argv)\n}\n"
  },
  {
    "path": "packages/cli/src/config.ts",
    "content": "import { Command } from 'commander'\nimport { SecretBox } from '@veramo/kms-local'\nimport { getAgent } from './setup.js'\nimport fs from 'fs'\nimport { dirname } from 'path'\n\nimport * as url from 'url'\n\nconst __dirname = url.fileURLToPath(new URL('.', import.meta.url))\n\nconst config = new Command('config').description('Agent configuration')\n\nconfig\n  .command('create', { isDefault: true })\n  .description('Create default agent config')\n  .option('--filename <string>', 'Config file name', './agent.yml')\n  .option('--template <string>', 'Use template (default,client)', 'default')\n\n  .action(async (options) => {\n    const { filename, template } = options\n\n    const templateFile = __dirname + '/../default/' + template + '.yml'\n    if (!fs.existsSync(templateFile)) {\n      console.log('Template not available: ' + template)\n      process.exit(1)\n    }\n\n    if (!fs.existsSync(dirname(filename))) {\n      fs.mkdirSync(dirname(filename))\n    }\n\n    if (!fs.existsSync(filename)) {\n      console.log('Creating: ' + filename)\n      const contents = fs.readFileSync(templateFile)\n      fs.writeFileSync(filename, contents)\n    } else {\n      console.log('File already exists: ' + filename)\n    }\n  })\n\nconfig\n  .command('create-secret-key')\n  .alias('gen-key')\n  .alias('key-gen')\n  .alias('keygen')\n  .alias('genkey')\n  .description('generate secret key')\n  .option('-q, --quiet', 'Only print the raw key, no instructions', false)\n  .action(async (options) => {\n    try {\n      const dbEncryptionKey = await SecretBox.createSecretKey()\n      if (options.quiet === true) {\n        console.log(dbEncryptionKey)\n      } else {\n        console.log(`\n        X25519 raw private key (hex encoded):\n  \n        ${dbEncryptionKey}\n  \n        You can use this key with @veramo/kms-local#SecretBox\n        or replace the default agent.yml 'dbEncryptionKey' constant\n        `)\n      }\n    } catch (e: any) {\n      console.error(e.message)\n    }\n  })\n\nconfig\n  .command('check')\n  .alias('verify')\n  .description('Verify an agent config file syntax')\n  .option('-f, --filename <string>', 'Config file name', './agent.yml')\n  .option('-m, --method <string>', 'Check that a specific method is exposed by the agent.', 'execute')\n  .action(async (options) => {\n    const agent = await getAgent(options.filename)\n    if (!agent) {\n      console.error(\n        'unknown error while creating the agent from your config. Consider running `veramo config create` to generate a new configuration file, or to manually compare differences.',\n      )\n    } else {\n      if (typeof agent[options.method] !== 'function') {\n        console.error(\n          `The agent was created using the config, but the 'agent.${options.method}()' method is not available. Make sure the plugin that implements that method is installed.`,\n        )\n      } else {\n        console.log(\n          `Your Veramo configuration seems fine. An agent can be created and the 'agent.${options.method}()' method can be called on it.`,\n        )\n      }\n    }\n  })\n\nexport { config }\n"
  },
  {
    "path": "packages/cli/src/createCommand.ts",
    "content": "import { Command } from 'commander'\nimport module from 'module'\n\nimport { config } from './config.js'\nimport { credential } from './credential.js'\nimport { dev } from './dev.js'\nimport { did } from './did.js'\nimport { discover } from './discover.js'\nimport { execute } from './execute.js'\nimport { message } from './message.js'\nimport { presentation } from './presentation.js'\nimport { explore } from './explore/index.js'\nimport { sdr } from './sdr.js'\nimport { server } from './server.js'\nimport { mediate } from './mediate.js'\n\nconst requireCjs = module.createRequire(import.meta.url)\nconst { version } = requireCjs('../package.json')\n\nconst veramo = new Command('veramo')\n  .version(version, '-v, --version')\n  .option('--config <string>', 'Configuration file', './agent.yml')\n  .addCommand(config)\n  .addCommand(credential)\n  .addCommand(dev)\n  .addCommand(did)\n  .addCommand(discover)\n  .addCommand(execute)\n  .addCommand(explore)\n  .addCommand(message)\n  .addCommand(presentation)\n  .addCommand(sdr)\n  .addCommand(server)\n  .addCommand(mediate)\n\nexport { veramo }\n"
  },
  {
    "path": "packages/cli/src/credential.ts",
    "content": "import { getAgent } from './setup.js'\nimport { Command } from 'commander'\nimport inquirer from 'inquirer'\nimport qrcode from 'qrcode-terminal'\nimport * as fs from 'fs'\nimport json5 from 'json5'\nimport { readStdin } from './util.js'\nimport { CredentialPayload } from '@veramo/core-types'\nimport Debug from 'debug'\n\nimport fuzzy from 'fuzzy'\n\nconst debug = Debug('veramo:cli:credential')\nconst credential = new Command('credential').description('W3C Verifiable Credential')\n\ncredential\n  .command('create')\n  .description('Create W3C Verifiable Credential (for demo purposes)')\n  .option('-j, --json', 'Output in JSON')\n  .option('-q, --qrcode', 'Show qrcode')\n  .action(async (opts: { send: boolean; qrcode: boolean; json: boolean }, cmd: Command) => {\n    const agent = await getAgent(cmd.optsWithGlobals().config)\n    const identifiers = await agent.didManagerFind()\n\n    const knownDids = await agent.dataStoreORMGetIdentifiers()\n    const subjects = [...knownDids.map((id) => id.did)]\n\n    if (identifiers.length === 0) {\n      console.error('No dids')\n      process.exit()\n    }\n    const issuersQuery = await inquirer.prompt([\n      {\n        type: 'list',\n        name: 'iss',\n        choices: identifiers.map((item) => ({\n          name: `${item.did} ${item.alias}`,\n          value: item.did,\n        })),\n        message: 'Issuer DID',\n      },\n    ])\n    const issuer = await agent.didManagerGet({ did: issuersQuery.iss })\n    const usableProofFormats = await agent.listUsableProofFormats(issuer)\n    const answers = await inquirer.prompt([\n      {\n        type: 'list',\n        name: 'proofFormat',\n        choices: usableProofFormats,\n        message: 'Credential proofFormat',\n      },\n      {\n        type: 'autocomplete',\n        name: 'sub',\n        pageSize: 15,\n        source: async (answers: any, input: string) => {\n          const res = fuzzy\n            .filter(input, subjects)\n            .map((el: any) => (typeof el === 'string' ? el : el.original))\n          return res\n        },\n        message: 'Subject DID',\n      },\n      {\n        type: 'input',\n        name: 'type',\n        message: 'Credential Type',\n        default: 'VerifiableCredential,Profile',\n      },\n      {\n        type: 'input',\n        name: 'claimType',\n        message: 'Claim Type',\n        default: 'name',\n      },\n      {\n        type: 'input',\n        name: 'claimValue',\n        message: 'Claim Value',\n        default: 'Alice',\n      },\n    ])\n\n    const credentialSubject: any = {}\n    credentialSubject.id = answers.sub\n    const type: string = answers.claimType\n    credentialSubject[type] = answers.claimValue\n\n    const credential: CredentialPayload = {\n      issuer: { id: issuersQuery.iss },\n      '@context': ['https://www.w3.org/2018/credentials/v1', 'https://veramo.io/contexts/profile/v1'],\n      type: answers.type.split(','),\n      issuanceDate: new Date().toISOString(),\n      credentialSubject,\n    }\n\n    const verifiableCredential = await agent.createVerifiableCredential({\n      credential,\n      proofFormat: answers.proofFormat,\n    })\n\n    try {\n      const saved = await agent.dataStoreSaveVerifiableCredential({ verifiableCredential })\n    } catch (e: any) {\n      debug('could not save credential', e)\n    }\n\n    if (opts.qrcode) {\n      qrcode.generate(verifiableCredential.proof.jwt)\n    } else {\n      if (opts.json) {\n        console.log(JSON.stringify(verifiableCredential))\n      } else {\n        console.dir(verifiableCredential, { depth: 10 })\n      }\n    }\n  })\n\ncredential\n  .command('verify')\n  .description('Verify a W3C Verifiable Credential provided as raw string, file or stdin')\n  .option('-f, --filename <string>', 'Optional. Read the credential from a file instead of stdin')\n  .option('-r, --raw <string>', 'Optional. Specify the credential as a parameter instead of file or stdin')\n  .action(async (options: { raw: string; filename: string }, cmd: Command) => {\n    const agent = await getAgent(cmd.optsWithGlobals().config)\n    let raw: string = ''\n    if (options.raw) {\n      raw = options.raw\n    } else if (options.filename) {\n      raw = await fs.promises.readFile(options.filename, 'utf-8')\n    } else {\n      console.log('Please provide the credential as a JWT or JSON string. Press Ctrl+D to finish.')\n      raw = await readStdin()\n    }\n    let parsedCredential: any\n    try {\n      parsedCredential = json5.parse(raw)\n    } catch (e: any) {\n      debug('Could not parse credential as JSON5', e.message)\n      parsedCredential = raw\n    }\n    try {\n      const result = await agent.verifyCredential({ credential: parsedCredential })\n      if (result.verified === true) {\n        console.log('Credential was verified successfully.')\n      } else {\n        console.error('Credential could not be verified.')\n      }\n    } catch (e) {\n      console.error(e.message)\n    }\n  })\n\ncredential\n  .command('output')\n  .description('Print W3C Verifiable Credential to stdout')\n  .action(async (opts: {}, cmd: Command) => {\n    const agent = await getAgent(cmd.optsWithGlobals().config)\n\n    const credentials = await agent.dataStoreORMGetVerifiableCredentials()\n\n    if (credentials.length > 0) {\n      const list: any = []\n      for (const cred of credentials) {\n        list.push({\n          name:\n            JSON.stringify(cred.verifiableCredential.credentialSubject) +\n            ' | Issuer: ' +\n            JSON.stringify(cred.verifiableCredential.issuer),\n          value: cred,\n        })\n      }\n\n      const answers = await inquirer.prompt([\n        {\n          type: 'list',\n          name: 'credential',\n          choices: list,\n          message: 'Select credential',\n        },\n      ])\n\n      console.dir(answers.credential, { depth: 10 })\n    } else {\n      console.log('No credentials found.')\n    }\n  })\n\nexport { credential }\n"
  },
  {
    "path": "packages/cli/src/dev.ts",
    "content": "import { Extractor, ExtractorConfig, ExtractorResult } from '@microsoft/api-extractor'\nimport {\n  ApiMethodSignature,\n  ApiModel,\n  ApiParameterListMixin,\n  ApiReturnTypeMixin,\n} from '@microsoft/api-extractor-model'\nimport { Command } from 'commander'\nimport { writeFileSync } from 'fs'\nimport { OpenAPIV3 } from 'openapi-types'\nimport { resolve } from 'path'\nimport * as TJS from 'ts-json-schema-generator'\n\nimport module from 'module'\n\nconst requireCjs = module.createRequire(import.meta.url)\n\ninterface Method {\n  packageName: string\n  pluginInterfaceName: string\n  operationId: string\n  description?: string\n  parameters?: string\n  response: string\n}\n\nconst genericTypes = ['boolean', 'string', 'number', 'any', 'Array<string>']\n\nfunction createSchema(generator: TJS.SchemaGenerator, symbol: string) {\n  if (genericTypes.includes(symbol)) {\n    return { components: { schemas: {} } }\n  }\n\n  let fixedSymbol = symbol.replace(/Array\\<(.*)\\>/gm, '$1')\n\n  const schema = generator.createSchema(fixedSymbol)\n\n  const newSchema = {\n    components: {\n      schemas: schema.definitions,\n    },\n  }\n\n  let schemaStr = JSON.stringify(newSchema, null, 2)\n\n  schemaStr = schemaStr.replace(/#\\/definitions\\//gm, '#/components/schemas/')\n  schemaStr = schemaStr.replace(/\\\"patternProperties\\\":{([^:]*):{[^}]*}}/gm, '\"pattern\": $1')\n  schemaStr = schemaStr.replace(/Verifiable\\<(.*)\\>/gm, 'Verifiable-$1')\n  schemaStr = schemaStr.replace(/Where\\<(.*)\\>/gm, 'Where-$1')\n  schemaStr = schemaStr.replace(/Order\\<(.*)\\>/gm, 'Order-$1')\n  schemaStr = schemaStr.replace(/FindArgs\\<(.*)\\>/gm, 'FindArgs-$1')\n  schemaStr = schemaStr.replace(/https \\:\\/\\//gm, 'https://')\n  // a bug in the schema generator stack mangles @link tags with text.\n  schemaStr = schemaStr.replace(/\\{@link\\s+([^|}]+?)\\s([^|}]+)\\s}/g, '{@link $1 | $2 }')\n  return JSON.parse(schemaStr)\n}\n\nfunction getReference(response: string): OpenAPIV3.ReferenceObject | OpenAPIV3.SchemaObject {\n  if (!response) {\n    return { type: 'object' }\n  }\n\n  if (response.slice(0, 6) === 'Array<') {\n    const symbol = response.replace('Array<', '').replace('>', '') as\n      | 'string'\n      | 'number'\n      | 'boolean'\n      | 'object'\n      | 'integer'\n    return {\n      type: 'array',\n      items: genericTypes.includes(symbol) ? { type: symbol } : { $ref: '#/components/schemas/' + symbol },\n    }\n  }\n  if (response === 'any') {\n    return { type: 'object' }\n  }\n\n  if (['string', 'number', 'boolean', 'object', 'integer'].includes(response)) {\n    // @ts-ignore\n    return { type: response }\n  } else {\n    return { $ref: '#/components/schemas/' + response }\n  }\n}\n\nconst dev = new Command('dev').description('Plugin developer tools')\n\ndev\n  .command('generate-plugin-schema')\n  .description('generate plugin schema')\n  .option('-c, --extractorConfig <string>', 'API Extractor config file', './api-extractor.json')\n  .option(\n    '-p, --packageConfig <string>',\n    'package.json file containing a Veramo plugin interface config',\n    './package.json',\n  )\n  .option('-o, --output <string>', 'Output file of the schema', './src/plugin.schema.ts')\n\n  .action(async (options) => {\n    const apiExtractorJsonPath: string = resolve(options.extractorConfig)\n    const outPutPath: string = resolve(options.output)\n    const extractorConfig: ExtractorConfig = ExtractorConfig.loadFileAndPrepare(apiExtractorJsonPath)\n\n    const extractorResult: ExtractorResult = Extractor.invoke(extractorConfig, {\n      localBuild: true,\n      showVerboseMessages: true,\n    })\n\n    if (!extractorResult.succeeded) {\n      console.error(\n        `API Extractor completed with ${extractorResult.errorCount} errors` +\n          ` and ${extractorResult.warningCount} warnings`,\n      )\n      process.exitCode = 1\n    }\n\n    const packageConfig = requireCjs(resolve(options.packageConfig))\n    const interfaces: any = {}\n\n    for (const pluginInterfaceName in packageConfig?.veramo?.pluginInterfaces) {\n      const entryFile = packageConfig.veramo.pluginInterfaces[pluginInterfaceName]\n      const api = {\n        components: {\n          schemas: {},\n          methods: {},\n        },\n      }\n\n      const generator = TJS.createGenerator({\n        path: resolve(entryFile),\n        encodeRefs: false,\n        additionalProperties: true,\n        skipTypeCheck: true,\n      })\n\n      const apiModel: ApiModel = new ApiModel()\n      const apiPackage = apiModel.loadPackage(extractorConfig.apiJsonFilePath)\n\n      const entry = apiPackage.entryPoints[0]\n\n      const pluginInterface = entry.findMembersByName(pluginInterfaceName)[0]\n\n      for (const member of pluginInterface.members) {\n        const method: Partial<Method> = {}\n        method.pluginInterfaceName = pluginInterfaceName\n        method.operationId = member.displayName\n        // console.log(member)\n        method.parameters = (member as ApiParameterListMixin).parameters[0]?.parameterTypeExcerpt?.text\n        method.response = (member as ApiReturnTypeMixin).returnTypeExcerpt.text\n          .replace('Promise<', '')\n          .replace('>', '')\n\n        const methodSignature = member as ApiMethodSignature\n        method.description = methodSignature.tsdocComment?.summarySection\n          ?.getChildNodes()[0]\n          // @ts-ignore\n          ?.getChildNodes()[0]?.text\n\n        method.description = method.description || ''\n\n        if (method.parameters) {\n          // @ts-ignore\n          api.components.schemas = {\n            // @ts-ignore\n            ...api.components.schemas,\n            ...createSchema(generator, method.parameters).components.schemas,\n          }\n        }\n\n        // @ts-ignore\n        api.components.schemas = {\n          // @ts-ignore\n          ...api.components.schemas,\n          ...createSchema(generator, method.response).components.schemas,\n        }\n\n        // @ts-ignore\n        api.components.methods[method.operationId] = {\n          description: method.description,\n          arguments: getReference(method.parameters),\n          returnType: getReference(method.response),\n        }\n      }\n\n      interfaces[pluginInterfaceName] = api\n    }\n\n    writeFileSync(resolve(outPutPath), `export const schema = ${JSON.stringify(interfaces, null, 2)}`)\n  })\n\ndev\n  .command('extract-api')\n  .description('Extract API')\n  .option('-c, --extractorConfig <string>', 'API Extractor config file', './api-extractor.json')\n  .action(async (options) => {\n    const apiExtractorJsonPath: string = resolve(options.extractorConfig)\n    const extractorConfig: ExtractorConfig = ExtractorConfig.loadFileAndPrepare(apiExtractorJsonPath)\n\n    const extractorResult: ExtractorResult = Extractor.invoke(extractorConfig, {\n      localBuild: true,\n      showVerboseMessages: true,\n    })\n\n    if (!extractorResult.succeeded) {\n      console.error(\n        `API Extractor completed with ${extractorResult.errorCount} errors` +\n          ` and ${extractorResult.warningCount} warnings`,\n      )\n      process.exitCode = 1\n    }\n  })\n\nexport { dev }\n"
  },
  {
    "path": "packages/cli/src/did.ts",
    "content": "import { IDIDManagerCreateArgs, IIdentifier } from '@veramo/core-types'\nimport { getAgent } from './setup.js'\nimport inquirer from 'inquirer'\nimport { Command } from 'commander'\nimport { printTable } from 'console-table-printer'\n\nconst did = new Command('did').description('Decentralized identifiers')\n\ndid\n  .command('providers')\n  .description('list available identifier providers')\n  .action(async (opts: {}, cmd: Command) => {\n    const agent = await getAgent(cmd.optsWithGlobals().config)\n\n    const providers = await agent.didManagerGetProviders()\n    const list = providers.map((provider: string) => ({ provider }))\n\n    if (list.length > 0) {\n      printTable(list)\n    } else {\n      console.log('No identifier providers')\n    }\n  })\n\ndid\n  .command('list', { isDefault: true })\n  .description('list managed identifiers')\n  .action(async (opts: {}, cmd: Command) => {\n    const agent = await getAgent(cmd.optsWithGlobals().config)\n\n    const list = await agent.didManagerFind()\n\n    if (list.length > 0) {\n      const dids = list.map((item: IIdentifier) => ({\n        provider: item.provider,\n        alias: item.alias,\n        did: item.did,\n      }))\n      printTable(dids)\n    } else {\n      console.log('No dids')\n    }\n  })\n\ndid\n  .command('create')\n  .description('create an identifier')\n  .action(async (opts: {}, cmd: Command) => {\n    // FIXME: CLI add arguments for provider, kms, alias\n    const agent = await getAgent(cmd.optsWithGlobals().config)\n\n    try {\n      const providers = await agent.didManagerGetProviders()\n      const kms = await agent.keyManagerGetKeyManagementSystems()\n      const args: IDIDManagerCreateArgs = {}\n\n      const answers = await inquirer.prompt([\n        {\n          type: 'list',\n          name: 'provider',\n          choices: providers,\n          message: 'Select identifier provider',\n        },\n        {\n          type: 'list',\n          name: 'kms',\n          choices: kms,\n          message: 'Select key management system',\n        },\n        {\n          type: 'input',\n          name: 'alias',\n          message: 'Enter alias',\n        },\n      ])\n\n      const identifier = await agent.didManagerCreate(answers)\n      printTable([{ provider: identifier.provider, alias: identifier.alias, did: identifier.did }])\n    } catch (e: any) {\n      console.error(e.message)\n    }\n  })\n\ndid\n  .command('delete')\n  .description('delete an identifier')\n  .action(async (opts: {}, cmd: Command) => {\n    const agent = await getAgent(cmd.optsWithGlobals().config)\n\n    try {\n      const identifiers = await agent.didManagerFind()\n      const answers = await inquirer.prompt([\n        {\n          type: 'list',\n          name: 'did',\n          choices: identifiers.map((item) => item.did),\n          message: 'Delete DID',\n        },\n      ])\n\n      const result = await agent.didManagerDelete({\n        did: answers.did,\n      })\n\n      console.log('Success:', result)\n    } catch (e: any) {\n      console.error(e)\n    }\n  })\n\ndid\n  .command('add-service')\n  .description('add a service endpoint to did document')\n  .action(async (opts: {}, cmd: Command) => {\n    const agent = await getAgent(cmd.optsWithGlobals().config)\n\n    try {\n      const identifiers = await agent.didManagerFind()\n      const answers = await inquirer.prompt([\n        {\n          type: 'list',\n          name: 'did',\n          choices: identifiers.map((item) => item.did),\n          message: 'Select DID',\n        },\n        {\n          type: 'text',\n          name: 'type',\n          message: 'Service type',\n          default: 'DIDCommMessaging',\n        },\n        {\n          type: 'text',\n          name: 'endpoint',\n          message: 'Endpoint',\n        },\n        {\n          type: 'text',\n          name: 'id',\n          message: 'ID',\n        },\n      ])\n\n      const result = await agent.didManagerAddService({\n        did: answers.did,\n        service: {\n          type: answers.type,\n          serviceEndpoint: answers.endpoint,\n          id: answers.id,\n        },\n      })\n\n      console.log('Success:', result)\n    } catch (e: any) {\n      console.error(e)\n    }\n  })\n\ndid\n  .command('remove-service')\n  .description('remove a service endpoint from did document')\n  .action(async (opts: {}, cmd: Command) => {\n    const agent = await getAgent(cmd.optsWithGlobals().config)\n\n    try {\n      const identifiers = await agent.didManagerFind()\n      const answers = await inquirer.prompt([\n        {\n          type: 'list',\n          name: 'did',\n          choices: identifiers.map((item) => item.did),\n          message: 'Select DID',\n        },\n        {\n          type: 'text',\n          name: 'id',\n          message: 'ID',\n        },\n      ])\n\n      const result = await agent.didManagerRemoveService({\n        did: answers.did,\n        id: answers.id,\n      })\n\n      console.log('Success:', result)\n    } catch (e: any) {\n      console.error(e)\n    }\n  })\n\ndid\n  .command('add-key')\n  .description('create and add a public key to did document')\n  .action(async (opts: {}, cmd: Command) => {\n    const agent = await getAgent(cmd.optsWithGlobals().config)\n\n    try {\n      const identifiers = await agent.didManagerFind()\n      const kms = await agent.keyManagerGetKeyManagementSystems()\n      const answers = await inquirer.prompt([\n        {\n          type: 'list',\n          name: 'did',\n          choices: identifiers.map((item) => item.did),\n          message: 'Select DID',\n        },\n        {\n          type: 'list',\n          name: 'kms',\n          choices: kms,\n          message: 'Select key management system',\n        },\n        {\n          type: 'list',\n          name: 'type',\n          choices: ['Ed25519', 'Secp256k1'],\n          message: 'Type',\n        },\n      ])\n\n      const key = await agent.keyManagerCreate({\n        kms: answers.kms,\n        type: answers.type,\n      })\n\n      const result = await agent.didManagerAddKey({\n        did: answers.did,\n        key,\n      })\n\n      console.log('Success:', result)\n    } catch (e: any) {\n      console.error(e)\n    }\n  })\n\ndid\n  .command('remove-key')\n  .description('remove a key from did document')\n  .action(async (opts: {}, cmd: Command) => {\n    const agent = await getAgent(cmd.optsWithGlobals().config)\n\n    try {\n      const identifiers = await agent.didManagerFind()\n      const answers = await inquirer.prompt([\n        {\n          type: 'list',\n          name: 'did',\n          choices: identifiers.map((item) => item.did),\n          message: 'Select DID',\n        },\n        {\n          type: 'text',\n          name: 'id',\n          message: 'ID',\n        },\n      ])\n\n      const result = await agent.didManagerRemoveKey({\n        did: answers.did,\n        kid: answers.id,\n      })\n\n      console.log('Success:', result)\n    } catch (e: any) {\n      console.error(e)\n    }\n  })\n\ndid\n  .command('export')\n  .description('export an identifier')\n  .action(async (opts: {}, cmd: Command) => {\n    const agent = await getAgent(cmd.optsWithGlobals().config)\n\n    try {\n      const identifiers = await agent.didManagerFind()\n      const answers = await inquirer.prompt([\n        {\n          type: 'list',\n          name: 'did',\n          choices: identifiers.map((item) => ({\n            name: item.did + ' ' + item.alias,\n            value: item.did,\n          })),\n          message: 'Select DID',\n        },\n      ])\n\n      const identifier = await agent.didManagerGet({ did: answers.did })\n\n      console.log(JSON.stringify(identifier))\n    } catch (e: any) {\n      console.error(e)\n    }\n  })\n\ndid\n  .command('import')\n  .description('import an identifier')\n  .action(async (opts: {}, cmd: Command) => {\n    const agent = await getAgent(cmd.optsWithGlobals().config)\n\n    try {\n      const answers = await inquirer.prompt([\n        {\n          type: 'text',\n          name: 'identifier',\n          message: 'Identifier (JSON object)',\n        },\n      ])\n\n      const identifier = await agent.didManagerImport(JSON.parse(answers.identifier))\n      console.log(identifier)\n    } catch (e: any) {\n      console.error(e)\n    }\n  })\n\ndid\n  .command('resolve <didUrl>')\n  .description('Resolve DID Document')\n  .action(async (didUrl: string, opts: {}, cmd: Command) => {\n    const agent = await getAgent(cmd.optsWithGlobals().config)\n    try {\n      const ddo = await agent.resolveDid({ didUrl })\n      console.log(JSON.stringify(ddo, null, 2))\n    } catch (e: any) {\n      console.error(e.message)\n    }\n  })\n\nexport { did }\n"
  },
  {
    "path": "packages/cli/src/discover.ts",
    "content": "import { getAgent } from './setup.js'\nimport { Command } from 'commander'\nimport { printTable } from 'console-table-printer'\n\nconst discover = new Command('discover').description('Discovery')\n\ndiscover\n  .command('did')\n  .description('did discovery')\n  .option('-q, --query <string>', 'Query string')\n\n  .action(async (opts: { query: string }, cmd: Command) => {\n    const agent = await getAgent(cmd.optsWithGlobals().config)\n\n    const response = await agent.discoverDid({ query: opts.query })\n    const list: any = []\n\n    response.results.forEach((r: any) => {\n      r.matches.forEach((m: any) => {\n        list.push({\n          provider: r.provider,\n          did: m.did,\n        })\n      })\n    })\n\n    if (list.length > 0) {\n      printTable(list)\n    } else {\n      console.log('No dids discovered')\n    }\n  })\n\nexport { discover }\n"
  },
  {
    "path": "packages/cli/src/execute.ts",
    "content": "import { Command } from 'commander'\nimport inquirer from 'inquirer'\nimport { getAgent } from './setup.js'\nimport fs from 'fs'\nimport fuzzy from 'fuzzy'\nimport Debug from 'debug'\n\nconst debug = Debug('veramo:cli:execute')\n\nconst execute = new Command('execute')\n  .description('Execute agent method')\n  .option('-m, --method <string>', 'Method name')\n  .option('-a, --argsJSON <string>', 'Method arguments')\n  .option('-f, --argsFile <string>', 'Path to a file containing method arguments in a JSON string')\n  .action(async (options: { method: string; argsJSON?: string; argsFile?: string }, cmd: Command) => {\n    const agent = await getAgent(cmd.optsWithGlobals().config)\n\n    try {\n      let method = options.method\n      let argsString = options.argsJSON\n      let argsFile = options.argsFile\n      let argsObj\n\n      if (!method) {\n        const answers = await inquirer.prompt({\n          // @ts-ignore\n          type: 'autocomplete',\n          name: 'method',\n          pageSize: 15,\n          // suggestOnly: true,\n          source: async (answers: any, search: string) => {\n            const res = fuzzy\n              .filter(search, agent.availableMethods())\n              .map((el: any) => (typeof el === 'string' ? el : el.original))\n            return res\n          },\n          message: 'Method',\n        })\n        method = answers.method\n      }\n\n      if (!argsString && !argsFile) {\n        console.error(`No arguments provided for execute method=${method}`)\n        process.exit(1)\n      } else {\n        debug(`Attempting to extract method arguments from file (${argsFile})`)\n        if (argsFile) {\n          argsString = fs.readFileSync(argsFile).toString('utf-8')\n        }\n        try {\n          argsObj = JSON.parse(argsString!)\n        } catch (e: any) {\n          console.error('could not parse arguments JSON')\n          process.exit(1)\n        }\n      }\n\n      debug('\\nMethod: ', method)\n      debug('\\nArguments: ', JSON.stringify(argsObj, null, 2))\n\n      const result = await agent.execute(method, argsObj)\n\n      debug('\\nResult: ', JSON.stringify(result, null, 2))\n      console.log(JSON.stringify(result))\n    } catch (e: any) {\n      console.error(e.message)\n    }\n  })\n\nexport { execute }\n"
  },
  {
    "path": "packages/cli/src/explore/credentials.ts",
    "content": "import blessed, { Widgets } from 'blessed'\nimport { UniqueVerifiableCredential } from '@veramo/core-types'\nimport { shortDate, shortDid, copyToClipboard } from './utils.js'\nimport { ConfiguredAgent } from '../setup.js'\nimport { styles } from './styles.js'\nimport { asArray, extractIssuer } from '@veramo/utils'\n\nexport const getCredentialsTable = async (agent: ConfiguredAgent, screen: Widgets.Screen) => {\n  screen.title = 'Credentials'\n\n  const credentialsTable = blessed.listtable({\n    top: '0',\n    left: '0',\n    border: 'line',\n    align: 'left',\n    tags: true,\n    keys: true,\n    width: '100%',\n    height: '100%',\n    mouse: true,\n    style: styles.listtable,\n  })\n\n  const credentials = await agent.dataStoreORMGetVerifiableCredentials()\n  credentialsTable.setData(\n    [['Created', 'Type', 'From', 'To']].concat(\n      credentials.map(({ verifiableCredential: m }) => [\n        shortDate(m.issuanceDate),\n        asArray(m.type || []).join(','),\n        shortDid(extractIssuer(m)),\n        shortDid(m.credentialSubject.id),\n      ]),\n    ),\n  )\n\n  credentialsTable.on('select', async function (data) {\n    const i = credentialsTable.getItemIndex(data)\n    showCredential(credentials[i - 1])\n  })\n\n  function showCredential(credential: UniqueVerifiableCredential) {\n    const credentialBox = blessed.box({\n      label: 'Credential',\n      top: 'center',\n      left: 'center',\n      height: '90%',\n      width: '90%',\n      border: 'line',\n      shadow: true,\n      mouse: true,\n      keys: true,\n      scrollable: true,\n      vi: true,\n      alwaysScroll: true,\n      scrollbar: {\n        ch: ' ',\n        track: {\n          bg: 'grey',\n        },\n        style: {\n          inverse: false,\n        },\n      },\n\n      content: JSON.stringify(credential, null, 2),\n    })\n    credentialBox.key(['c'], function (ch, key) {\n      var messageBox = blessed.message({\n        parent: screen,\n        top: 'center',\n        left: 'center',\n        height: 'shrink',\n        width: 'shrink',\n        border: 'line',\n        shadow: true,\n        style: {\n          fg: 'green'\n        },\n      })\n      const success = copyToClipboard(JSON.stringify(credential, null, 2))\n      const message = success ? 'Copied to clipboard.' : 'Could not copy to clipboard.'\n      messageBox.display(message, () => {})\n    })\n    credentialBox.key(['escape'], function (ch, key) {\n      credentialBox.destroy()\n      screen.render()\n    })\n\n    credentialBox.focus()\n    screen.append(credentialBox)\n    screen.render()\n  }\n\n  return credentialsTable\n}\n"
  },
  {
    "path": "packages/cli/src/explore/index.ts",
    "content": "import { getAgent } from '../setup.js'\nimport { Command } from 'commander'\nimport { renderMainScreen } from './main.js'\n\nconst explore = new Command('explore')\n  .description('launch Verifiable Data explorer')\n  .action(async (opts: {}, cmd: Command) => {\n    const agent = await getAgent(cmd.optsWithGlobals().config)\n    await renderMainScreen(agent)\n  })\n\nexport { explore }\n"
  },
  {
    "path": "packages/cli/src/explore/main.ts",
    "content": "import blessed from 'blessed'\nimport { ConfiguredAgent } from '../setup.js'\nimport { styles } from './styles.js'\n\nimport { getManagedIdentifiersTable } from './managed-identifiers.js'\nimport { getMessagesTable } from './messages.js'\nimport { getCredentialsTable } from './credentials.js'\nimport { getPresentationsTable } from './presentations.js'\n\nconst defaultScreenTitle = 'Agent'\n\nexport const renderMainScreen = async (agent: ConfiguredAgent) => {\n  // Create a screen object.\n  const screen = blessed.screen({\n    smartCSR: true,\n  })\n\n  screen.title = defaultScreenTitle\n\n  const mainMenuItems = [\n    { title: 'Managed identifiers', getComponent: getManagedIdentifiersTable },\n    { title: 'Messages', getComponent: getMessagesTable },\n    { title: 'Credentials', getComponent: getCredentialsTable },\n    { title: 'Presentations', getComponent: getPresentationsTable },\n  ]\n\n  const menu = blessed.list({\n    label: 'Agent',\n    top: 'center',\n    left: 'center',\n    border: 'line',\n    align: 'center',\n    keys: true,\n    width: 'shrink',\n    height: '70%',\n    vi: true,\n    mouse: true,\n    style: styles.list,\n    items: mainMenuItems.map((i) => i.title),\n  })\n\n  menu.on('select', async function (data) {\n    const i = menu.getItemIndex(data)\n    const component = await mainMenuItems[i].getComponent(agent, screen)\n\n    component.key(['escape'], function (ch, key) {\n      component.destroy()\n      screen.title = defaultScreenTitle\n      screen.render()\n    })\n\n    screen.append(component)\n    component.focus()\n    screen.render()\n  })\n\n  screen.append(menu)\n  menu.focus()\n\n  screen.key(['q', 'C-c'], function (ch, key) {\n    return process.exit(0)\n  })\n  screen.render()\n}\n"
  },
  {
    "path": "packages/cli/src/explore/managed-identifiers.ts",
    "content": "import blessed, { Widgets } from 'blessed'\nimport { IIdentifier } from '@veramo/core-types'\nimport { copyToClipboard } from './utils.js'\nimport { ConfiguredAgent } from '../setup.js'\nimport { styles } from './styles.js'\n\nexport const getManagedIdentifiersTable = async (agent: ConfiguredAgent, screen: Widgets.Screen) => {\n  screen.title = 'Managed identifiers'\n\n  const managedIdentifiersTable = blessed.listtable({\n    top: '0',\n    left: '0',\n    border: 'line',\n    align: 'left',\n    tags: true,\n    keys: true,\n    width: '100%',\n    height: '100%',\n    mouse: true,\n    style: styles.listtable,\n  })\n\n  const identifiers = await agent.didManagerFind()\n  managedIdentifiersTable.setData([['DID', 'Alias']].concat(identifiers.map((i) => [i.did, i.alias || ''])))\n\n  managedIdentifiersTable.on('select', async function (data) {\n    const i = managedIdentifiersTable.getItemIndex(data)\n    showIdentifier(identifiers[i - 1])\n  })\n\n  function showIdentifier(identifier: IIdentifier) {\n    const identifierBox = blessed.box({\n      label: identifier.did,\n      top: 'center',\n      left: 'center',\n      height: '90%',\n      width: '90%',\n      border: 'line',\n      shadow: true,\n      mouse: true,\n      keys: true,\n      scrollable: true,\n      vi: true,\n      alwaysScroll: true,\n      scrollbar: {\n        ch: ' ',\n        track: {\n          bg: 'grey',\n        },\n        style: {\n          inverse: false,\n        },\n      },\n\n      content: JSON.stringify(identifier, null, 2),\n    })\n    identifierBox.key(['c'], function (ch, key) {\n      var messageBox = blessed.message({\n        parent: screen,\n        top: 'center',\n        left: 'center',\n        height: 'shrink',\n        width: 'shrink',\n        border: 'line',\n        shadow: true,\n        style: {\n          fg: 'green'\n        },\n      })\n      const success = copyToClipboard(JSON.stringify(identifier, null, 2))\n      const message = success ? 'Copied to clipboard.' : 'Could not copy to clipboard.'\n      messageBox.display(message, () => {})\n    })\n    identifierBox.key(['escape'], function (ch, key) {\n      identifierBox.destroy()\n      screen.render()\n    })\n\n    identifierBox.focus()\n    screen.append(identifierBox)\n    screen.render()\n  }\n\n  return managedIdentifiersTable\n}\n"
  },
  {
    "path": "packages/cli/src/explore/messages.ts",
    "content": "import blessed, { Widgets } from 'blessed'\nimport { IMessage } from '@veramo/core-types'\nimport { shortDate, shortDid } from './utils.js'\nimport { ConfiguredAgent } from '../setup.js'\nimport { styles } from './styles.js'\n\nexport const getMessagesTable = async (agent: ConfiguredAgent, screen: Widgets.Screen) => {\n  screen.title = 'Messages'\n\n  const messageTable = blessed.listtable({\n    top: '0',\n    left: '0',\n    border: 'line',\n    align: 'left',\n    tags: true,\n    keys: true,\n    width: '100%',\n    height: '100%',\n    mouse: true,\n    style: styles.listtable,\n  })\n\n  const messages = await agent.dataStoreORMGetMessages()\n  messageTable.setData(\n    [['Created', 'Type', 'From', 'To']].concat(\n      messages.map((m) => [shortDate(m.createdAt), m.type, shortDid(m.from), shortDid(m.to)]),\n    ),\n  )\n\n  messageTable.on('select', async function (data) {\n    const i = messageTable.getItemIndex(data)\n    showMessage(messages[i - 1])\n  })\n\n  function showMessage(message: IMessage) {\n    const messageBox = blessed.box({\n      label: 'Message',\n      top: 'center',\n      left: 'center',\n      height: '90%',\n      width: '90%',\n      border: 'line',\n      shadow: true,\n      mouse: true,\n      keys: true,\n      scrollable: true,\n      vi: true,\n      alwaysScroll: true,\n      scrollbar: {\n        ch: ' ',\n        track: {\n          bg: 'grey',\n        },\n        style: {\n          inverse: false,\n        },\n      },\n\n      content: JSON.stringify(message, null, 2),\n    })\n    messageBox.key(['escape'], function (ch, key) {\n      messageBox.destroy()\n      screen.render()\n    })\n\n    messageBox.focus()\n    screen.append(messageBox)\n    screen.render()\n  }\n\n  return messageTable\n}\n"
  },
  {
    "path": "packages/cli/src/explore/presentations.ts",
    "content": "import blessed, { Widgets } from 'blessed'\nimport { UniqueVerifiablePresentation } from '@veramo/core-types'\nimport { shortDate, shortDid, copyToClipboard } from './utils.js'\nimport { ConfiguredAgent } from '../setup.js'\nimport { styles } from './styles.js'\nimport { asArray } from '@veramo/utils'\n\nexport const getPresentationsTable = async (agent: ConfiguredAgent, screen: Widgets.Screen) => {\n  screen.title = 'Presentations'\n\n  const presentationsTable = blessed.listtable({\n    top: '0',\n    left: '0',\n    border: 'line',\n    align: 'left',\n    tags: true,\n    keys: true,\n    width: '100%',\n    height: '100%',\n    mouse: true,\n    style: styles.listtable,\n  })\n\n  const presentations = await agent.dataStoreORMGetVerifiablePresentations({})\n  presentationsTable.setData(\n    [['Created', 'Type', 'Holder', 'Verifier']].concat(\n      presentations.map(({ verifiablePresentation: m }) => [\n        shortDate(m.issuanceDate),\n        asArray(m.type || []).join(','),\n        shortDid(m.holder),\n        shortDid(asArray(m.verifier || []).join(',')),\n      ]),\n    ),\n  )\n\n  presentationsTable.on('select', async function (data) {\n    const i = presentationsTable.getItemIndex(data)\n    showPresentation(presentations[i - 1])\n  })\n\n  function showPresentation(presentation: UniqueVerifiablePresentation) {\n    const presentationBox = blessed.box({\n      label: 'Presentation',\n      top: 'center',\n      left: 'center',\n      height: '90%',\n      width: '90%',\n      border: 'line',\n      shadow: true,\n      mouse: true,\n      keys: true,\n      scrollable: true,\n      vi: true,\n      alwaysScroll: true,\n      scrollbar: {\n        ch: ' ',\n        track: {\n          bg: 'grey',\n        },\n        style: {\n          inverse: false,\n        },\n      },\n\n      content: JSON.stringify(presentation, null, 2),\n    })\n    presentationBox.key(['c'], function (ch, key) {\n      var messageBox = blessed.message({\n        parent: screen,\n        top: 'center',\n        left: 'center',\n        height: 'shrink',\n        width: 'shrink',\n        border: 'line',\n        shadow: true,\n        style: {\n          fg: 'green'\n        },\n      })\n      const success = copyToClipboard(JSON.stringify(presentation, null, 2))\n      const message = success ? 'Copied to clipboard.' : 'Could not copy to clipboard.'\n      messageBox.display(message, () => {})\n    })\n    presentationBox.key(['escape'], function (ch, key) {\n      presentationBox.destroy()\n      screen.render()\n    })\n\n    presentationBox.focus()\n    screen.append(presentationBox)\n    screen.render()\n  }\n\n  return presentationsTable\n}\n"
  },
  {
    "path": "packages/cli/src/explore/styles.ts",
    "content": "export const styles = {\n  list: {\n    selected: {\n      fg: 'white',\n      bg: 'blue',\n      border: {\n        fg: '#f0f0f0',\n      },\n      hover: {\n        bg: 'green',\n      },\n    },\n  },\n  listtable: {\n    header: {\n      fg: 'blue',\n      bold: true,\n    },\n    cell: {\n      fg: 'white',\n      selected: {\n        bg: 'blue',\n      },\n    },\n  },\n}\n"
  },
  {
    "path": "packages/cli/src/explore/utils.ts",
    "content": "import { formatDistanceToNow } from 'date-fns'\nimport os from 'os'\n\nexport function shortDid(did?: string): string {\n  if (!did) return ''\n  did = did.replace(/\\?.*$/, '')\n  if (did.slice(0, 7) === 'did:web') {\n    return did\n  }\n  return did.slice(0, did.lastIndexOf(':')) + '..' + did.slice(-4)\n}\n\nexport function shortDate(date?: string): string {\n  if (!date) return ''\n  return formatDistanceToNow(new Date(date))\n}\n\n// return true if copy worked, false otherwise\nexport function copyToClipboard(text: string): boolean {\n  /**\n   * There's probably a better way than spawning. We tried and failed at the following:\n   * - screen.copyToClipboard didn't do anything (and is iTerm2-specific, anyway)\n   * - clipboardy wouldn't run due to error \"Must use import to load ES Module\" (even though we used import)\n   */\n  if (os.platform() === 'darwin') {\n    const proc = require('child_process').spawn('pbcopy')\n    proc.stdin.write(text)\n    proc.stdin.end()\n    return true\n  } else if (os.platform() === 'win32') {\n    require('child_process').spawn('clip').stdin.end(text)\n    return true\n  }\n  return false\n}\n"
  },
  {
    "path": "packages/cli/src/imported-types/imported-modules.d.ts",
    "content": "declare module 'cors'\n"
  },
  {
    "path": "packages/cli/src/lib/agentCreator.ts",
    "content": "import { TAgent, IPluginMethodMap } from '@veramo/core-types'\nimport { createObjects } from './objectCreator.js'\n\n/**\n * Creates a Veramo agent from a config object containing an `/agent` pointer.\n * @param config - The configuration object\n *\n * @see {@link https://veramo.io/docs/veramo_agent/configuration_internals | Configuration Internals} for details on\n *   the configuration options.\n *\n * @beta - This API may change without a major version bump\n */\nexport async function createAgentFromConfig<T extends IPluginMethodMap>(config: object): Promise<TAgent<T>> {\n  // @ts-ignore\n  const { agent } = await createObjects(config, { agent: '/agent' })\n  return agent\n}\n"
  },
  {
    "path": "packages/cli/src/lib/objectCreator.ts",
    "content": "import { set, get } from 'jsonpointer'\nimport parse from 'url-parse'\nimport { resolve } from 'path'\n\n/**\n * Creates objects from a configuration object and a set of pointers.\n *\n * Example:\n * ```ts\n * const { url } = createObjects({ \"rpcUrl\": \"http://localhost:8545\", }, { url: '/rpcUrl' })\n * ```\n *\n * The config can contain references (`$ref`) to other objects within using JSON pointers.\n * Example:\n * ```json\n * {\n *   \"rpcUrl\": \"http://localhost:8545\",\n *   \"endpoint\": {\n *     \"url\": {\n *       \"$ref\": \"/rpcUrl\"\n *     }\n *   }\n * }\n * ```\n *\n * The config object can also contain references to NPM modules using the `$require` property.\n * Example:\n * ```json\n * {\n *   \"agent\": {\n *     \"$require\": \"@veramo/core#Agent\",\n *     \"$args\": {\n *       \"plugins\": [\n *         { \"$require\": \"@veramo/did-comm#DIDComm\" },\n *       ]\n *     }\n *   }\n * }\n * ```\n *\n * Environment variables can also be specified using the `$env` property.\n *\n * @see Please see {@link https://veramo.io/docs/veramo_agent/configuration_internals | Configuration Internals} for\n *   more information.\n *\n * @param config - The configuration object\n * @param pointers - A map of JSON pointers to objects within that config that you wish to create\n *\n * @beta - This API may change without a major version bump\n */\nexport async function createObjects(config: object, pointers: Record<string, string>): Promise<Record<string, any>> {\n  const objects = {}\n\n  async function resolveRefs(input: any): Promise<any> {\n    if (Array.isArray(input)) {\n      const resolved = []\n      for (const item of input) {\n        resolved.push(await resolveRefs(item))\n      }\n      return resolved\n    }\n\n    if (typeof input === 'object') {\n      const resolved: any = {}\n      for (const property in input) {\n        if (input.hasOwnProperty(property)) {\n          if (property === '$ref') {\n            const pointer = input[property]\n            return await objectFromPointer(pointer)\n          } else if (property === '$require') {\n            return await objectFromConfig(input)\n          } else if (property === '$env') {\n            return process.env[input[property]]\n          } else {\n            resolved[property] = await resolveRefs(input[property])\n          }\n        }\n      }\n      return resolved\n    }\n\n    return input\n  }\n\n  async function objectFromConfig(objectConfig: any): Promise<any> {\n    let object\n    // console.log('Requiring', objectConfig['$require'])\n    const parsed = parse(objectConfig['$require'], {}, true)\n    let module = parsed.pathname\n    const member = parsed.hash.length > 1 ? parsed.hash.slice(1) : undefined\n    const type = parsed.query['t'] || 'class'\n    const pointer = parsed.query['p']\n    const args = objectConfig['$args']\n    // console.log({module, member, type, query: parsed.query})\n\n    if (module.slice(0, 2) === './') {\n      module = resolve(module)\n    }\n\n    const resolvedArgs = args !== undefined ? await resolveRefs(args) : []\n    try {\n      let required = member ? (await import(module))[member] : await import(module)\n      if (type === 'class') {\n        object = new required(...resolvedArgs)\n      } else if (type === 'function') {\n        object = required(...resolvedArgs)\n      } else if (type === 'object') {\n        object = required\n      }\n    } catch (e: any) {\n      throw new Error(`Error creating ${module}['${member}']: ${e.message}`)\n    }\n    if (pointer) {\n      return get(object, pointer)\n    }\n    return object\n  }\n\n  async function objectFromPointer(pointer: string) {\n    const existingObject = get(objects, pointer)\n    if (existingObject) {\n      // console.log('Existing', pointer)\n      return existingObject\n    } else {\n      // console.log('New', pointer)\n      const objectConfig = get(config, pointer)\n      if (!objectConfig) throw Error('Pointer not found: ' + pointer)\n      try {\n        let object\n        if (objectConfig['$require']) {\n          object = await objectFromConfig(objectConfig)\n        } else if (objectConfig['$env']) {\n          object = process.env[objectConfig['$env']]\n        } else {\n          object = await resolveRefs(objectConfig)\n        }\n        set(objects, pointer, object)\n        return object\n      } catch (e: any) {\n        throw Error(e.message + '. While creating object from pointer: ' + pointer)\n      }\n    }\n  }\n\n  const result: any = {}\n  for (const key of Object.keys(pointers)) {\n    if (pointers.hasOwnProperty(key)) {\n      result[key] = await objectFromPointer(pointers[key])\n    }\n  }\n  return result\n}\n"
  },
  {
    "path": "packages/cli/src/mediate.ts",
    "content": "import { Command } from 'commander'\nimport inquirer from 'inquirer'\n\nimport { getAgent } from './setup.js'\nimport { PreMediationRequestPolicy, RecipientDid, RequesterDid } from '@veramo/mediation-manager'\n\ntype ConfiguredAgent = Awaited<ReturnType<typeof getAgent>>\n\nconst ALLOW = 'ALLOW'\nconst DENY = 'DENY'\n\ntype Options = Partial<{\n  granted: boolean\n  denied: boolean\n  allowFrom: boolean\n  denyFrom: boolean\n  interactive: boolean\n  fileJson: string\n}>\n\ntype UpdatePolicyParams = {\n  dids: string[]\n  agent: ConfiguredAgent\n  policy?: PreMediationRequestPolicy\n  remove?: boolean\n}\n\n/**\n * private functions\n **/\n\nconst updatePolicies = async (options: UpdatePolicyParams): Promise<void> => {\n  const { dids, agent, policy, remove = false } = options\n  if (remove) {\n    return dids.forEach(\n      async (requesterDid) => await agent.mediationManagerRemoveMediationPolicy({ requesterDid }),\n    )\n  }\n  if (!policy) throw new Error('No policy provided')\n  return dids.forEach(\n    async (requesterDid) => await agent.mediationManagerSaveMediationPolicy({ requesterDid, policy }),\n  )\n}\n\nconst promptForDids = async (action: string): Promise<string[]> => {\n  const { dids } = await inquirer.prompt<{ dids: string }>({\n    type: 'input',\n    name: 'dids',\n    message: `Enter the dids you want to ${action.toLowerCase()} separated by spaces:`,\n  })\n  return dids.split(' ')\n}\n\n/**\n * handler function instantiates agent and directs user to README if no Mediation Manager plugin is configured\n **/\n\ntype Action<T extends Options = Options> = (options: T, cmd: Command, agent: ConfiguredAgent) => Promise<void>\n\nfunction handler(action: Action) {\n  return async (options: Options, cmd: Command) => {\n    const agent = await getAgent(cmd.optsWithGlobals().config)\n    /**\n     * NOTE: check if the mediation-manager plugin is configured\n     **/\n    if ('isMediateDefaultGrantAll' in agent) return await action(options, cmd, agent)\n    console.log('[warning] it appears that the Mediation Manager plugin is not configured.')\n    console.log('[tip] refer to the README (packages/mediation-manager/README.md) for guidance. \\n')\n    throw new Error('[error] Mediation Manager not configured!')\n  }\n}\n\n/**\n * cli action functions\n **/\n\nconst policy = (policy: PreMediationRequestPolicy) => {\n  return async function (\n    { fileJson, interactive }: Pick<Options, 'fileJson' | 'interactive'>,\n    cmd: Command,\n    agent: ConfiguredAgent,\n  ): Promise<void> {\n    try {\n      if (fileJson && interactive) throw new Error('Please specify only one input method')\n\n      if (fileJson) {\n        const jsonData = await import(fileJson, { assert: { type: 'json' } })\n        const dids = jsonData.default\n        await updatePolicies({ dids, agent, policy })\n      } else if (interactive) {\n        const dids = await promptForDids(policy)\n        await updatePolicies({ dids, agent, policy })\n      } else {\n        const dids = cmd.args\n        await updatePolicies({ dids, agent, policy })\n      }\n\n      console.log('Mediation policies updated')\n    } catch (e) {\n      console.error(e.message)\n    }\n  }\n}\nconst readPolicies: Action<Pick<Options, 'interactive' | 'fileJson'>> = async (options, cmd, agent) => {\n  let dids: string[]\n  if (options.interactive) dids = await promptForDids('read')\n  else if (options.fileJson) dids = (await import(options.fileJson, { assert: { type: 'json' } })).default\n  else dids = cmd.args\n  if (!dids || !dids.length) throw new Error('No dids provided')\n  const policies: Record<RequesterDid, RecipientDid | null> = {}\n  for await (const requesterDid of dids) {\n    policies[requesterDid] = await agent.mediationManagerGetMediationPolicy({ requesterDid })\n  }\n  console.log('POLICIES')\n  console.table(policies)\n}\n\nconst listPolicies: Action<Pick<Options, 'allowFrom' | 'denyFrom'>> = async (options, _cmd, agent) => {\n  try {\n    const res = await agent.mediationManagerListMediationPolicies()\n    console.log('POLICIES')\n    if (options.allowFrom) return console.table(Object.entries(res).filter(([, policy]) => policy === ALLOW))\n    if (options.denyFrom) return console.table(Object.entries(res).filter(([, policy]) => policy === DENY))\n    else console.table(res)\n  } catch (e) {\n    console.error(e.message)\n  }\n}\n\nconst listResponses: Action<Pick<Options, 'granted' | 'denied'>> = async (options, _cmd, agent) => {\n  try {\n    const { granted, denied } = options\n    const res = await agent.mediationManagerGetAllMediations()\n    console.log('MEDIATIONS')\n    if (granted) return console.table(Object.entries(res).filter(([, response]) => response === 'GRANTED'))\n    if (denied) return console.table(Object.entries(res).filter(([, response]) => response === 'DENIED'))\n    else console.table(res)\n  } catch (e) {\n    console.error(e.message)\n  }\n}\n\nconst removePolicies: Action<Pick<Options, 'fileJson' | 'interactive'>> = async (options, cmd, agent) => {\n  try {\n    if (options.fileJson) {\n      const jsonData = await import(options.fileJson, { assert: { type: 'json' } })\n      const dids = jsonData.default\n      await updatePolicies({ dids, remove: true, agent })\n    } else if (options.interactive) {\n      const dids = await promptForDids('Remove')\n      await updatePolicies({ dids, remove: true, agent })\n    } else {\n      const dids = cmd.args\n      await updatePolicies({ dids, remove: true, agent })\n    }\n    console.log('Mediation policies removed')\n  } catch (e) {\n    console.error(e.message)\n  }\n}\n\nconst mediate = new Command('mediate').description('Mediate allow or deny policy on dids').addHelpText(\n  'before',\n  `\n    IMPORTANT! in order to use the commands below, you need to configure the Mediate Manager in your agent.yml',\n    see the README (packages/mediation-manager/README.md) for guidance.\n  `,\n)\n\nmediate\n  .command('allow-from')\n  .description('add dids that should be allowed for mediation')\n  .option('-f, --file-json <string>', 'read dids from json file')\n  .option('-i, --interactive', 'interactively input dids')\n  .action(handler(policy(ALLOW)))\n\nmediate\n  .command('deny-from')\n  .description('deny dids that should be denied for mediation')\n  .option('-f, --file-json <string>', 'read dids from json file')\n  .option('-i, --interactive', 'interactively input dids')\n  .action(handler(policy(DENY)))\n\nmediate\n  .command('read')\n  .description('read mediation policy for a specific did (or list of dids)')\n  .option('-i, --interactive', 'interactively input dids')\n  .option('-f, --file-json <string>', 'read dids from json file')\n  .action(handler(readPolicies))\n\nmediate\n  .command('list-policies')\n  .description('list mediation policies')\n  .option('-a, --allow-from', 'list allow policies')\n  .option('-d, --deny-from', 'list deny policies')\n  .action(handler(listPolicies))\n\nmediate\n  .command('list-responses')\n  .description('list mediation responses')\n  .option('-a, --granted', 'list granted policies')\n  .option('-d, --denied', 'list denied policies')\n  .action(handler(listResponses))\n\nmediate\n  .command('remove')\n  .description('remove mediation policies')\n  .option('-f, --file-json <string>', 'read dids from json file')\n  .option('-i, --interactive', 'interactively input dids')\n  .action(handler(removePolicies))\n\nexport { mediate }\n"
  },
  {
    "path": "packages/cli/src/message.ts",
    "content": "import { getAgent } from './setup.js'\nimport { Command } from 'commander'\nimport fs from 'fs'\n\nconst message = new Command('message').description('Messages')\n\nmessage\n  .command('handle', { isDefault: true })\n  .description('Handle raw message ')\n  .option('-r, --raw <string>', 'String containing raw message')\n  .option('-f, --file <string>', 'Path to a file containing raw message')\n  .option('--save <boolean>', 'Save message', true)\n\n  .action(async (options: { file: string; raw: string; save: boolean }, cmd: Command) => {\n    const agent = await getAgent(cmd.optsWithGlobals().config)\n    try {\n      let raw\n\n      if (options.file) {\n        raw = fs.readFileSync(options.file).toString()\n      } else if (options.raw) {\n        raw = options.raw\n      } else {\n        throw Error('Missing file path or raw string')\n      }\n\n      const message = await agent.handleMessage({\n        raw,\n        metaData: [{ type: 'cli' }],\n        save: options.save,\n      })\n\n      console.dir(message, { depth: 10 })\n    } catch (e: any) {\n      console.error(e.message)\n    }\n  })\n\nexport { message }\n"
  },
  {
    "path": "packages/cli/src/presentation.ts",
    "content": "import { getAgent } from './setup.js'\nimport { Command } from 'commander'\nimport inquirer from 'inquirer'\nimport qrcode from 'qrcode-terminal'\nimport { readStdin } from './util.js'\nimport * as fs from 'fs'\nimport * as json5 from 'json5'\nimport { extractIssuer } from '@veramo/utils'\nimport { PartialIdentifier, UniqueVerifiablePresentation } from '@veramo/core-types'\n\nconst presentation = new Command('presentation').description('W3C Verifiable Presentation')\n\npresentation\n  .command('create', { isDefault: true })\n  .description('Create W3C Verifiable Presentation')\n  .option('-s, --send', 'Send')\n  .option('-q, --qrcode', 'Show qrcode')\n  .action(async (opts: { send: boolean; qrcode: boolean }, cmd: Command) => {\n    const agent = await getAgent(cmd.optsWithGlobals().config)\n    const myIdentifiers = await agent.didManagerFind()\n    if (myIdentifiers.length === 0) {\n      console.error('No dids')\n      process.exit()\n    }\n\n    const ids = await agent.dataStoreORMGetIdentifiers()\n\n    const identifiers = [\n      {\n        name: 'Enter manually',\n        value: 'manual',\n      },\n      ...ids.map((id: PartialIdentifier) => id.did),\n    ]\n\n    let aud: string[] = []\n    const answers = await inquirer.prompt([\n      {\n        type: 'list',\n        name: 'iss',\n        choices: myIdentifiers.map((item) => ({\n          name: `${item.did} ${item.alias}`,\n          value: item.did,\n        })),\n\n        message: 'Holder DID',\n      },\n      {\n        type: 'input',\n        name: 'tag',\n        message: 'Tag (threadId)',\n        default: 'xyz123',\n      },\n      {\n        type: 'input',\n        name: 'audnum',\n        message: 'Number of Verifiers',\n        default: 1,\n      },\n      {\n        type: 'input',\n        name: 'type',\n        message: 'Presentation type',\n        default: 'VerifiablePresentation,Profile',\n      },\n    ])\n\n    for (let i = 0; i < answers.audnum; i++) {\n      let answer = null\n      const audAnswer = await inquirer.prompt([\n        {\n          type: 'list',\n          name: 'aud',\n          message: 'Select Verifier or enter manually',\n          choices: identifiers,\n        },\n      ])\n      answer = audAnswer.aud\n      if (answer === 'manual') {\n        const manualAnswer = await inquirer.prompt([\n          {\n            type: 'input',\n            name: 'aud',\n            message: 'Enter Verifier DID',\n          },\n        ])\n        answer = manualAnswer.aud\n      }\n      aud = [...aud, answer]\n    }\n\n    const credentials = await agent.dataStoreORMGetVerifiableCredentials({\n      where: [{ column: 'subject', value: [answers.iss] }],\n    })\n\n    const list: any = []\n    if (credentials.length > 0) {\n      for (const credential of credentials) {\n        list.push({\n          name:\n            JSON.stringify(credential.verifiableCredential.credentialSubject) +\n            ' | Issuer: ' +\n            extractIssuer(credential.verifiableCredential),\n          value: credential.verifiableCredential,\n        })\n      }\n\n      let addMoreCredentials = true\n      const verifiableCredential = []\n\n      while (addMoreCredentials) {\n        const answers2 = await inquirer.prompt([\n          {\n            type: 'list',\n            name: 'credential',\n            choices: list,\n            message: 'Select credential',\n          },\n          {\n            type: 'list',\n            name: 'addMore',\n            message: 'Add another credential?',\n            choices: [\n              { name: 'Yes', value: true },\n              { name: 'No', value: false },\n            ],\n          },\n        ])\n        verifiableCredential.push(answers2.credential)\n        addMoreCredentials = answers2.addMore\n      }\n\n      const verifiablePresentation = await agent.createVerifiablePresentation({\n        save: true,\n        presentation: {\n          holder: answers.iss,\n          verifier: aud,\n          tag: answers.tag,\n          '@context': ['https://www.w3.org/2018/credentials/v1'],\n          type: answers.type.split(','),\n          issuanceDate: new Date().toISOString(),\n          verifiableCredential,\n        },\n        proofFormat: 'jwt',\n      })\n\n      if (opts.send) {\n        for (var verifier in aud) {\n          try {\n            const message = await agent.sendMessageDIDCommAlpha1({\n              save: true,\n              data: {\n                from: answers.iss,\n                to: verifier,\n                type: 'jwt',\n                body: verifiablePresentation.proof.jwt,\n              },\n            })\n            console.dir(message, { depth: 10 })\n          } catch (e) {\n            console.error(e)\n          }\n        }\n      }\n\n      if (opts.qrcode) {\n        qrcode.generate(verifiablePresentation.proof.jwt)\n      } else {\n        console.dir(verifiablePresentation, { depth: 10 })\n      }\n    }\n  })\n\npresentation\n  .command('verify')\n  .description('Verify a W3C Verifiable Presentation provided as a string param or a file or from stdin')\n  .option('-c, --challenge <string>', 'Optional. Specify a challenge that the presentation should match.')\n  .option('-d, --domain <string>', 'Optional. Specify a domain that the presentation should match.')\n  .option('-f, --filename <string>', 'Optional. Read the presentation from a file instead of stdin')\n  .option('-r, --raw <string>', 'Optional. Presentation as a parameter string instead of a file or stdin.')\n  .action(\n    async (options: { challenge: string; domain: string; filename: string; raw: string }, cmd: Command) => {\n      const agent = await getAgent(cmd.optsWithGlobals().config)\n      let raw: string = ''\n      if (options.raw) {\n        raw = options.raw\n      } else if (options.filename) {\n        raw = await fs.promises.readFile(options.filename, 'utf-8')\n      } else {\n        raw = await readStdin()\n      }\n      let presentationAsJSON: any\n      try {\n        presentationAsJSON = json5.parse(raw)\n      } catch (e: any) {\n        presentationAsJSON = {\n          proof: {\n            type: 'JwtProof2020',\n            jwt: raw,\n          },\n        } as any\n      }\n      const result = await agent.verifyPresentation({\n        presentation: presentationAsJSON,\n        challenge: options.challenge,\n        domain: options.domain,\n      })\n      if (result.verified === true) {\n        console.log('Presentation was verified successfully.')\n      } else {\n        console.error('Presentation could not be verified.')\n      }\n    },\n  )\n\npresentation\n  .command('output')\n  .description('Print W3C Verifiable Presentation to stdout')\n  .option('-t, --tag <string>', 'Optional. Specify the tag for the presentation.')\n  .action(async (options: { tag: string }, cmd: Command) => {\n    const agent = await getAgent(cmd.optsWithGlobals().config)\n\n    const presentations: UniqueVerifiablePresentation[] = await agent.dataStoreORMGetVerifiablePresentations(\n      {},\n    )\n\n    if (presentations.length > 0) {\n      let selected = null\n      const list: any = []\n      if (options.tag) {\n        const matches = presentations.filter((pres) => pres.verifiablePresentation.tag === options.tag)\n        if (matches.length > 1) {\n          console.log('Found multiple matching presentations. Only showing the first one.')\n        }\n        selected = matches[0]\n      } else {\n        for (const pres of presentations) {\n          list.push({\n            name:\n              'Issuance Date: ' +\n              pres.verifiablePresentation.issuanceDate +\n              ' | Holder: ' +\n              pres.verifiablePresentation.holder +\n              ' | Tag: ' +\n              pres.verifiablePresentation.tag,\n            value: pres,\n          })\n        }\n        const answers = await inquirer.prompt([\n          {\n            type: 'list',\n            name: 'presentation',\n            choices: list,\n            message: 'Select presentation',\n          },\n        ])\n        selected = answers.presentation\n      }\n\n      if (selected) {\n        console.dir(selected, { depth: 10 })\n      } else {\n        console.log('Presentation not found.')\n      }\n    } else {\n      console.log('No presentations found.')\n    }\n  })\n\nexport { presentation }\n"
  },
  {
    "path": "packages/cli/src/sdr.ts",
    "content": "import { ICredentialRequestInput } from '@veramo/selective-disclosure'\nimport { getAgent } from './setup.js'\nimport { Command } from 'commander'\nimport inquirer from 'inquirer'\nimport qrcode from 'qrcode-terminal'\nimport { shortDate, shortDid } from './explore/utils.js'\nimport { VerifiableCredential } from '@veramo/core-types'\nimport { asArray, extractIssuer } from '@veramo/utils'\n\nimport fuzzy from 'fuzzy'\n\nconst sdr = new Command('sdr').description('Selective Disclosure Request')\n\nsdr\n  .command('create', { isDefault: true })\n  .description('create Selective Disclosure Request')\n  .option('-q, --qrcode', 'Show qrcode')\n  .action(async (opts: { qrcode: boolean }, cmd: Command) => {\n    const agent = await getAgent(cmd.optsWithGlobals().config)\n    const identifiers = await agent.didManagerFind()\n\n    const knownDids = await agent.dataStoreORMGetIdentifiers()\n\n    const subjects = [...knownDids.map((id) => id.did)]\n\n    if (identifiers.length === 0) {\n      console.error('No dids')\n      process.exit()\n    }\n    const answers = await inquirer.prompt([\n      {\n        type: 'list',\n        name: 'iss',\n        choices: identifiers.map((item) => item.did),\n        message: 'Issuer DID',\n      },\n      {\n        name: 'sub',\n        message: 'Subject DID',\n        type: 'autocomplete',\n        pageSize: 15,\n        source: async (answers: any, input: string) => {\n          const res = fuzzy\n            .filter(input, subjects)\n            .map((el: any) => (typeof el === 'string' ? el : el.original))\n          return res\n        },\n        validate: (val) => {\n          if (val && typeof val !== 'string') {\n            val = val.value\n          }\n          if (!val || !val.startsWith('did:')) {\n            return \"Subject DID does not start with 'did:'...\"\n          }\n          return true\n        },\n      },\n      {\n        type: 'input',\n        name: 'tag',\n        message: 'Tag (threadId)',\n      },\n    ])\n\n    let addMoreRequests = true\n    const claims = []\n\n    while (addMoreRequests) {\n      const answers2 = await inquirer.prompt([\n        {\n          type: 'input',\n          name: 'claimType',\n          message: 'Claim type',\n          default: 'name',\n        },\n        {\n          type: 'input',\n          name: 'reason',\n          message: 'Reason',\n          default: 'We need this to comply with local law',\n        },\n        {\n          type: 'list',\n          name: 'essential',\n          message: 'Is essential',\n          choices: [\n            { name: 'Yes', value: true },\n            { name: 'No', value: false },\n          ],\n        },\n        {\n          type: 'list',\n          name: 'addIssuer',\n          message: 'Add accepted issuer?',\n          choices: [\n            { name: 'Yes', value: true },\n            { name: 'No', value: false },\n          ],\n        },\n      ])\n\n      let addIssuer = answers2.addIssuer\n      const issuers = []\n      while (addIssuer) {\n        const issuerAnswers = await inquirer.prompt([\n          {\n            type: 'input',\n            name: 'did',\n            message: 'Issuer DID',\n            default: 'did:web:uport.me',\n          },\n          {\n            type: 'input',\n            name: 'url',\n            message: 'URL',\n            default: 'https://uport.me',\n          },\n          {\n            type: 'list',\n            name: 'addIssuer',\n            message: 'Add another accepted issuer?',\n            choices: [\n              { name: 'Yes', value: true },\n              { name: 'No', value: false },\n            ],\n          },\n        ])\n        issuers.push({\n          did: issuerAnswers.did,\n          url: issuerAnswers.url,\n        })\n        addIssuer = issuerAnswers.addIssuer\n      }\n\n      const answers4 = await inquirer.prompt([\n        {\n          type: 'list',\n          name: 'addMore',\n          message: 'Add another claim?',\n          choices: [\n            { name: 'Yes', value: true },\n            { name: 'No', value: false },\n          ],\n        },\n      ])\n\n      claims.push({\n        issuers: issuers,\n        essential: answers2.essential,\n        claimType: answers2.claimType,\n        reason: answers2.reason,\n      } as ICredentialRequestInput)\n      addMoreRequests = answers4.addMore\n    }\n\n    const answers5 = await inquirer.prompt([\n      {\n        type: 'list',\n        name: 'addCredentials',\n        message: 'Add profile credentials?',\n        choices: [\n          { name: 'Yes', value: true },\n          { name: 'No', value: false },\n        ],\n      },\n    ])\n\n    const credentials = []\n    if (answers5.addCredentials) {\n      const vcs = await agent.dataStoreORMGetVerifiableCredentials({\n        where: [{ column: 'subject', value: [answers.iss] }],\n      })\n\n      const list: any = []\n      if (vcs.length > 0) {\n        for (const credential of vcs) {\n          list.push({\n            name:\n              JSON.stringify(credential.verifiableCredential.credentialSubject) +\n              ' | Issuer: ' +\n              extractIssuer(credential.verifiableCredential),\n            value: credential.verifiableCredential.proof.jwt,\n          })\n        }\n\n        let addMoreCredentials = true\n\n        while (addMoreCredentials) {\n          const answers6 = await inquirer.prompt([\n            {\n              type: 'list',\n              name: 'credential',\n              choices: list,\n              message: 'Select credential',\n            },\n            {\n              type: 'list',\n              name: 'addMore',\n              message: 'Add another credential?',\n              choices: [\n                { name: 'Yes', value: true },\n                { name: 'No', value: false },\n              ],\n            },\n          ])\n          credentials.push(answers6.credential)\n          addMoreCredentials = answers6.addMore\n        }\n      }\n    }\n\n    const data: any = {\n      issuer: answers.iss,\n      claims,\n      credentials,\n    }\n    if (answers.tag !== '') {\n      data.tag = answers.tag\n    }\n    if (answers.sub !== '') {\n      data.subject = answers.sub\n    }\n    const jwt = await agent.createSelectiveDisclosureRequest({\n      data,\n    })\n\n    const { send } = await inquirer.prompt([\n      {\n        type: 'confirm',\n        name: 'send',\n        message: 'Send',\n      },\n    ])\n\n    const msg_data = {\n      from: answers.iss,\n      to: answers.sub,\n      type: 'jwt',\n      body: jwt,\n    }\n\n    if (!send) {\n      await agent.handleMessage({ raw: JSON.stringify(msg_data), metaData: [{ type: 'cli' }], save: true })\n    } else if (answers.sub !== '') {\n      try {\n        const result = await agent.sendMessageDIDCommAlpha1({\n          data: msg_data,\n        })\n        console.log('Sent:', result)\n      } catch (e) {\n        console.error(e)\n      }\n    } else {\n      console.log('Subject not specified')\n    }\n\n    if (opts.qrcode) {\n      qrcode.generate(jwt)\n    } else {\n      console.dir(data, { depth: 10 })\n      console.log(`jwt: ${jwt}`)\n    }\n  })\n\nsdr\n  .command('respond')\n  .description('respond to Selective Disclosure Request')\n  .action(async (opts: {}, cmd: Command) => {\n    const agent = await getAgent(cmd.optsWithGlobals().config)\n    const sdrMessages = await agent.dataStoreORMGetMessages({\n      where: [{ column: 'type', value: ['sdr'] }],\n      order: [{ column: 'createdAt', direction: 'DESC' }],\n    })\n\n    const list = sdrMessages.map((message) => ({\n      //FIXME\n      name:\n        shortDate(message.createdAt) +\n        ' ' +\n        shortDid(message.from) +\n        ' asking to share: ' +\n        // @ts-ignore\n        message.data?.claims?.map((claim) => claim.claimType).join(','),\n      value: message,\n    }))\n\n    const { message } = await inquirer.prompt([\n      {\n        type: 'list',\n        name: 'message',\n        choices: list,\n        message: 'Selective disclosure request',\n      },\n    ])\n    const args: any = {\n      sdr: message.data,\n    }\n    if (message.to) {\n      args.did = message.to\n    }\n    const credentialsForSdr = await agent.getVerifiableCredentialsForSdr(args)\n\n    const questions = []\n\n    for (const item of credentialsForSdr) {\n      questions.push({\n        type: 'checkbox',\n        name: item.claimType + ' ' + (item.essential ? '(essential)' : '') + item.reason,\n        choices: item.credentials.map((c) => ({\n          name:\n            c.verifiableCredential.credentialSubject[item.claimType] +\n            ' (' +\n            asArray(c.verifiableCredential.type || []).join(',') +\n            ') issued by: ' +\n            extractIssuer(c.verifiableCredential) +\n            ' ' +\n            shortDate(c.verifiableCredential.issuanceDate) +\n            ' ago',\n          value: c,\n        })),\n      })\n    }\n\n    const answers = await inquirer.prompt(questions)\n\n    let selectedCredentials: Array<VerifiableCredential> = []\n\n    for (const questionName of Object.keys(answers)) {\n      selectedCredentials = selectedCredentials.concat(answers[questionName])\n    }\n\n    const verifiablePresentation = await agent.createVerifiablePresentation({\n      save: false,\n      presentation: {\n        holder: message.to,\n        verifier: [message.from],\n        tag: message.tag,\n        '@context': ['https://www.w3.org/2018/credentials/v1'],\n        type: ['VerifiablePresentation'],\n        issuanceDate: new Date().toISOString(),\n        verifiableCredential: selectedCredentials,\n      },\n      proofFormat: 'jwt',\n    })\n\n    await agent.sendMessageDIDCommAlpha1({\n      save: true,\n      data: {\n        from: message.to,\n        to: message.from,\n        type: 'jwt',\n        body: verifiablePresentation.proof.jwt,\n      },\n    })\n\n    console.dir(verifiablePresentation, { depth: 10 })\n  })\n\nexport { sdr }\n"
  },
  {
    "path": "packages/cli/src/server.ts",
    "content": "import express from 'express'\nimport { Command } from 'commander'\nimport { getConfig } from './setup.js'\nimport { createObjects } from './lib/objectCreator.js'\n\nconst server = new Command('server')\n  .description('Launch OpenAPI server')\n  .option('-p, --port <number>', 'Optionally set port to override config')\n  .action(async (opts: { port: number }, cmd: Command) => {\n    const app = express()\n\n    let server: any\n\n    try {\n      const config = await createObjects(await getConfig(cmd.optsWithGlobals().config), { server: '/server' })\n      server = config.server\n    } catch (e: any) {\n      console.error(e.message)\n      process.exit(1)\n    }\n\n    for (let router of server.use) {\n      app.use(...router)\n      if (typeof router[0] === 'string') {\n        console.log(`Listening to route: ${server.baseUrl}${router[0]}`)\n      }\n    }\n\n    app.listen(opts.port || server.port, async () => {\n      console.log(`🚀 Cloud Agent ready at ${server.baseUrl}`)\n    })\n  })\n\nexport { server }\n"
  },
  {
    "path": "packages/cli/src/setup.ts",
    "content": "import yaml from 'yaml'\nimport {\n  ICredentialPlugin,\n  IDataStore,\n  IDataStoreORM,\n  IDIDManager,\n  IKeyManager,\n  IMessageHandler,\n  IResolver,\n  TAgent,\n} from '@veramo/core-types'\nimport {\n  IMediationManager,\n\n} from \"@veramo/mediation-manager\"\nimport { ISelectiveDisclosure } from '@veramo/selective-disclosure'\nimport { IDIDComm } from '@veramo/did-comm'\nimport { IDIDDiscovery } from '@veramo/did-discovery'\nimport { createAgentFromConfig } from './lib/agentCreator.js'\n\nimport fs from 'fs'\n\n/**\n * Parses a yaml config file and returns a config object\n * @param filePath\n */\nexport const getConfig = async (filePath: fs.PathLike): Promise<{ version?: number; [x: string]: any }> => {\n  let fileContent: string\n\n  // read file async\n  try {\n    fileContent = await fs.promises.readFile(filePath, 'utf8')\n  } catch (e) {\n    console.log('Config file not found: ' + filePath)\n    console.log('Use \"veramo config create\" to create one')\n    process.exit(1)\n  }\n\n  let config\n\n  try {\n    config = yaml.parse(fileContent, { prettyErrors: true })\n  } catch (e) {\n    console.error(`Unable to parse config file: ${e.message} ${e.linePos}`)\n    process.exit(1)\n  }\n\n  if (config?.version != 3) {\n    console.error('Unsupported configuration file version:', config.version)\n    process.exit(1)\n  }\n  return config\n}\n\nexport type EnabledInterfaces = IDIDManager &\n  IKeyManager &\n  IDataStore &\n  IDataStoreORM &\n  IResolver &\n  IMessageHandler &\n  IDIDComm &\n  ICredentialPlugin &\n  ISelectiveDisclosure &\n  IDIDDiscovery &\n  IMediationManager\n\nexport type ConfiguredAgent = TAgent<EnabledInterfaces>\n\nexport async function getAgent(fileName: string): Promise<ConfiguredAgent> {\n  try {\n    return await createAgentFromConfig<EnabledInterfaces>(await getConfig(fileName))\n  } catch (e: any) {\n    console.log('Unable to create agent from ' + fileName + '.', e.message)\n    process.exit(1)\n  }\n}\n"
  },
  {
    "path": "packages/cli/src/util.ts",
    "content": "export async function readStdin(): Promise<string> {\n  return new Promise((resolve, reject) => {\n    let data = ''\n    process.stdin.setEncoding('utf-8')\n\n    process.stdin.on('readable', () => {\n      let chunk: string\n      while ((chunk = process.stdin.read())) {\n        data += chunk\n      }\n    })\n\n    process.stdin.on('end', () => {\n      // There will be a trailing \\n from the user hitting enter. Get rid of it.\n      data = data.replace(/\\n$/, '')\n      resolve(data)\n    })\n\n    process.stdin.on('error', (error) => {\n      reject(error)\n    })\n  })\n}\n"
  },
  {
    "path": "packages/cli/tsconfig.json",
    "content": "{\n  \"extends\": \"../tsconfig.settings.json\",\n  \"compilerOptions\": {\n    \"rootDir\": \"src\",\n    \"outDir\": \"build\",\n    \"skipLibCheck\": true\n  },\n  \"references\": [\n    { \"path\": \"../core\" },\n    { \"path\": \"../core-types\" },\n    { \"path\": \"../credential-ld\" },\n    { \"path\": \"../credential-w3c\" },\n    { \"path\": \"../data-store\" },\n    { \"path\": \"../did-comm\" },\n    { \"path\": \"../did-discovery\" },\n    { \"path\": \"../did-jwt\" },\n    { \"path\": \"../did-manager\" },\n    { \"path\": \"../did-provider-ethr\" },\n    { \"path\": \"../did-provider-jwk\" },\n    { \"path\": \"../did-provider-key\" },\n    { \"path\": \"../did-provider-peer\" },\n    { \"path\": \"../did-provider-pkh\" },\n    { \"path\": \"../did-provider-web\" },\n    { \"path\": \"../did-resolver\" },\n    { \"path\": \"../key-manager\" },\n    { \"path\": \"../kms-local\" },\n    { \"path\": \"../message-handler\" },\n    { \"path\": \"../remote-server\" },\n    { \"path\": \"../remote-client\" },\n    { \"path\": \"../selective-disclosure\" },\n    { \"path\": \"../url-handler\" },\n    { \"path\": \"../utils\" }\n  ],\n  \"include\": [\"src/**/*\"]\n}\n"
  },
  {
    "path": "packages/cli/views/home.html",
    "content": "{{#each links}} <a href=\"{{url}}\">{{label}}</a><br />\n{{/each}}\n"
  },
  {
    "path": "packages/core/CHANGELOG.md",
    "content": "# Change Log\n\nAll notable changes to this project will be documented in this file.\nSee [Conventional Commits](https://conventionalcommits.org) for commit guidelines.\n\n# [7.0.0](https://github.com/decentralized-identity/veramo/compare/v6.0.2...v7.0.0) (2026-02-11)\n\n\n### Bug Fixes\n\n* **deps:** update devdeps and bump typeorm to 0.3.20 ([#1272](https://github.com/decentralized-identity/veramo/issues/1272)) ([7d17f37](https://github.com/decentralized-identity/veramo/commit/7d17f37ea7cc4e73a8cdae028681ae1be5c4d11c))\n\n\n\n\n\n## [6.0.2](https://github.com/decentralized-identity/veramo/compare/v6.0.1...v6.0.2) (2026-01-16)\n\n**Note:** Version bump only for package @veramo/core\n\n\n\n\n\n## [6.0.1](https://github.com/decentralized-identity/veramo/compare/v6.0.0...v6.0.1) (2026-01-16)\n\n**Note:** Version bump only for package @veramo/core\n\n\n\n\n\n# [6.0.0](https://github.com/decentralized-identity/veramo/compare/v5.6.0...v6.0.0) (2024-04-02)\n\n\n### Code Refactoring\n\n* generate plugin schemas as TS instead of JSON ([#1315](https://github.com/decentralized-identity/veramo/issues/1315)) ([65c2d4b](https://github.com/decentralized-identity/veramo/commit/65c2d4bc814daa9a3a89f4f7b8e8c6973b8ce2f0)), closes [#1254](https://github.com/decentralized-identity/veramo/issues/1254)\n\n\n### BREAKING CHANGES\n\n* The `plugin.schema.json` files are now generated as `plugin.schema.ts`.\n\n\n\n\n\n# [5.6.0](https://github.com/decentralized-identity/veramo/compare/v5.5.3...v5.6.0) (2024-01-16)\n\n\n### Features\n\n* **remote-client:** allow dynamic headers param for AgentRestClient constructor ([#1314](https://github.com/decentralized-identity/veramo/issues/1314)) ([1b8a0a2](https://github.com/decentralized-identity/veramo/commit/1b8a0a2718dd63492ad3a312a6ebe5f6e7849935)), closes [#1313](https://github.com/decentralized-identity/veramo/issues/1313)\n\n\n\n\n\n## [5.5.3](https://github.com/decentralized-identity/veramo/compare/v5.5.2...v5.5.3) (2023-10-09)\n\n\n### Bug Fixes\n\n* use DIF URLs in packages ([#1271](https://github.com/decentralized-identity/veramo/issues/1271)) ([3dfc601](https://github.com/decentralized-identity/veramo/commit/3dfc6014cdee7902c59d8db76b4c8507b870f227))\n\n\n\n\n\n# [5.5.0](https://github.com/uport-project/veramo/compare/v5.4.1...v5.5.0) (2023-09-19)\n\n\n### Bug Fixes\n\n* **did-provider-key:** use compressed keys for creating Secp256k1 did:key ([#1217](https://github.com/uport-project/veramo/issues/1217)) ([ba8f6f5](https://github.com/uport-project/veramo/commit/ba8f6f5b9b701e57af86491504ecd209ca0c1c1d)), closes [#1213](https://github.com/uport-project/veramo/issues/1213)\n\n\n\n\n\n## [5.4.1](https://github.com/uport-project/veramo/compare/v5.4.0...v5.4.1) (2023-08-04)\n\n\n### Bug Fixes\n\n* **ci:** benign change meant to tag all packages for another patch release ([#1211](https://github.com/uport-project/veramo/issues/1211)) ([41b5c90](https://github.com/uport-project/veramo/commit/41b5c90277171b7b38c5cf49ca01db5cf75b6300))\n\n\n\n\n\n# [5.4.0](https://github.com/uport-project/veramo/compare/v5.3.0...v5.4.0) (2023-08-01)\n\n\n### Features\n\n* **did-comm:** add support for the AES based content and key encryption algorithms ([#1180](https://github.com/uport-project/veramo/issues/1180)) ([5294a81](https://github.com/uport-project/veramo/commit/5294a812ee578c0712b54f216416c3ef78c848da))\n\n\n\n\n\n# [5.3.0](https://github.com/uport-project/veramo/compare/v5.2.0...v5.3.0) (2023-07-27)\n\n\n### Features\n\n* export didcomm mediator utils ([#1181](https://github.com/uport-project/veramo/issues/1181)) ([264b6a7](https://github.com/uport-project/veramo/commit/264b6a71a8647f456daedcca99efa453f53ab8a1))\n\n\n\n\n\n# [5.2.0](https://github.com/uport-project/veramo/compare/v5.1.4...v5.2.0) (2023-05-02)\n\n\n### Bug Fixes\n\n* **deps:** update dependency z-schema to v6 ([0cdd100](https://github.com/uport-project/veramo/commit/0cdd100c810df0e27596a537b07f54f78b0bab6b))\n\n\n\n\n\n## [5.1.2](https://github.com/uport-project/veramo/compare/v5.1.1...v5.1.2) (2023-02-25)\n\n**Note:** Version bump only for package @veramo/core\n\n\n\n\n\n# [5.1.0](https://github.com/uport-project/veramo/compare/v5.0.0...v5.1.0) (2023-02-24)\n\n\n### Bug Fixes\n\n* **cli:** create veramo instance async in CLI ([#1126](https://github.com/uport-project/veramo/issues/1126)) ([05ab106](https://github.com/uport-project/veramo/commit/05ab10653aac4cb37b00a9be6cc0c7be910f1827)), closes [#1125](https://github.com/uport-project/veramo/issues/1125)\n\n\n\n\n\n# [5.0.0](https://github.com/uport-project/veramo/compare/v4.3.0...v5.0.0) (2023-02-09)\n\n\n### Build System\n\n* convert veramo modules to ESM instead of CommonJS ([#1103](https://github.com/uport-project/veramo/issues/1103)) ([b5cea3c](https://github.com/uport-project/veramo/commit/b5cea3c0d80d900a47bd1d9eea68f84b70a35e7b)), closes [#1099](https://github.com/uport-project/veramo/issues/1099)\n\n\n### Features\n\n* isolate `core-types` package from `core` ([#1116](https://github.com/uport-project/veramo/issues/1116)) ([ba7a303](https://github.com/uport-project/veramo/commit/ba7a303de91cf4cc568a3af1ddf8ca98ed022e9f))\n\n\n### BREAKING CHANGES\n\n* this is a breaking change as modules will have to be imported differently: \n* https://www.typescriptlang.org/docs/handbook/esm-node.html\n* https://nodejs.org/api/esm.html\n* https://caniuse.com/?search=modules\n\ntest(did-provider-ion): skip a couple of tests that fail with unreasonable errors\nchore: use ubuntu-latest on CI\nfix: temporarily remove puppeteer tests\nfix: use craco for test-react-app to enable babel config\ntest: fix unit and integration tests (browser tests still broken)\nfix: fix some build issues that prevented tests from working\nfix: missing deps flagged by pnpm\n\n\n\n\n\n# [4.3.0](https://github.com/uport-project/veramo/compare/v4.2.0...v4.3.0) (2023-01-27)\n\n\n### Features\n\n* **did-comm:** support DIDComm Messaging attachments ([#1087](https://github.com/uport-project/veramo/issues/1087)) ([6679574](https://github.com/uport-project/veramo/commit/66795742a01d5390ad083610efd28a8fe59fb3a3)), closes [#612](https://github.com/uport-project/veramo/issues/612)\n\n\n\n\n\n# [4.2.0](https://github.com/uport-project/veramo/compare/v4.1.2...v4.2.0) (2022-12-05)\n\n\n### Bug Fixes\n\n* **cli:** fix bug in schema generator ([d4c63c1](https://github.com/uport-project/veramo/commit/d4c63c1d1c3acb2a2f576450384250163ae7e0a0))\n* **deps:** bump dependencies ([701b8ed](https://github.com/uport-project/veramo/commit/701b8edf981ea11c7ddb6a81d2817dbbdbb022f3))\n\n\n\n\n\n## [4.1.1](https://github.com/uport-project/veramo/compare/v4.1.0...v4.1.1) (2022-11-01)\n\n**Note:** Version bump only for package @veramo/core\n\n\n\n\n\n# [4.1.0](https://github.com/uport-project/veramo/compare/v4.0.2...v4.1.0) (2022-10-31)\n\n\n### Bug Fixes\n\n* **deps:** Update dependency ethr-did-resolver to v7 ([#1038](https://github.com/uport-project/veramo/issues/1038)) ([d421c0f](https://github.com/uport-project/veramo/commit/d421c0f9f5934829df2930e58e98bcfce813ce84))\n* **deps:** Update did-vc-libraries ([6fa13ab](https://github.com/uport-project/veramo/commit/6fa13ab7fbab979db2d41e84e445a52cf9319003))\n* remove deprecated testnets ([#1028](https://github.com/uport-project/veramo/issues/1028)) ([2823738](https://github.com/uport-project/veramo/commit/28237383d0cc2eb20bcf8e10562221ea2ab32f94)), closes [#1025](https://github.com/uport-project/veramo/issues/1025)\n\n\n### Features\n\n* add support for NIST Secp256r1 keys and ES256 signatures ([#1039](https://github.com/uport-project/veramo/issues/1039)) ([61eb369](https://github.com/uport-project/veramo/commit/61eb369cfcde7372babf3f68fb65ea2055b5bf70))\n\n\n\n\n\n# [4.0.0](https://github.com/uport-project/veramo/compare/v3.1.5...v4.0.0) (2022-09-22)\n\n\n### Bug Fixes\n\n* **core:** plugin schema ([e5a48ad](https://github.com/uport-project/veramo/commit/e5a48ad85590b21c6256604e2769f19039fe1603))\n* deprecate the `save` parameter ([#975](https://github.com/uport-project/veramo/issues/975)) ([598c0e1](https://github.com/uport-project/veramo/commit/598c0e1e3f37d1b30c865fa01b93b7657f43d795)), closes [#966](https://github.com/uport-project/veramo/issues/966)\n* **deps:** Bump `did-jwt`, `did-jwt-vc` as direct package deps ([#955](https://github.com/uport-project/veramo/issues/955)) ([e57edb3](https://github.com/uport-project/veramo/commit/e57edb34cfbaee6bba1d944497d688104f32c698))\n* **deps:** update dependency did-jwt-vc to v2.1.8 ([d4520be](https://github.com/uport-project/veramo/commit/d4520be7f8ca140a5c8eafd7effb38812d51f2b4))\n* **deps:** Update dependency did-jwt-vc to v3 ([014c1ab](https://github.com/uport-project/veramo/commit/014c1ab974647d44d7ef1de0f931625348c4c98b))\n* **deps:** use did-jwt v6 and ethr-did-resolver v6 ([#925](https://github.com/uport-project/veramo/issues/925)) ([0c77d03](https://github.com/uport-project/veramo/commit/0c77d03ec5ec9e2091de3f74f67ab86a22cde197)), closes [#923](https://github.com/uport-project/veramo/issues/923) [#848](https://github.com/uport-project/veramo/issues/848)\n* **did-resolver:** use interface `Resolvable` instead of the `Resolver` class ([9c2e59f](https://github.com/uport-project/veramo/commit/9c2e59f3f23f808511c6c0e8e440b4d53ba5cb00))\n* **docs:** fix relevant errors and warnings in TSDoc to enable proper docs generation on `[@next](https://github.com/next)` branch ([79c3872](https://github.com/uport-project/veramo/commit/79c387230219c92c1951d19b8ddf716308a46c5b))\n* update and fix inline documentation of all exported types ([#921](https://github.com/uport-project/veramo/issues/921)) ([63e64e0](https://github.com/uport-project/veramo/commit/63e64e0e2693808c4704dca8cc511dc0bab3f3b1))\n\n\n### Features\n\n* add key type definitions: 'Bls12381G1Key2020' and 'Bls12381G2Key2020' ([#839](https://github.com/uport-project/veramo/issues/839)) ([0f0f517](https://github.com/uport-project/veramo/commit/0f0f517d97230fd5334d604d4f20d575a14f8670))\n* add support for serviceEndpoint property as defined in latest DID Spec ([#988](https://github.com/uport-project/veramo/issues/988)) ([9bed70b](https://github.com/uport-project/veramo/commit/9bed70ba658aed34a97944e0dee27bca6c81d700))\n* **credential-status:** expect revoked boolean property from StatusMethods ([e00daa4](https://github.com/uport-project/veramo/commit/e00daa47865ea42d7bd8667f37c6e12fc21fd4b9))\n* **credential-status:** rename plugin interfaces and methods ([a5adaba](https://github.com/uport-project/veramo/commit/a5adaba21a97f525bf69d156df991afc234896ab)), closes [#981](https://github.com/uport-project/veramo/issues/981)\n* **credential-w3c:** add ICredentialPlugin interface in core package ([#1001](https://github.com/uport-project/veramo/issues/1001)) ([7b6d195](https://github.com/uport-project/veramo/commit/7b6d1950364c8b741dd958d29e506b95fa5b1cec)), closes [#941](https://github.com/uport-project/veramo/issues/941)\n* **credential-w3c:** add override policies to verifyPresentation ([#990](https://github.com/uport-project/veramo/issues/990)) ([06b3147](https://github.com/uport-project/veramo/commit/06b314717cbe35f696e706b1ebf5e54438115493)), closes [#375](https://github.com/uport-project/veramo/issues/375) [#954](https://github.com/uport-project/veramo/issues/954)\n* **credential-w3c:** align verification API between formats ([#996](https://github.com/uport-project/veramo/issues/996)) ([b987fc0](https://github.com/uport-project/veramo/commit/b987fc0903a31d3bbffb43fef872be4d6c62c2ad)), closes [#935](https://github.com/uport-project/veramo/issues/935) [#954](https://github.com/uport-project/veramo/issues/954) [#375](https://github.com/uport-project/veramo/issues/375) [#989](https://github.com/uport-project/veramo/issues/989)\n* **date-store-json:** add JSON object storage implementation ([#819](https://github.com/uport-project/veramo/issues/819)) ([934b34a](https://github.com/uport-project/veramo/commit/934b34a18b194928f90e7797289cc6f2243789ec))\n* define an interface for credential status manager ([#956](https://github.com/uport-project/veramo/issues/956)) ([6fbd22f](https://github.com/uport-project/veramo/commit/6fbd22fa6ba7bb1d4092afbded0f95c0d841bd97)), closes [#937](https://github.com/uport-project/veramo/issues/937) [#981](https://github.com/uport-project/veramo/issues/981)\n* **did-manager:** add`didManagerUpdate` method for full DID document updates ([#974](https://github.com/uport-project/veramo/issues/974)) ([5682b25](https://github.com/uport-project/veramo/commit/5682b2566b7c4f8f9bfda10e8d06a8d2624c2a1b)), closes [#971](https://github.com/uport-project/veramo/issues/971) [#960](https://github.com/uport-project/veramo/issues/960) [#948](https://github.com/uport-project/veramo/issues/948)\n\n\n### BREAKING CHANGES\n\n* the `did-resolver` and connected libraries change the data-type for `ServiceEndpoint` to `Service` and the previous semantic has changed. Services can have multiple endpoints, not just a single string.\n\n\n\n\n\n## [3.1.3](https://github.com/uport-project/veramo/compare/v3.1.2...v3.1.3) (2022-06-01)\n\n**Note:** Version bump only for package @veramo/core\n\n\n\n\n\n# [3.1.0](https://github.com/uport-project/veramo/compare/v3.0.0...v3.1.0) (2021-11-12)\n\n\n### Bug Fixes\n\n* **data-store:** add support for entityPrefix ([#725](https://github.com/uport-project/veramo/issues/725)) ([801bb95](https://github.com/uport-project/veramo/commit/801bb95ddd22abaa61c938b025834132d4e8d3be)), closes [#724](https://github.com/uport-project/veramo/issues/724)\n\n\n### Features\n\n* **did-comm:** didcomm messaging using did:ethr ([#744](https://github.com/uport-project/veramo/issues/744)) ([1be5e04](https://github.com/uport-project/veramo/commit/1be5e04e09112c0823d776fe2d55117d71a7b448)), closes [#743](https://github.com/uport-project/veramo/issues/743)\n\n\n\n\n\n# [3.0.0](https://github.com/uport-project/veramo/compare/v2.1.3...v3.0.0) (2021-09-20)\n\n\n### Bug Fixes\n\n* **deps:** update all non-major dependencies ([8fc5312](https://github.com/uport-project/veramo/commit/8fc53120498ce2982e8ec640e00bbb03f6f4204e))\n\n\n### Features\n\n* **data-store:** initialize DB using migrations ([#679](https://github.com/uport-project/veramo/issues/679)) ([41f6240](https://github.com/uport-project/veramo/commit/41f6240d68a79338772230cbfff768189ab031ed)), closes [#676](https://github.com/uport-project/veramo/issues/676)\n* **key-manager:** move private key storage to kms-local ([#661](https://github.com/uport-project/veramo/issues/661)) ([6b1d135](https://github.com/uport-project/veramo/commit/6b1d135eedb1c58b715be8941d34312da39facb2)), closes [#539](https://github.com/uport-project/veramo/issues/539) [#540](https://github.com/uport-project/veramo/issues/540) [#680](https://github.com/uport-project/veramo/issues/680)\n\n\n### BREAKING CHANGES\n\n* **key-manager:** `keyManagetGet` no longer returns private key data\n* **key-manager:** `KeyStore` no longer requires a `SecretBox`\n* **key-manager:** `KeyManagementSystem` needs a `PrivateKeyStore`\n* **key-manager:** @veramo/cli configuration version update to 3.0\n\nIf you're already working with Veramo and wish to upgrade existing agents to veramo 3.0, you'll have to make some changes to your configuration, depending on how you're using the framework.\n\nIt boils down to these 3 steps:\n\n1. Update your database connection to use migrations\n2. Remove the `SecretBox` parameter from `KeyManager`\n3. Add a `PrivateKeyStore` parameter to `KeyManagementSystem` with a `SecretBox` that you were using before with `KeyManager` (and keep the same encryption key)\n\n* feat(key-manager): move private key storage to kms-local\n* **data-store:** database needs migrations for initialization. See #679 #676\nThe `@veramo/data-store` package relies on `typeorm` as a database abstraction.\nTypeorm has a connection flag `synchonize` which bootstraps the database along with schema and relations based on a set of `Entities` (annotated typescript classes).\nThis is very handy for fast development iterations but it is **not recommended for production** use because there is too much ambiguity possible when the `Entities` change, and there is a risk of data loss.\nThe recommended way to do things is to use the `migrations` mechanism. It allows you to migrate to new database schemas when necessary, and even customize the database to your own needs.\n\n**Going forward, this is the mechanism we will be recommending for connections.**\n\n\n\n\n\n# [2.1.0](https://github.com/uport-project/veramo/compare/v2.0.1...v2.1.0) (2021-08-11)\n\n\n### Bug Fixes\n\n* **credentials-w3c:** accept Presentations without Credentials ([#616](https://github.com/uport-project/veramo/issues/616)) ([2389cd0](https://github.com/uport-project/veramo/commit/2389cd0df080e968ee320d66fabf2e8a7b51ba47))\n\n\n### Features\n\n* **data-store:** delete verifiable credential ([#634](https://github.com/uport-project/veramo/issues/634)) ([c7b0131](https://github.com/uport-project/veramo/commit/c7b0131c94e21c5c6800990c5743418b6b135a30)), closes [#635](https://github.com/uport-project/veramo/issues/635)\n\n\n\n\n\n# [2.0.0](https://github.com/uport-project/veramo/compare/v1.2.2...v2.0.0) (2021-07-14)\n\n\n### Bug Fixes\n\n* **deps:** bump did-jwt to 5.4.0 ([#528](https://github.com/uport-project/veramo/issues/528)) ([65f22cf](https://github.com/uport-project/veramo/commit/65f22cf6dcca48b5bb35331894536a2a567a1189))\n* **kms-local:** replace buggy didcomm clone with did jwt implementation ([#548](https://github.com/uport-project/veramo/issues/548)) ([9dea353](https://github.com/uport-project/veramo/commit/9dea3533c1936d53c1d5674c358679b17d623af2)), closes [#538](https://github.com/uport-project/veramo/issues/538)\n\n\n### Features\n\n* **cli:** export new agent methods and request LD DIDDocument by default ([#617](https://github.com/uport-project/veramo/issues/617)) ([26d088b](https://github.com/uport-project/veramo/commit/26d088b86ecfd66a00cdef7c7bb926148f46fbc9))\n* implement didcomm v2 packing/unpacking ([#575](https://github.com/uport-project/veramo/issues/575)) ([249b07e](https://github.com/uport-project/veramo/commit/249b07eca8d2de9eb5252d71683d5f1fba319d60)), closes [#559](https://github.com/uport-project/veramo/issues/559) [#558](https://github.com/uport-project/veramo/issues/558)\n* **key-manager:** add generic signing capabilities ([#529](https://github.com/uport-project/veramo/issues/529)) ([5f10a1b](https://github.com/uport-project/veramo/commit/5f10a1bcea214cb593de12fa6ec3a91b3cb712bb)), closes [#522](https://github.com/uport-project/veramo/issues/522)\n* **key-manager:** add method to compute a shared secret ([#555](https://github.com/uport-project/veramo/issues/555)) ([393c316](https://github.com/uport-project/veramo/commit/393c316e27fb31b3c7fa63aae039b8fc6ae963ce)), closes [#541](https://github.com/uport-project/veramo/issues/541)\n* **key-manager:** implement JWE functionality directly in `key-manager` ([#557](https://github.com/uport-project/veramo/issues/557)) ([a030f0a](https://github.com/uport-project/veramo/commit/a030f0a9779e5158d9369d2f81107158fbaeac70)), closes [#556](https://github.com/uport-project/veramo/issues/556)\n\n\n### BREAKING CHANGES\n\n* **kms-local:** `@veramo/kms-local-react-native` is no more. On react-native, please use `@veramo/kms-local` instead, combined with `@ethersproject/shims`\n\n\n\n\n\n# [1.2.0](https://github.com/uport-project/veramo/compare/v1.1.2...v1.2.0) (2021-04-27)\n\n\n### Bug Fixes\n\n* **deps:** update all non-major dependencies ([#462](https://github.com/uport-project/veramo/issues/462)) ([4a2b206](https://github.com/uport-project/veramo/commit/4a2b20633810b45a155bf2149cbff57d157bda3c))\n\n\n### Features\n\n* adapt to did core spec ([#430](https://github.com/uport-project/veramo/issues/430)) ([9712db0](https://github.com/uport-project/veramo/commit/9712db0eea1a3f48cf0665d66ae715ea0c23cd4a)), closes [#418](https://github.com/uport-project/veramo/issues/418) [#428](https://github.com/uport-project/veramo/issues/428) [#417](https://github.com/uport-project/veramo/issues/417) [#416](https://github.com/uport-project/veramo/issues/416) [#412](https://github.com/uport-project/veramo/issues/412) [#397](https://github.com/uport-project/veramo/issues/397) [#384](https://github.com/uport-project/veramo/issues/384) [#394](https://github.com/uport-project/veramo/issues/394)\n* **core:** add ability to define the agent context type ([#350](https://github.com/uport-project/veramo/issues/350)) ([89255b9](https://github.com/uport-project/veramo/commit/89255b9a648c38656aea05131750e68497d04c27))\n* **did-provider-key:** add did:key provider; fixes [#335](https://github.com/uport-project/veramo/issues/335) ([#351](https://github.com/uport-project/veramo/issues/351)) ([42cd2b0](https://github.com/uport-project/veramo/commit/42cd2b08a2fd21b5b5d7bdfa57dd00ccc7184dc7)), closes [decentralized-identity/did-jwt#78](https://github.com/decentralized-identity/did-jwt/issues/78)\n\n\n\n\n\n# [1.1.0](https://github.com/uport-project/veramo/compare/v1.0.1...v1.1.0) (2021-01-26)\n\n\n### Bug Fixes\n\n* **deps:** update dependency z-schema to v5 ([#323](https://github.com/uport-project/veramo/issues/323)) ([9cadf37](https://github.com/uport-project/veramo/commit/9cadf378dba487b1a664a6277eafffd629c65600))\n\n\n### Features\n\n* **core:** make agent context public readonly ([#347](https://github.com/uport-project/veramo/issues/347)) ([802948e](https://github.com/uport-project/veramo/commit/802948ea72edf8b00c42115f73430720debabed9))\n\n\n\n\n\n## 1.0.1 (2020-12-18)\n\n**Note:** Version bump only for package @veramo/core\n"
  },
  {
    "path": "packages/core/LICENSE",
    "content": "                                 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 2019 Consensys AG\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"
  },
  {
    "path": "packages/core/README.md",
    "content": "# Veramo Core\n\n### Core functions\n\n- instantiate and orchestrate plugins\n- coordinate events\n- validate schemas\n- define core types\n"
  },
  {
    "path": "packages/core/api-extractor.json",
    "content": "{\n  \"$schema\": \"https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json\",\n  \"apiReport\": {\n    \"enabled\": true,\n    \"reportFolder\": \"./api\",\n    \"reportTempFolder\": \"./api\"\n  },\n\n  \"docModel\": {\n    \"enabled\": true,\n    \"apiJsonFilePath\": \"./api/<unscopedPackageName>.api.json\"\n  },\n\n  \"dtsRollup\": {\n    \"enabled\": false\n  },\n  \"mainEntryPointFilePath\": \"<projectFolder>/build/index.d.ts\"\n}\n"
  },
  {
    "path": "packages/core/package.json",
    "content": "{\n  \"name\": \"@veramo/core\",\n  \"description\": \"Veramo Core Logic & Interfaces.\",\n  \"version\": \"7.0.0\",\n  \"main\": \"build/index.js\",\n  \"exports\": {\n    \".\": \"./build/index.js\"\n  },\n  \"types\": \"build/index.d.ts\",\n  \"scripts\": {\n    \"build\": \"tsc\",\n    \"extract-api\": \"node ../cli/bin/veramo.js dev extract-api\"\n  },\n  \"dependencies\": {\n    \"@veramo/core-types\": \"workspace:^\",\n    \"debug\": \"^4.3.4\",\n    \"events\": \"^3.2.0\",\n    \"z-schema\": \"^6.0.1\"\n  },\n  \"devDependencies\": {\n    \"@types/debug\": \"4.1.8\",\n    \"@types/events\": \"3.0.0\",\n    \"typescript\": \"5.7.3\"\n  },\n  \"files\": [\n    \"build/**/*\",\n    \"src/**/*\",\n    \"README.md\",\n    \"LICENSE\"\n  ],\n  \"publishConfig\": {\n    \"access\": \"public\"\n  },\n  \"repository\": {\n    \"type\": \"git\",\n    \"url\": \"https://github.com/decentralized-identity/veramo.git\",\n    \"directory\": \"packages/core\"\n  },\n  \"author\": \"Consensys Mesh R&D <hello@veramo.io>\",\n  \"contributors\": [\n    \"Simonas Karuzas <simonas.karuzas@mesh.xyz>\",\n    \"Mircea Nistor <mircea.nistor@mesh.xyz>\"\n  ],\n  \"keywords\": [\n    \"Veramo\",\n    \"DID\",\n    \"Verifiable Credential\",\n    \"plugin host\"\n  ],\n  \"license\": \"Apache-2.0\",\n  \"type\": \"module\",\n  \"moduleDirectories\": [\n    \"node_modules\",\n    \"src\"\n  ]\n}\n"
  },
  {
    "path": "packages/core/src/__tests__/agent.subscriber.test.ts",
    "content": "import { Agent } from '../agent.js'\nimport { CoreEvents, IEventListener } from '../../../core-types/src'\nimport { jest } from '@jest/globals'\n\nfunction sleep(ms: number) {\n  return new Promise((resolve) => setTimeout(resolve, ms))\n}\n\ndescribe('core agent', () => {\n  it('calls listener with object data', async () => {\n    const plugin: IEventListener = {\n      eventTypes: ['foo'],\n      onEvent: jest.fn(() => Promise.resolve()),\n    }\n    const agent = new Agent({\n      plugins: [plugin],\n    })\n\n    agent.emit('foo', { bar: 'baz' })\n\n    expect(plugin.onEvent).toHaveBeenCalledWith({ type: 'foo', data: { bar: 'baz' } }, { agent })\n  })\n\n  it('calls listener with primitive data', async () => {\n    const plugin: IEventListener = {\n      eventTypes: ['foo'],\n      onEvent: jest.fn(() => Promise.resolve()),\n    }\n    const agent = new Agent({\n      plugins: [plugin],\n    })\n\n    agent.emit('foo', 'bar')\n\n    expect(plugin.onEvent).toHaveBeenCalledWith({ type: 'foo', data: 'bar' }, { agent })\n  })\n\n  it('does not call listener with mismatched eventType', async () => {\n    const plugin: IEventListener = {\n      eventTypes: ['foo'],\n      onEvent: jest.fn(() => Promise.resolve()),\n    }\n    const agent = new Agent({\n      plugins: [plugin],\n    })\n\n    agent.emit('bar', 'baz')\n\n    expect(plugin.onEvent).not.toHaveBeenCalled()\n  })\n\n  it('handles event chain', async () => {\n    expect.assertions(1)\n    const firstPlugin: IEventListener = {\n      eventTypes: ['foo'],\n      onEvent: async (event, context) => {\n        context.agent.emit('bar', { baz: 'bam' })\n      },\n    }\n    const secondPlugin: IEventListener = {\n      eventTypes: ['bar'],\n      onEvent: jest.fn(() => Promise.resolve()),\n    }\n    const agent = new Agent({\n      plugins: [firstPlugin, secondPlugin],\n    })\n\n    agent.emit('foo', {})\n\n    expect(secondPlugin.onEvent).toHaveBeenCalled()\n  })\n\n  it('handles errors thrown in listeners', async () => {\n    const plugin: IEventListener = {\n      eventTypes: ['foo'],\n      onEvent: async () => {\n        throw new Error(\"I can't handle it!!!!\")\n      },\n    }\n    const errorHandler: IEventListener = {\n      eventTypes: [CoreEvents.error],\n      onEvent: jest.fn(() => Promise.resolve()),\n    }\n    const agent = new Agent({\n      plugins: [plugin, errorHandler],\n    })\n\n    await agent.emit('foo', 'bar')\n\n    expect(errorHandler.onEvent).toHaveBeenCalledWith(\n      {\n        type: CoreEvents.error,\n        data: new Error(\"I can't handle it!!!!\"),\n      },\n      { agent: agent },\n    )\n  })\n\n  it('re emits errors thrown in listeners', async () => {\n    expect.assertions(2)\n    const plugin: IEventListener = {\n      eventTypes: ['foo'],\n      onEvent: async () => {\n        await sleep(1500)\n        throw new Error(\"I can't handle it after waiting so long!!!!\")\n      },\n    }\n    const errorHandler: IEventListener = {\n      eventTypes: [CoreEvents.error],\n      onEvent: async ({ type, data }, context) => {\n        expect(type).toBe(CoreEvents.error)\n        const err = data as Error\n        expect(err.message).toMatch(\"I can't handle it after waiting so long!!!!\")\n      },\n    }\n    const agent = new Agent({\n      plugins: [plugin, errorHandler],\n    })\n\n    await agent.emit('foo', {})\n  })\n\n  it('handles events asynchronously', async () => {\n    let trackRecord = ''\n    const pluginFoo: IEventListener = {\n      eventTypes: ['foo'],\n      onEvent: async () => {\n        await sleep(0)\n        trackRecord += 'foo'\n      },\n    }\n    const pluginBar: IEventListener = {\n      eventTypes: ['foo'],\n      onEvent: async () => {\n        await sleep(0)\n        trackRecord += 'bar'\n      },\n    }\n    const agent = new Agent({\n      plugins: [pluginFoo, pluginBar],\n    })\n\n    //fire and forget\n    agent.emit('foo', {})\n    trackRecord += 'baz'\n\n    expect(trackRecord).toEqual('baz')\n\n    //wait for state changes\n    await agent.emit('null', {})\n    expect(trackRecord).toEqual('bazfoobar')\n  })\n\n  //FIXME: do we impose that a plugin only be registered once?\n  it.skip('can NOT register plugin multiple times', async () => {\n    let trackRecord = ''\n    const plugin: IEventListener = {\n      eventTypes: ['foo'],\n      onEvent: async () => {\n        trackRecord += 'foo'\n      },\n    }\n    const agent = new Agent({\n      plugins: [plugin, plugin, plugin],\n    })\n\n    await agent.emit('foo', {})\n\n    expect(trackRecord).toEqual('foo')\n  })\n\n  it(\"throwing in an error listener doesn't go into an endless loop\", async () => {\n    const plugin: IEventListener = {\n      eventTypes: ['foo'],\n      onEvent: async () => {\n        throw new Error('fooError')\n      },\n    }\n    const errorHandler: IEventListener = {\n      eventTypes: [CoreEvents.error],\n      onEvent: async () => {\n        throw new Error('barError')\n      },\n    }\n    const agent = new Agent({\n      plugins: [plugin, errorHandler],\n    })\n\n    await expect(agent.emit('foo', {})).rejects.toThrow('ErrorEventHandlerError')\n  })\n})\n"
  },
  {
    "path": "packages/core/src/__tests__/agent.test.ts",
    "content": "import { Agent, createAgent } from '../agent.js'\nimport { IAgentPlugin, IResolver } from '../../../core-types/src'\nimport { jest } from '@jest/globals'\n\ndescribe('core agent', () => {\n  it('should use plugin methods', async () => {\n    const plugin: IAgentPlugin = {\n      methods: {\n        doSomething: jest.fn(() => Promise.resolve()),\n      },\n    }\n    const agent = new Agent({\n      plugins: [plugin],\n    })\n\n    // @ts-ignore\n    await agent.doSomething({ foo: 'baz' })\n    expect(plugin.methods?.doSomething).toHaveBeenCalledWith({ foo: 'baz' }, { agent })\n    await agent.execute('doSomething', { foo: 'bar' })\n    expect(plugin.methods?.doSomething).toHaveBeenCalledWith({ foo: 'bar' }, { agent })\n  })\n\n  it('should allow method overrides', async () => {\n    const doSomething = jest.fn()\n    const plugin: IAgentPlugin = {\n      methods: {\n        doSomething: jest.fn(() => Promise.resolve()),\n      },\n    }\n    const agent = new Agent({\n      plugins: [plugin],\n      overrides: {\n        // @ts-ignore\n        doSomething,\n      },\n    })\n\n    // @ts-ignore\n    await agent.doSomething({ foo: 'baz' })\n    expect(doSomething).toHaveBeenCalledWith({ foo: 'baz' }, { agent })\n    await agent.execute('doSomething', { foo: 'bar' })\n    expect(doSomething).toHaveBeenCalledWith({ foo: 'bar' }, { agent })\n  })\n\n  it('should expose only authorized methods', async () => {\n    const doSomething = jest.fn()\n    const baz = jest.fn()\n    const plugin: IAgentPlugin = {\n      methods: {\n        foo: jest.fn(() => Promise.resolve()),\n        bar: jest.fn(() => Promise.resolve()),\n      },\n    }\n    const agent = new Agent({\n      authorizedMethods: ['bar', 'baz'],\n      plugins: [plugin],\n      overrides: {\n        // @ts-ignore\n        doSomething,\n        // @ts-ignore\n        baz,\n      },\n    })\n\n    // @ts-ignore\n    expect(agent.doSomething).toEqual(undefined)\n    expect(agent.execute('doSomething', { foo: 'bar' })).rejects.toEqual(\n      Error('Method not available: doSomething'),\n    )\n\n    // @ts-ignore\n    await agent.bar({ foo: 'baz' })\n    expect(plugin.methods?.bar).toHaveBeenCalledWith({ foo: 'baz' }, { agent })\n    await agent.execute('baz', { foo: 'bar' })\n    expect(baz).toHaveBeenCalledWith({ foo: 'bar' }, { agent })\n\n    expect(agent.availableMethods()).toEqual(['bar', 'baz'])\n  })\n\n  it('should pass through context', async () => {\n    const plugin: IAgentPlugin = {\n      methods: {\n        doSomething: jest.fn(() => Promise.resolve()),\n      },\n    }\n    const agent = new Agent({\n      context: {\n        authorizedDid: 'did:example:123',\n      },\n      plugins: [plugin],\n    })\n\n    // @ts-ignore\n    await agent.doSomething({ foo: 'baz' })\n    expect(plugin.methods?.doSomething).toHaveBeenCalledWith(\n      { foo: 'baz' },\n      { agent, authorizedDid: 'did:example:123' },\n    )\n    await agent.execute('doSomething', { foo: 'bar' })\n    expect(plugin.methods?.doSomething).toHaveBeenCalledWith(\n      { foo: 'bar' },\n      { agent, authorizedDid: 'did:example:123' },\n    )\n  })\n\n  it('should be possible to define context type', () => {\n    interface IContext {\n      name: string\n      authorizedDid: string\n    }\n    const agent = createAgent<IResolver, IContext>({\n      context: {\n        name: 'Agent name',\n        authorizedDid: 'did:example:123',\n      },\n    })\n\n    expect(agent.context?.name).toEqual('Agent name')\n    expect(agent.context?.authorizedDid).toEqual('did:example:123')\n  })\n\n  it('context type should be optional', () => {\n    const agent = createAgent<IResolver>({\n      context: {\n        name: 'Agent name',\n        authorizedDid: 'did:example:123',\n      },\n    })\n\n    expect(agent.context?.name).toEqual('Agent name')\n    expect(agent.context?.authorizedDid).toEqual('did:example:123')\n  })\n\n  it.todo('createAgent should return instance of Agent')\n  it.todo('should throw an error on method exception')\n  it.todo('should throw an error on invalid types of constructor params')\n  it.todo('should throw an error on invalid types of constructor param')\n  it.todo('should throw an error if plugin implements protected methods')\n  it.todo(\"should throw an error if authorized methods don't match available methods\")\n  it.todo('should throw an error if execute is called on unauthorized method')\n})\n"
  },
  {
    "path": "packages/core/src/agent.ts",
    "content": "import type { IAgent, IAgentOptions, IAgentPluginSchema, IPluginMethodMap, TAgent } from '@veramo/core-types'\nimport { CoreEvents } from '@veramo/core-types'\nimport { validateArguments, validateReturnType } from './validator.js'\nimport ValidationErrorSchema from './schemas/ValidationError.js'\nimport Debug from 'debug'\nimport { EventEmitter } from 'events'\n\n/**\n * Filters unauthorized methods. By default, all methods are authorized\n * @internal\n */\nconst filterUnauthorizedMethods = (\n  methods: IPluginMethodMap,\n  authorizedMethods?: string[],\n): IPluginMethodMap => {\n  if (!authorizedMethods) {\n    return methods\n  }\n\n  const result: IPluginMethodMap = {}\n  for (const methodName of Object.keys(methods)) {\n    if (authorizedMethods.includes(methodName)) {\n      result[methodName] = methods[methodName]\n    }\n  }\n\n  return result\n}\n/**\n * Provides a common context for all plugin methods.\n *\n * This is the main entry point into the API of Veramo.\n * When plugins are installed, they extend the API of the agent and the methods\n * they provide can all use the common context so that plugins can build on top\n * of each other and create a richer experience.\n *\n * @public\n */\nexport class Agent implements IAgent {\n  /**\n   * The map of plugin + override methods\n   */\n  readonly methods: IPluginMethodMap = {}\n\n  private schema: IAgentPluginSchema\n  private schemaValidation: boolean\n  public readonly context?: Record<string, any>\n  private protectedMethods = ['execute', 'availableMethods', 'emit']\n\n  private readonly eventBus: EventEmitter = new EventEmitter()\n  private readonly eventQueue: (Promise<any> | undefined)[] = []\n\n  /**\n   * Constructs a new instance of the `Agent` class\n   *\n   * @param options - Configuration options\n   * @public\n   */\n  constructor(options?: IAgentOptions) {\n    this.context = options?.context\n\n    this.schema = {\n      components: {\n        schemas: {\n          ...ValidationErrorSchema.components.schemas,\n        },\n        methods: {},\n      },\n    }\n\n    if (options?.plugins) {\n      for (const plugin of options.plugins) {\n        this.methods = {\n          ...this.methods,\n          ...filterUnauthorizedMethods(plugin.methods || {}, options.authorizedMethods),\n        }\n        if (plugin.schema) {\n          this.schema = {\n            components: {\n              schemas: {\n                ...this.schema.components.schemas,\n                ...plugin.schema.components.schemas,\n              },\n              methods: {\n                ...this.schema.components.methods,\n                ...plugin.schema.components.methods,\n              },\n            },\n          }\n        }\n        if (plugin?.eventTypes && plugin?.onEvent) {\n          for (const eventType of plugin.eventTypes) {\n            this.eventBus.on(eventType, (args) => {\n              const promise = plugin?.onEvent?.(\n                { type: eventType, data: args },\n                { ...this.context, agent: this },\n              )\n              this.eventQueue.push(promise)\n              promise?.catch((rejection) => {\n                if (eventType !== CoreEvents.error) {\n                  this.eventBus.emit(CoreEvents.error, rejection)\n                } else {\n                  this.eventQueue.push(\n                    Promise.reject(\n                      new Error('ErrorEventHandlerError: throwing an error in an error handler should crash'),\n                    ),\n                  )\n                }\n              })\n            })\n          }\n        }\n      }\n    }\n\n    if (options?.overrides) {\n      this.methods = {\n        ...this.methods,\n        ...filterUnauthorizedMethods(options.overrides, options.authorizedMethods),\n      }\n    }\n\n    for (const method of Object.keys(this.methods)) {\n      if (!this.protectedMethods.includes(method)) {\n        // @ts-ignore\n        this[method] = async (args: any) => this.execute(method, args)\n      }\n    }\n\n    this.schemaValidation = options?.schemaValidation || false\n  }\n\n  /**\n   * Lists available agent method names\n   *\n   * @returns a list of available methods\n   * @public\n   */\n  availableMethods(): string[] {\n    return Object.keys(this.methods)\n  }\n\n  /**\n   * Returns agent plugin schema\n   *\n   * @returns agent plugin schema\n   * @public\n   */\n  getSchema(): IAgentPluginSchema {\n    return this.schema\n  }\n\n  /**\n   * Executes a plugin method.\n   *\n   * Normally, the `execute()` method need not be called.\n   * The agent will expose the plugin methods directly on the agent instance\n   * but this can be used when dynamically deciding which methods to call.\n   *\n   * @remarks\n   * Plugin method will receive a context object as a second argument.\n   * Context object always has `agent` property that is the `Agent` instance that is executing said method\n   *\n   * @param method - method name\n   * @param args - arguments object\n   * @example\n   * ```typescript\n   * await agent.execute('foo', { bar: 'baz' })\n   *\n   * // is equivalent to:\n   * await agent.foo({ bar: 'baz' })\n   * ```\n   * @public\n   */\n  async execute<P = any, R = any>(method: string, args: P): Promise<R> {\n    Debug('veramo:agent:' + method)('%s %o', 'arg', args)\n    if (!this.methods[method]) throw Error('Method not available: ' + method)\n    const _args = args || {}\n    if (this.schemaValidation && this.schema.components.methods[method]) {\n      validateArguments(method, _args, this.schema)\n    }\n    const result = await this.methods[method](_args, { ...this.context, agent: this })\n    if (this.schemaValidation && this.schema.components.methods[method]) {\n      validateReturnType(method, result, this.schema)\n    }\n    Debug('veramo:agent:' + method)('%s %o', 'res', JSON.stringify(result))\n    return result\n  }\n\n  /**\n   * Broadcasts an `Event` to potential listeners.\n   *\n   * Listeners are `IEventListener` instances that declare `eventTypes`\n   * and implement an `async onEvent({type, data}, context)` method.\n   * Note that `IAgentPlugin` is also an `IEventListener` so plugins can be listeners for events.\n   *\n   * During creation, the agent automatically registers listener plugins\n   * to the `eventTypes` that they declare.\n   *\n   * Events are processed asynchronously, so the general pattern to be used is fire-and-forget.\n   * Ex: `agent.emit('foo', {eventData})`\n   *\n   * In situations where you need to make sure that all events in the queue have been exhausted,\n   * the `Promise` returned by `emit` can be awaited.\n   * Ex: `await agent.emit('foo', {eventData})`\n   *\n   * In case an error is thrown while processing an event, the error is re-emitted as an event\n   * of type `CoreEvents.error` with a `EventListenerError` as payload.\n   *\n   * Note that `await agent.emit()` will NOT throw an error. To process errors, use a listener\n   * with `eventTypes: [ CoreEvents.error ]` in the definition.\n   *\n   * @param eventType - the type of event being emitted\n   * @param data - event payload.\n   *     Use the same `data` type for events of a particular `eventType`.\n   *\n   * @public\n   */\n  async emit(eventType: string, data: any): Promise<void> {\n    this.eventBus.emit(eventType, data)\n    while (this.eventQueue.length > 0) {\n      try {\n        await this.eventQueue.shift()\n      } catch (e: any) {\n        //nop\n        if (typeof e?.message === 'string' && e?.message?.startsWith('ErrorEventHandlerError')) {\n          throw e\n        }\n      }\n    }\n  }\n}\n\n/**\n * Helper function to create a new instance of the {@link Agent} class with correct type\n *\n * @remarks\n * Use {@link @veramo/core-types#TAgent} to configure agent type (list of available methods) for autocomplete in IDE\n *\n * @example\n * ```typescript\n * import { createAgent, IResolver, IMessageHandler } from '@veramo/core'\n * import { AgentRestClient } from '@veramo/remote-client'\n * import { CredentialIssuer, ICredentialIssuer } from '@veramo/credential-w3c'\n * const agent = createAgent<IResolver & IMessageHandler & ICredentialIssuer>({\n *   plugins: [\n *     new CredentialIssuer(),\n *     new AgentRestClient({\n *       url: 'http://localhost:3002/agent',\n *       enabledMethods: [\n *         'resolveDid',\n *         'handleMessage',\n *       ],\n *     }),\n *   ],\n * })\n * ```\n * @param options - Agent configuration options\n * @returns configured agent\n * @public\n */\nexport function createAgent<T extends IPluginMethodMap, C = Record<string, any>>(\n  options: IAgentOptions & { context?: C },\n): TAgent<T> & { context?: C } {\n  // @ts-ignore\n  return new Agent(options) as TAgent<T>\n}\n"
  },
  {
    "path": "packages/core/src/index.ts",
    "content": "/**\n * Provides {@link @veramo/core#Agent} implementation\n *\n * @packageDocumentation\n */\nexport { Agent, createAgent } from './agent.js'\nexport { ValidationError } from './validator.js'\n\n// re-export types for convenience\nexport * from '@veramo/core-types'\n"
  },
  {
    "path": "packages/core/src/schemas/ValidationError.ts",
    "content": "export default {\n  components: {\n    schemas: {\n      ValidationError: {\n        type: 'object',\n        properties: {\n          name: {\n            type: 'string',\n            description: 'Error name',\n          },\n          method: {\n            type: 'string',\n            description: 'Method',\n          },\n          message: {\n            type: 'string',\n            description: 'Error message',\n          },\n          path: {\n            type: 'string',\n            description: 'Error path',\n          },\n          code: {\n            type: 'string',\n            description: 'Error code',\n          },\n          description: {\n            type: 'string',\n            description: 'Error description',\n          },\n        },\n        required: ['didUrl'],\n        description: 'Agent method arguments validation error',\n      },\n    },\n  },\n}\n"
  },
  {
    "path": "packages/core/src/validator.ts",
    "content": "import ZSchema from 'z-schema'\n\nconst validator = new ZSchema({})\n// @ts-ignore\nvalidator.setRemoteReference('http://json-schema.org/draft-07/schema#', {\n  type: ['array', 'boolean', 'integer', 'number', 'object', 'string'],\n})\n\n/**\n * Represents a Schema validation error.\n *\n * This can occur when a method of the agent is invoked with certain parameters or the returned value doesn't match the\n * declared plugin schema.\n *\n * @public\n */\nexport class ValidationError extends Error {\n  public method: string\n  public code: string\n  public message: string\n  public path: string\n  public description: string\n\n  constructor(message: string, method: string, code: string, path: string, description: string) {\n    super(message)\n    this.name = 'ValidationError'\n    this.message = message + '; ' + method + '; ' + path + '; ' + code + '; ' + description\n    this.method = method\n    this.description = description\n    this.path = path\n    this.code = code\n    Object.setPrototypeOf(this, ValidationError.prototype)\n  }\n}\n\nexport class PluginReturnTypeError extends Error {\n  public method: string\n  public code: string\n  public message: string\n  public path: string\n  public description: string\n\n  constructor(message: string, method: string, code: string, path: string, description: string) {\n    super(message)\n    this.name = 'PluginReturnTypeError'\n    this.message = message + '; ' + method + '; ' + path + '; ' + code + '; ' + description\n    this.method = method\n    this.description = description\n    this.path = path\n    this.code = code\n    Object.setPrototypeOf(this, PluginReturnTypeError.prototype)\n  }\n}\n\nexport const validateArguments = (method: string, args: any, schema: object) => {\n  const valid = validator.validate(args, schema, {\n    // @ts-ignore\n    schemaPath: 'components.methods.' + method + '.arguments',\n  })\n  if (!valid) {\n    const errors = validator.getLastErrors()\n    throw new ValidationError(\n      errors[0].message,\n      method,\n      errors[0].code,\n      errors[0].path,\n      errors[0].description,\n    )\n  }\n}\n\nexport const validateReturnType = (method: string, args: any, schema: object) => {\n  const valid = validator.validate(args, schema, {\n    // @ts-ignore\n    schemaPath: 'components.methods.' + method + '.returnType',\n  })\n  if (!valid) {\n    const errors = validator.getLastErrors()\n    throw new PluginReturnTypeError(\n      errors[0].message,\n      method,\n      errors[0].code,\n      errors[0].path,\n      errors[0].description,\n    )\n  }\n}\n"
  },
  {
    "path": "packages/core/tsconfig.json",
    "content": "{\n  \"extends\": \"../tsconfig.settings.json\",\n  \"compilerOptions\": {\n    \"rootDir\": \"src\",\n    \"outDir\": \"build\"\n  },\n  \"include\": [\"./**/*.ts\"],\n  \"references\": [\n    {\n      \"path\": \"../core-types\"\n    }\n  ]\n}\n"
  },
  {
    "path": "packages/core-types/CHANGELOG.md",
    "content": "# Change Log\n\nAll notable changes to this project will be documented in this file.\nSee [Conventional Commits](https://conventionalcommits.org) for commit guidelines.\n\n# [7.0.0](https://github.com/decentralized-identity/veramo/compare/v6.0.2...v7.0.0) (2026-02-11)\n\n\n### Bug Fixes\n\n* **core-types:** regenerate plugin schema ([#1416](https://github.com/decentralized-identity/veramo/issues/1416)) ([01de67d](https://github.com/decentralized-identity/veramo/commit/01de67df220a67fa79584f84ffe58f229a6395b7))\n* **core-types:** regenerate schema ([#1396](https://github.com/decentralized-identity/veramo/issues/1396)) ([925fd81](https://github.com/decentralized-identity/veramo/commit/925fd8116b134da0552585ed3b3de556b10ce9ca))\n* **data-store:** validate sorted queries in data store ([#1482](https://github.com/decentralized-identity/veramo/issues/1482)) ([067e39d](https://github.com/decentralized-identity/veramo/commit/067e39dd76f11ee2d25b99c8361d4f02a4223e3b))\n* **deps:** update devdeps and bump typeorm to 0.3.20 ([#1272](https://github.com/decentralized-identity/veramo/issues/1272)) ([7d17f37](https://github.com/decentralized-identity/veramo/commit/7d17f37ea7cc4e73a8cdae028681ae1be5c4d11c))\n\n\n### Features\n\n* **core-types:** allow key type and algorithm extension with loose autocomplete ([#1464](https://github.com/decentralized-identity/veramo/issues/1464)) ([43d8dbf](https://github.com/decentralized-identity/veramo/commit/43d8dbf4d2fb146acf9c4d2b5578e9b8e74b4045))\n* **credential-w3c:** added support bbs proofformat ([#1383](https://github.com/decentralized-identity/veramo/issues/1383)) ([83cc115](https://github.com/decentralized-identity/veramo/commit/83cc1156cb37cafd8489aa24cff690dca741d3d7))\n* **credential-w3c:** refactor the ICredentialProvider API ([#1488](https://github.com/decentralized-identity/veramo/issues/1488)) ([cbd848d](https://github.com/decentralized-identity/veramo/commit/cbd848d4ce2b52497d99d335f1c93bd8b005cdb2))\n* **credential-w3c:** remove hardcoded proof formats ([#1395](https://github.com/decentralized-identity/veramo/issues/1395)) ([5b7d3fa](https://github.com/decentralized-identity/veramo/commit/5b7d3fad7d2ada4954f8020a6474df13d9fe51dc))\n* **did-manager:** add 'isLocal' in 'options' to only modify DIDStore ([#1452](https://github.com/decentralized-identity/veramo/issues/1452)) ([94da414](https://github.com/decentralized-identity/veramo/commit/94da414f0b1a9fe7b837faf01749191176826af1))\n* **key-manager:** allow user defined kid on keyManagerCreate ([#1426](https://github.com/decentralized-identity/veramo/issues/1426)) ([0784df0](https://github.com/decentralized-identity/veramo/commit/0784df09a38a10cd66a83485e047770b427d8648)), closes [#1353](https://github.com/decentralized-identity/veramo/issues/1353)\n\n\n### BREAKING CHANGES\n\n* **credential-w3c:** This changeset, along with the previous changes in #1395 modify the CredentialPlugin to support extensibility without modifications to the veramo repository. This plugin now acts as an orchestrator for other ICredentialProvider implementations that provide the actual support for various verifiable data formats. ICredentialProvider implementations can be implemented externally and used with this plugin.\n* **credential-w3c:** The credential plugins specializing in JSON-LD / EIP712 are no longer top level veramo plugins but are now managed by the `@veramo/credential-w3c` plugin which will be able to use multiple proof formats and multiplex accordingly. The constructor for the `CredentialPlugin` has changed to accept different implementations of proof formats.\n\n\n\n\n\n## [6.0.2](https://github.com/decentralized-identity/veramo/compare/v6.0.1...v6.0.2) (2026-01-16)\n\n\n### Bug Fixes\n\n* **data-store:** validate sorted queries in data store ([#1482](https://github.com/decentralized-identity/veramo/issues/1482)) ([0807612](https://github.com/decentralized-identity/veramo/commit/080761254fba065c30989793dc14aec68eb5e677))\n\n\n\n\n\n## [6.0.1](https://github.com/decentralized-identity/veramo/compare/v6.0.0...v6.0.1) (2026-01-16)\n\n**Note:** Version bump only for package @veramo/core-types\n\n\n\n\n\n# [6.0.0](https://github.com/decentralized-identity/veramo/compare/v5.6.0...v6.0.0) (2024-04-02)\n\n\n### Bug Fixes\n\n* **credential-w3c:** forward DID resolution options to the resolver ([#1344](https://github.com/decentralized-identity/veramo/issues/1344)) ([0c22cc6](https://github.com/decentralized-identity/veramo/commit/0c22cc6a79e974214500e4440b0ea2977012377d)), closes [#1343](https://github.com/decentralized-identity/veramo/issues/1343)\n* **deps:** Update did-vc-libraries ([ba966d5](https://github.com/decentralized-identity/veramo/commit/ba966d5fe450145f51e9c9b46f8aa53f74b117d2))\n* export const plugin schemas instead of defaults ([#1327](https://github.com/decentralized-identity/veramo/issues/1327)) ([7896cea](https://github.com/decentralized-identity/veramo/commit/7896ceaf2c79993eee44e46950814bea74bfe647)), closes [#1318](https://github.com/decentralized-identity/veramo/issues/1318) [#1317](https://github.com/decentralized-identity/veramo/issues/1317) [#1315](https://github.com/decentralized-identity/veramo/issues/1315)\n\n\n### Code Refactoring\n\n* generate plugin schemas as TS instead of JSON ([#1315](https://github.com/decentralized-identity/veramo/issues/1315)) ([65c2d4b](https://github.com/decentralized-identity/veramo/commit/65c2d4bc814daa9a3a89f4f7b8e8c6973b8ce2f0)), closes [#1254](https://github.com/decentralized-identity/veramo/issues/1254)\n\n\n### Features\n\n* add Multikey support ([#1316](https://github.com/decentralized-identity/veramo/issues/1316)) ([165de35](https://github.com/decentralized-identity/veramo/commit/165de3549ccfd3d7c84514608ac3ea9e56a7b807))\n\n\n### BREAKING CHANGES\n\n* The `plugin.schema.json` files are now generated as `plugin.schema.ts`.\n\n\n\n\n\n# [5.6.0](https://github.com/decentralized-identity/veramo/compare/v5.5.3...v5.6.0) (2024-01-16)\n\n\n### Features\n\n* **remote-client:** allow dynamic headers param for AgentRestClient constructor ([#1314](https://github.com/decentralized-identity/veramo/issues/1314)) ([1b8a0a2](https://github.com/decentralized-identity/veramo/commit/1b8a0a2718dd63492ad3a312a6ebe5f6e7849935)), closes [#1313](https://github.com/decentralized-identity/veramo/issues/1313)\n\n\n\n\n\n## [5.5.3](https://github.com/decentralized-identity/veramo/compare/v5.5.2...v5.5.3) (2023-10-09)\n\n\n### Bug Fixes\n\n* use DIF URLs in packages ([#1271](https://github.com/decentralized-identity/veramo/issues/1271)) ([3dfc601](https://github.com/decentralized-identity/veramo/commit/3dfc6014cdee7902c59d8db76b4c8507b870f227))\n\n\n\n\n\n# [5.5.0](https://github.com/uport-project/veramo/compare/v5.4.1...v5.5.0) (2023-09-19)\n\n\n### Bug Fixes\n\n* **did-provider-key:** use compressed keys for creating Secp256k1 did:key ([#1217](https://github.com/uport-project/veramo/issues/1217)) ([ba8f6f5](https://github.com/uport-project/veramo/commit/ba8f6f5b9b701e57af86491504ecd209ca0c1c1d)), closes [#1213](https://github.com/uport-project/veramo/issues/1213)\n\n\n### Features\n\n* **core-types:** export a basic mapping between key types and algorithms ([57b6c58](https://github.com/uport-project/veramo/commit/57b6c583138b0f8f283f4f00b27573529f394a7a))\n\n\n\n\n\n## [5.4.1](https://github.com/uport-project/veramo/compare/v5.4.0...v5.4.1) (2023-08-04)\n\n\n### Bug Fixes\n\n* **ci:** benign change meant to tag all packages for another patch release ([#1211](https://github.com/uport-project/veramo/issues/1211)) ([41b5c90](https://github.com/uport-project/veramo/commit/41b5c90277171b7b38c5cf49ca01db5cf75b6300))\n\n\n\n\n\n# [5.4.0](https://github.com/uport-project/veramo/compare/v5.3.0...v5.4.0) (2023-08-01)\n\n\n### Features\n\n* **did-comm:** add support for the AES based content and key encryption algorithms ([#1180](https://github.com/uport-project/veramo/issues/1180)) ([5294a81](https://github.com/uport-project/veramo/commit/5294a812ee578c0712b54f216416c3ef78c848da))\n\n\n\n\n\n# [5.3.0](https://github.com/uport-project/veramo/compare/v5.2.0...v5.3.0) (2023-07-27)\n\n**Note:** Version bump only for package @veramo/core-types\n\n\n\n\n\n## [5.1.2](https://github.com/uport-project/veramo/compare/v5.1.1...v5.1.2) (2023-02-25)\n\n\n### Bug Fixes\n\n* **ci:** minor changes to trigger release alignment ([9db312f](https://github.com/uport-project/veramo/commit/9db312f8f049ec13ef394dc77fe6e2759143790d))\n\n\n\n\n\n# [5.1.0](https://github.com/uport-project/veramo/compare/v5.0.0...v5.1.0) (2023-02-24)\n\n\n### Features\n\n* **core-types:** allow inline [@context](https://github.com/context) for Credentials and Presentations ([#1119](https://github.com/uport-project/veramo/issues/1119)) ([44bb365](https://github.com/uport-project/veramo/commit/44bb36503b635ee1f5431cb4bf28c7a9ba111156)), closes [#1073](https://github.com/uport-project/veramo/issues/1073)\n\n\n\n\n\n# [5.0.0](https://github.com/uport-project/veramo/compare/v4.3.0...v5.0.0) (2023-02-09)\n\n\n### Features\n\n* isolate `core-types` package from `core` ([#1116](https://github.com/uport-project/veramo/issues/1116)) ([ba7a303](https://github.com/uport-project/veramo/commit/ba7a303de91cf4cc568a3af1ddf8ca98ed022e9f))\n\n\n\n\n\n# [4.3.0](https://github.com/uport-project/veramo/compare/v4.2.0...v4.3.0) (2023-01-27)\n\n\n### Features\n\n* **did-comm:** support DIDComm Messaging attachments ([#1087](https://github.com/uport-project/veramo/issues/1087)) ([6679574](https://github.com/uport-project/veramo/commit/66795742a01d5390ad083610efd28a8fe59fb3a3)), closes [#612](https://github.com/uport-project/veramo/issues/612)\n\n\n\n\n\n# [4.2.0](https://github.com/uport-project/veramo/compare/v4.1.2...v4.2.0) (2022-12-05)\n\n\n### Bug Fixes\n\n* **cli:** fix bug in schema generator ([d4c63c1](https://github.com/uport-project/veramo/commit/d4c63c1d1c3acb2a2f576450384250163ae7e0a0))\n* **deps:** bump dependencies ([701b8ed](https://github.com/uport-project/veramo/commit/701b8edf981ea11c7ddb6a81d2817dbbdbb022f3))\n\n\n\n\n\n## [4.1.1](https://github.com/uport-project/veramo/compare/v4.1.0...v4.1.1) (2022-11-01)\n\n**Note:** Version bump only for package @veramo/core\n\n\n\n\n\n# [4.1.0](https://github.com/uport-project/veramo/compare/v4.0.2...v4.1.0) (2022-10-31)\n\n\n### Bug Fixes\n\n* **deps:** Update dependency ethr-did-resolver to v7 ([#1038](https://github.com/uport-project/veramo/issues/1038)) ([d421c0f](https://github.com/uport-project/veramo/commit/d421c0f9f5934829df2930e58e98bcfce813ce84))\n* **deps:** Update did-vc-libraries ([6fa13ab](https://github.com/uport-project/veramo/commit/6fa13ab7fbab979db2d41e84e445a52cf9319003))\n* remove deprecated testnets ([#1028](https://github.com/uport-project/veramo/issues/1028)) ([2823738](https://github.com/uport-project/veramo/commit/28237383d0cc2eb20bcf8e10562221ea2ab32f94)), closes [#1025](https://github.com/uport-project/veramo/issues/1025)\n\n\n### Features\n\n* add support for NIST Secp256r1 keys and ES256 signatures ([#1039](https://github.com/uport-project/veramo/issues/1039)) ([61eb369](https://github.com/uport-project/veramo/commit/61eb369cfcde7372babf3f68fb65ea2055b5bf70))\n\n\n\n\n\n# [4.0.0](https://github.com/uport-project/veramo/compare/v3.1.5...v4.0.0) (2022-09-22)\n\n\n### Bug Fixes\n\n* **core:** plugin schema ([e5a48ad](https://github.com/uport-project/veramo/commit/e5a48ad85590b21c6256604e2769f19039fe1603))\n* deprecate the `save` parameter ([#975](https://github.com/uport-project/veramo/issues/975)) ([598c0e1](https://github.com/uport-project/veramo/commit/598c0e1e3f37d1b30c865fa01b93b7657f43d795)), closes [#966](https://github.com/uport-project/veramo/issues/966)\n* **deps:** Bump `did-jwt`, `did-jwt-vc` as direct package deps ([#955](https://github.com/uport-project/veramo/issues/955)) ([e57edb3](https://github.com/uport-project/veramo/commit/e57edb34cfbaee6bba1d944497d688104f32c698))\n* **deps:** update dependency did-jwt-vc to v2.1.8 ([d4520be](https://github.com/uport-project/veramo/commit/d4520be7f8ca140a5c8eafd7effb38812d51f2b4))\n* **deps:** Update dependency did-jwt-vc to v3 ([014c1ab](https://github.com/uport-project/veramo/commit/014c1ab974647d44d7ef1de0f931625348c4c98b))\n* **deps:** use did-jwt v6 and ethr-did-resolver v6 ([#925](https://github.com/uport-project/veramo/issues/925)) ([0c77d03](https://github.com/uport-project/veramo/commit/0c77d03ec5ec9e2091de3f74f67ab86a22cde197)), closes [#923](https://github.com/uport-project/veramo/issues/923) [#848](https://github.com/uport-project/veramo/issues/848)\n* **did-resolver:** use interface `Resolvable` instead of the `Resolver` class ([9c2e59f](https://github.com/uport-project/veramo/commit/9c2e59f3f23f808511c6c0e8e440b4d53ba5cb00))\n* **docs:** fix relevant errors and warnings in TSDoc to enable proper docs generation on `[@next](https://github.com/next)` branch ([79c3872](https://github.com/uport-project/veramo/commit/79c387230219c92c1951d19b8ddf716308a46c5b))\n* update and fix inline documentation of all exported types ([#921](https://github.com/uport-project/veramo/issues/921)) ([63e64e0](https://github.com/uport-project/veramo/commit/63e64e0e2693808c4704dca8cc511dc0bab3f3b1))\n\n\n### Features\n\n* add key type definitions: 'Bls12381G1Key2020' and 'Bls12381G2Key2020' ([#839](https://github.com/uport-project/veramo/issues/839)) ([0f0f517](https://github.com/uport-project/veramo/commit/0f0f517d97230fd5334d604d4f20d575a14f8670))\n* add support for serviceEndpoint property as defined in latest DID Spec ([#988](https://github.com/uport-project/veramo/issues/988)) ([9bed70b](https://github.com/uport-project/veramo/commit/9bed70ba658aed34a97944e0dee27bca6c81d700))\n* **credential-status:** expect revoked boolean property from StatusMethods ([e00daa4](https://github.com/uport-project/veramo/commit/e00daa47865ea42d7bd8667f37c6e12fc21fd4b9))\n* **credential-status:** rename plugin interfaces and methods ([a5adaba](https://github.com/uport-project/veramo/commit/a5adaba21a97f525bf69d156df991afc234896ab)), closes [#981](https://github.com/uport-project/veramo/issues/981)\n* **credential-w3c:** add ICredentialPlugin interface in core package ([#1001](https://github.com/uport-project/veramo/issues/1001)) ([7b6d195](https://github.com/uport-project/veramo/commit/7b6d1950364c8b741dd958d29e506b95fa5b1cec)), closes [#941](https://github.com/uport-project/veramo/issues/941)\n* **credential-w3c:** add override policies to verifyPresentation ([#990](https://github.com/uport-project/veramo/issues/990)) ([06b3147](https://github.com/uport-project/veramo/commit/06b314717cbe35f696e706b1ebf5e54438115493)), closes [#375](https://github.com/uport-project/veramo/issues/375) [#954](https://github.com/uport-project/veramo/issues/954)\n* **credential-w3c:** align verification API between formats ([#996](https://github.com/uport-project/veramo/issues/996)) ([b987fc0](https://github.com/uport-project/veramo/commit/b987fc0903a31d3bbffb43fef872be4d6c62c2ad)), closes [#935](https://github.com/uport-project/veramo/issues/935) [#954](https://github.com/uport-project/veramo/issues/954) [#375](https://github.com/uport-project/veramo/issues/375) [#989](https://github.com/uport-project/veramo/issues/989)\n* **date-store-json:** add JSON object storage implementation ([#819](https://github.com/uport-project/veramo/issues/819)) ([934b34a](https://github.com/uport-project/veramo/commit/934b34a18b194928f90e7797289cc6f2243789ec))\n* define an interface for credential status manager ([#956](https://github.com/uport-project/veramo/issues/956)) ([6fbd22f](https://github.com/uport-project/veramo/commit/6fbd22fa6ba7bb1d4092afbded0f95c0d841bd97)), closes [#937](https://github.com/uport-project/veramo/issues/937) [#981](https://github.com/uport-project/veramo/issues/981)\n* **did-manager:** add`didManagerUpdate` method for full DID document updates ([#974](https://github.com/uport-project/veramo/issues/974)) ([5682b25](https://github.com/uport-project/veramo/commit/5682b2566b7c4f8f9bfda10e8d06a8d2624c2a1b)), closes [#971](https://github.com/uport-project/veramo/issues/971) [#960](https://github.com/uport-project/veramo/issues/960) [#948](https://github.com/uport-project/veramo/issues/948)\n\n\n### BREAKING CHANGES\n\n* the `did-resolver` and connected libraries change the data-type for `ServiceEndpoint` to `Service` and the previous semantic has changed. Services can have multiple endpoints, not just a single string.\n\n\n\n\n\n## [3.1.3](https://github.com/uport-project/veramo/compare/v3.1.2...v3.1.3) (2022-06-01)\n\n**Note:** Version bump only for package @veramo/core\n\n\n\n\n\n# [3.1.0](https://github.com/uport-project/veramo/compare/v3.0.0...v3.1.0) (2021-11-12)\n\n\n### Bug Fixes\n\n* **data-store:** add support for entityPrefix ([#725](https://github.com/uport-project/veramo/issues/725)) ([801bb95](https://github.com/uport-project/veramo/commit/801bb95ddd22abaa61c938b025834132d4e8d3be)), closes [#724](https://github.com/uport-project/veramo/issues/724)\n\n\n### Features\n\n* **did-comm:** didcomm messaging using did:ethr ([#744](https://github.com/uport-project/veramo/issues/744)) ([1be5e04](https://github.com/uport-project/veramo/commit/1be5e04e09112c0823d776fe2d55117d71a7b448)), closes [#743](https://github.com/uport-project/veramo/issues/743)\n\n\n\n\n\n# [3.0.0](https://github.com/uport-project/veramo/compare/v2.1.3...v3.0.0) (2021-09-20)\n\n\n### Bug Fixes\n\n* **deps:** update all non-major dependencies ([8fc5312](https://github.com/uport-project/veramo/commit/8fc53120498ce2982e8ec640e00bbb03f6f4204e))\n\n\n### Features\n\n* **data-store:** initialize DB using migrations ([#679](https://github.com/uport-project/veramo/issues/679)) ([41f6240](https://github.com/uport-project/veramo/commit/41f6240d68a79338772230cbfff768189ab031ed)), closes [#676](https://github.com/uport-project/veramo/issues/676)\n* **key-manager:** move private key storage to kms-local ([#661](https://github.com/uport-project/veramo/issues/661)) ([6b1d135](https://github.com/uport-project/veramo/commit/6b1d135eedb1c58b715be8941d34312da39facb2)), closes [#539](https://github.com/uport-project/veramo/issues/539) [#540](https://github.com/uport-project/veramo/issues/540) [#680](https://github.com/uport-project/veramo/issues/680)\n\n\n### BREAKING CHANGES\n\n* **key-manager:** `keyManagetGet` no longer returns private key data\n* **key-manager:** `KeyStore` no longer requires a `SecretBox`\n* **key-manager:** `KeyManagementSystem` needs a `PrivateKeyStore`\n* **key-manager:** @veramo/cli configuration version update to 3.0\n\nIf you're already working with Veramo and wish to upgrade existing agents to veramo 3.0, you'll have to make some changes to your configuration, depending on how you're using the framework.\n\nIt boils down to these 3 steps:\n\n1. Update your database connection to use migrations\n2. Remove the `SecretBox` parameter from `KeyManager`\n3. Add a `PrivateKeyStore` parameter to `KeyManagementSystem` with a `SecretBox` that you were using before with `KeyManager` (and keep the same encryption key)\n\n* feat(key-manager): move private key storage to kms-local\n* **data-store:** database needs migrations for initialization. See #679 #676\nThe `@veramo/data-store` package relies on `typeorm` as a database abstraction.\nTypeorm has a connection flag `synchonize` which bootstraps the database along with schema and relations based on a set of `Entities` (annotated typescript classes).\nThis is very handy for fast development iterations but it is **not recommended for production** use because there is too much ambiguity possible when the `Entities` change, and there is a risk of data loss.\nThe recommended way to do things is to use the `migrations` mechanism. It allows you to migrate to new database schemas when necessary, and even customize the database to your own needs.\n\n**Going forward, this is the mechanism we will be recommending for connections.**\n\n\n\n\n\n# [2.1.0](https://github.com/uport-project/veramo/compare/v2.0.1...v2.1.0) (2021-08-11)\n\n\n### Bug Fixes\n\n* **credentials-w3c:** accept Presentations without Credentials ([#616](https://github.com/uport-project/veramo/issues/616)) ([2389cd0](https://github.com/uport-project/veramo/commit/2389cd0df080e968ee320d66fabf2e8a7b51ba47))\n\n\n### Features\n\n* **data-store:** delete verifiable credential ([#634](https://github.com/uport-project/veramo/issues/634)) ([c7b0131](https://github.com/uport-project/veramo/commit/c7b0131c94e21c5c6800990c5743418b6b135a30)), closes [#635](https://github.com/uport-project/veramo/issues/635)\n\n\n\n\n\n# [2.0.0](https://github.com/uport-project/veramo/compare/v1.2.2...v2.0.0) (2021-07-14)\n\n\n### Bug Fixes\n\n* **deps:** bump did-jwt to 5.4.0 ([#528](https://github.com/uport-project/veramo/issues/528)) ([65f22cf](https://github.com/uport-project/veramo/commit/65f22cf6dcca48b5bb35331894536a2a567a1189))\n* **kms-local:** replace buggy didcomm clone with did jwt implementation ([#548](https://github.com/uport-project/veramo/issues/548)) ([9dea353](https://github.com/uport-project/veramo/commit/9dea3533c1936d53c1d5674c358679b17d623af2)), closes [#538](https://github.com/uport-project/veramo/issues/538)\n\n\n### Features\n\n* **cli:** export new agent methods and request LD DIDDocument by default ([#617](https://github.com/uport-project/veramo/issues/617)) ([26d088b](https://github.com/uport-project/veramo/commit/26d088b86ecfd66a00cdef7c7bb926148f46fbc9))\n* implement didcomm v2 packing/unpacking ([#575](https://github.com/uport-project/veramo/issues/575)) ([249b07e](https://github.com/uport-project/veramo/commit/249b07eca8d2de9eb5252d71683d5f1fba319d60)), closes [#559](https://github.com/uport-project/veramo/issues/559) [#558](https://github.com/uport-project/veramo/issues/558)\n* **key-manager:** add generic signing capabilities ([#529](https://github.com/uport-project/veramo/issues/529)) ([5f10a1b](https://github.com/uport-project/veramo/commit/5f10a1bcea214cb593de12fa6ec3a91b3cb712bb)), closes [#522](https://github.com/uport-project/veramo/issues/522)\n* **key-manager:** add method to compute a shared secret ([#555](https://github.com/uport-project/veramo/issues/555)) ([393c316](https://github.com/uport-project/veramo/commit/393c316e27fb31b3c7fa63aae039b8fc6ae963ce)), closes [#541](https://github.com/uport-project/veramo/issues/541)\n* **key-manager:** implement JWE functionality directly in `key-manager` ([#557](https://github.com/uport-project/veramo/issues/557)) ([a030f0a](https://github.com/uport-project/veramo/commit/a030f0a9779e5158d9369d2f81107158fbaeac70)), closes [#556](https://github.com/uport-project/veramo/issues/556)\n\n\n### BREAKING CHANGES\n\n* **kms-local:** `@veramo/kms-local-react-native` is no more. On react-native, please use `@veramo/kms-local` instead, combined with `@ethersproject/shims`\n\n\n\n\n\n# [1.2.0](https://github.com/uport-project/veramo/compare/v1.1.2...v1.2.0) (2021-04-27)\n\n\n### Bug Fixes\n\n* **deps:** update all non-major dependencies ([#462](https://github.com/uport-project/veramo/issues/462)) ([4a2b206](https://github.com/uport-project/veramo/commit/4a2b20633810b45a155bf2149cbff57d157bda3c))\n\n\n### Features\n\n* adapt to did core spec ([#430](https://github.com/uport-project/veramo/issues/430)) ([9712db0](https://github.com/uport-project/veramo/commit/9712db0eea1a3f48cf0665d66ae715ea0c23cd4a)), closes [#418](https://github.com/uport-project/veramo/issues/418) [#428](https://github.com/uport-project/veramo/issues/428) [#417](https://github.com/uport-project/veramo/issues/417) [#416](https://github.com/uport-project/veramo/issues/416) [#412](https://github.com/uport-project/veramo/issues/412) [#397](https://github.com/uport-project/veramo/issues/397) [#384](https://github.com/uport-project/veramo/issues/384) [#394](https://github.com/uport-project/veramo/issues/394)\n* **core:** add ability to define the agent context type ([#350](https://github.com/uport-project/veramo/issues/350)) ([89255b9](https://github.com/uport-project/veramo/commit/89255b9a648c38656aea05131750e68497d04c27))\n* **did-provider-key:** add did:key provider; fixes [#335](https://github.com/uport-project/veramo/issues/335) ([#351](https://github.com/uport-project/veramo/issues/351)) ([42cd2b0](https://github.com/uport-project/veramo/commit/42cd2b08a2fd21b5b5d7bdfa57dd00ccc7184dc7)), closes [decentralized-identity/did-jwt#78](https://github.com/decentralized-identity/did-jwt/issues/78)\n\n\n\n\n\n# [1.1.0](https://github.com/uport-project/veramo/compare/v1.0.1...v1.1.0) (2021-01-26)\n\n\n### Bug Fixes\n\n* **deps:** update dependency z-schema to v5 ([#323](https://github.com/uport-project/veramo/issues/323)) ([9cadf37](https://github.com/uport-project/veramo/commit/9cadf378dba487b1a664a6277eafffd629c65600))\n\n\n### Features\n\n* **core:** make agent context public readonly ([#347](https://github.com/uport-project/veramo/issues/347)) ([802948e](https://github.com/uport-project/veramo/commit/802948ea72edf8b00c42115f73430720debabed9))\n\n\n\n\n\n## 1.0.1 (2020-12-18)\n\n**Note:** Version bump only for package @veramo/core\n"
  },
  {
    "path": "packages/core-types/LICENSE",
    "content": "                                 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 2019 Consensys AG\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"
  },
  {
    "path": "packages/core-types/README.md",
    "content": "# Veramo Core-types\n\nDefinitions for Veramo common data types\n"
  },
  {
    "path": "packages/core-types/api-extractor.json",
    "content": "{\n  \"$schema\": \"https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json\",\n  \"apiReport\": {\n    \"enabled\": true,\n    \"reportFolder\": \"./api\",\n    \"reportTempFolder\": \"./api\"\n  },\n\n  \"docModel\": {\n    \"enabled\": true,\n    \"apiJsonFilePath\": \"./api/<unscopedPackageName>.api.json\"\n  },\n\n  \"dtsRollup\": {\n    \"enabled\": false\n  },\n  \"mainEntryPointFilePath\": \"<projectFolder>/build/index.d.ts\"\n}\n"
  },
  {
    "path": "packages/core-types/package.json",
    "content": "{\n  \"name\": \"@veramo/core-types\",\n  \"description\": \"Veramo Core Logic & Interfaces.\",\n  \"version\": \"7.0.0\",\n  \"main\": \"build/index.js\",\n  \"exports\": {\n    \".\": {\n      \"types\": \"./build/index.d.ts\",\n      \"require\": \"./build/index.js\",\n      \"import\": \"./build/index.js\"\n    }\n  },\n  \"types\": \"build/index.d.ts\",\n  \"scripts\": {\n    \"build\": \"tsc\",\n    \"generate-plugin-schema\": \"node ../cli/bin/veramo.js dev generate-plugin-schema\"\n  },\n  \"veramo\": {\n    \"pluginInterfaces\": {\n      \"IResolver\": \"./src/types/IResolver.ts\",\n      \"IKeyManager\": \"./src/types/IKeyManager.ts\",\n      \"IDIDManager\": \"./src/types/IDIDManager.ts\",\n      \"IDataStore\": \"./src/types/IDataStore.ts\",\n      \"IDataStoreORM\": \"./src/types/IDataStoreORM.ts\",\n      \"IMessageHandler\": \"./src/types/IMessageHandler.ts\",\n      \"ICredentialIssuer\": \"./src/types/ICredentialIssuer.ts\",\n      \"ICredentialVerifier\": \"./src/types/ICredentialVerifier.ts\",\n      \"ICredentialPlugin\": \"./src/types/ICredentialPlugin.ts\",\n      \"ICredentialStatus\": \"./src/types/ICredentialStatus.ts\",\n      \"ICredentialStatusVerifier\": \"./src/types/ICredentialStatusVerifier.ts\",\n      \"ICredentialStatusManager\": \"./src/types/ICredentialStatusManager.ts\"\n    }\n  },\n  \"dependencies\": {\n    \"credential-status\": \"^3.0.0\",\n    \"debug\": \"^4.3.3\",\n    \"did-jwt-vc\": \"^4.0.0\",\n    \"did-resolver\": \"^4.1.0\"\n  },\n  \"devDependencies\": {\n    \"@types/debug\": \"4.1.8\",\n    \"typescript\": \"5.7.3\"\n  },\n  \"files\": [\n    \"build/**/*\",\n    \"src/**/*\",\n    \"README.md\",\n    \"LICENSE\"\n  ],\n  \"publishConfig\": {\n    \"access\": \"public\"\n  },\n  \"repository\": {\n    \"type\": \"git\",\n    \"url\": \"https://github.com/decentralized-identity/veramo.git\",\n    \"directory\": \"packages/core-types\"\n  },\n  \"author\": \"Consensys Mesh R&D <hello@veramo.io>\",\n  \"contributors\": [\n    \"Simonas Karuzas <simonas.karuzas@mesh.xyz>\",\n    \"Mircea Nistor <mircea.nistor@mesh.xyz>\"\n  ],\n  \"keywords\": [\n    \"Veramo\",\n    \"DID\",\n    \"Verifiable Credential\"\n  ],\n  \"license\": \"Apache-2.0\",\n  \"type\": \"module\",\n  \"moduleDirectories\": [\n    \"node_modules\",\n    \"src\"\n  ]\n}\n"
  },
  {
    "path": "packages/core-types/src/agent.ts",
    "content": "import { IAgentPlugin, IPluginMethodMap } from \"./types/IAgent.js\"\n\n/**\n * Agent configuration options.\n *\n * This interface is used to describe the constellation of plugins that this agent\n * will use and provide.\n *\n * You will use this to attach plugins, to setup overrides for their methods and to\n * explicitly set the methods that this agent instance is allowed to call.\n * This permissioning method is also used for internal calls made by plugin code.\n *\n * @public\n */\nexport interface IAgentOptions {\n    /**\n     * The array of agent plugins\n     */\n    plugins?: IAgentPlugin[]\n  \n    /**\n     * The map of plugin methods. Can be used to override methods provided by plugins,\n     * or to add additional methods without writing a plugin\n     */\n    overrides?: IPluginMethodMap\n  \n    /**\n     * The array of method names that will be exposed by the agent\n     */\n    authorizedMethods?: string[]\n  \n    /**\n     * The context object that will be available to the plugin methods\n     *\n     * @example\n     * ```typescript\n     * {\n     *   authorizedDid: 'did:example:123'\n     * }\n     * ```\n     */\n    context?: Record<string, any>\n  \n    /**\n     * Flag that enables schema validation for plugin methods.\n     *\n     * Defaults to `false`.\n     */\n    schemaValidation?: boolean\n  }\n  "
  },
  {
    "path": "packages/core-types/src/coreEvents.ts",
    "content": "/**\n * This collection defines the core event types.\n *\n * @public\n */\nexport const CoreEvents = {\n  /**\n   * This event type is used to signal an error to event listeners.\n   *\n   * @public\n   */\n  error: 'ev_err',\n\n  /**\n   * This event type is used to signal a warning to event listeners.\n   *\n   * @public\n   */\n  warning: 'ev_warn',\n}\n"
  },
  {
    "path": "packages/core-types/src/index.ts",
    "content": "/**\n * Provides {@link @veramo/core#Agent} implementation and defines {@link @veramo/core-types#IResolver},\n * {@link @veramo/core-types#IDIDManager}, {@link @veramo/core-types#IKeyManager}, {@link\n * @veramo/core-types#IDataStore}, {@link @veramo/core-types#IMessageHandler} plugin interfaces\n *\n * @packageDocumentation\n */\n\nexport { CoreEvents } from './coreEvents.js'\nexport * from './agent.js'\nexport * from './types/IAgent.js'\nexport * from './types/ICredentialPlugin.js'\nexport * from './types/ICredentialIssuer.js'\nexport * from './types/ICredentialVerifier.js'\nexport * from './types/ICredentialStatus.js'\nexport * from './types/ICredentialStatusManager.js'\nexport * from './types/ICredentialStatusVerifier.js'\nexport * from './types/IDataStore.js'\nexport * from './types/IDataStoreORM.js'\nexport * from './types/IIdentifier.js'\nexport * from './types/IDIDManager.js'\nexport * from './types/IKeyManager.js'\nexport * from './types/IMessage.js'\nexport * from './types/IMessageHandler.js'\nexport * from './types/IResolver.js'\nexport * from './types/IError.js'\nexport * from './types/IVerifyResult.js'\nexport * from './types/vc-data-model.js'\nexport { schema } from './plugin.schema.js'\n"
  },
  {
    "path": "packages/core-types/src/plugin.schema.ts",
    "content": "export const schema = {\n  \"IResolver\": {\n    \"components\": {\n      \"schemas\": {\n        \"GetDIDComponentArgs\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"didDocument\": {\n              \"$ref\": \"#/components/schemas/DIDDocument\",\n              \"description\": \"the DID document from which to extract the fragment. This MUST be the document resolved by  {@link  IResolver.resolveDid }\"\n            },\n            \"didUrl\": {\n              \"type\": \"string\",\n              \"description\": \"The DID URI that needs to be dereferenced. This should refer to the subsection by #fragment.\\n\\nExample: did:example:identifier#controller\"\n            },\n            \"section\": {\n              \"$ref\": \"#/components/schemas/DIDDocumentSection\",\n              \"description\": \"Optional. The section of the DID document where to search for the fragment. Example 'keyAgreement', or 'assertionMethod', or 'authentication', etc\"\n            }\n          },\n          \"required\": [\n            \"didDocument\",\n            \"didUrl\"\n          ],\n          \"description\": \"Input arguments for  {@link IResolver.getDIDComponentById | getDIDComponentById }\"\n        },\n        \"DIDDocument\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"authentication\": {\n              \"type\": \"array\",\n              \"items\": {\n                \"anyOf\": [\n                  {\n                    \"type\": \"string\"\n                  },\n                  {\n                    \"$ref\": \"#/components/schemas/VerificationMethod\"\n                  }\n                ]\n              }\n            },\n            \"assertionMethod\": {\n              \"type\": \"array\",\n              \"items\": {\n                \"anyOf\": [\n                  {\n                    \"type\": \"string\"\n                  },\n                  {\n                    \"$ref\": \"#/components/schemas/VerificationMethod\"\n                  }\n                ]\n              }\n            },\n            \"keyAgreement\": {\n              \"type\": \"array\",\n              \"items\": {\n                \"anyOf\": [\n                  {\n                    \"type\": \"string\"\n                  },\n                  {\n                    \"$ref\": \"#/components/schemas/VerificationMethod\"\n                  }\n                ]\n              }\n            },\n            \"capabilityInvocation\": {\n              \"type\": \"array\",\n              \"items\": {\n                \"anyOf\": [\n                  {\n                    \"type\": \"string\"\n                  },\n                  {\n                    \"$ref\": \"#/components/schemas/VerificationMethod\"\n                  }\n                ]\n              }\n            },\n            \"capabilityDelegation\": {\n              \"type\": \"array\",\n              \"items\": {\n                \"anyOf\": [\n                  {\n                    \"type\": \"string\"\n                  },\n                  {\n                    \"$ref\": \"#/components/schemas/VerificationMethod\"\n                  }\n                ]\n              }\n            },\n            \"@context\": {\n              \"anyOf\": [\n                {\n                  \"type\": \"string\",\n                  \"const\": \"https://www.w3.org/ns/did/v1\"\n                },\n                {\n                  \"type\": \"string\"\n                },\n                {\n                  \"type\": \"array\",\n                  \"items\": {\n                    \"type\": \"string\"\n                  }\n                }\n              ]\n            },\n            \"id\": {\n              \"type\": \"string\"\n            },\n            \"alsoKnownAs\": {\n              \"type\": \"array\",\n              \"items\": {\n                \"type\": \"string\"\n              }\n            },\n            \"controller\": {\n              \"anyOf\": [\n                {\n                  \"type\": \"string\"\n                },\n                {\n                  \"type\": \"array\",\n                  \"items\": {\n                    \"type\": \"string\"\n                  }\n                }\n              ]\n            },\n            \"verificationMethod\": {\n              \"type\": \"array\",\n              \"items\": {\n                \"$ref\": \"#/components/schemas/VerificationMethod\"\n              }\n            },\n            \"service\": {\n              \"type\": \"array\",\n              \"items\": {\n                \"$ref\": \"#/components/schemas/Service\"\n              }\n            },\n            \"publicKey\": {\n              \"type\": \"array\",\n              \"items\": {\n                \"$ref\": \"#/components/schemas/VerificationMethod\"\n              },\n              \"deprecated\": true\n            }\n          },\n          \"required\": [\n            \"id\"\n          ],\n          \"description\": \"Represents a DID document.\"\n        },\n        \"VerificationMethod\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"id\": {\n              \"type\": \"string\"\n            },\n            \"type\": {\n              \"type\": \"string\"\n            },\n            \"controller\": {\n              \"type\": \"string\"\n            },\n            \"publicKeyBase58\": {\n              \"type\": \"string\"\n            },\n            \"publicKeyBase64\": {\n              \"type\": \"string\"\n            },\n            \"publicKeyJwk\": {\n              \"$ref\": \"#/components/schemas/JsonWebKey\"\n            },\n            \"publicKeyHex\": {\n              \"type\": \"string\"\n            },\n            \"publicKeyMultibase\": {\n              \"type\": \"string\"\n            },\n            \"blockchainAccountId\": {\n              \"type\": \"string\"\n            },\n            \"ethereumAddress\": {\n              \"type\": \"string\"\n            },\n            \"conditionOr\": {\n              \"type\": \"array\",\n              \"items\": {\n                \"$ref\": \"#/components/schemas/VerificationMethod\"\n              }\n            },\n            \"conditionAnd\": {\n              \"type\": \"array\",\n              \"items\": {\n                \"$ref\": \"#/components/schemas/VerificationMethod\"\n              }\n            },\n            \"threshold\": {\n              \"type\": \"number\"\n            },\n            \"conditionThreshold\": {\n              \"type\": \"array\",\n              \"items\": {\n                \"$ref\": \"#/components/schemas/VerificationMethod\"\n              }\n            },\n            \"conditionWeightedThreshold\": {\n              \"type\": \"array\",\n              \"items\": {\n                \"$ref\": \"#/components/schemas/ConditionWeightedThreshold\"\n              }\n            },\n            \"conditionDelegated\": {\n              \"type\": \"string\"\n            },\n            \"relationshipParent\": {\n              \"type\": \"array\",\n              \"items\": {\n                \"type\": \"string\"\n              }\n            },\n            \"relationshipChild\": {\n              \"type\": \"array\",\n              \"items\": {\n                \"type\": \"string\"\n              }\n            },\n            \"relationshipSibling\": {\n              \"type\": \"array\",\n              \"items\": {\n                \"type\": \"string\"\n              }\n            }\n          },\n          \"required\": [\n            \"id\",\n            \"type\",\n            \"controller\"\n          ],\n          \"description\": \"Represents the properties of a Verification Method listed in a DID document.\\n\\nThis data type includes public key representations that are no longer present in the spec but are still used by several DID methods / resolvers and kept for backward compatibility.\"\n        },\n        \"JsonWebKey\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"alg\": {\n              \"type\": \"string\"\n            },\n            \"crv\": {\n              \"type\": \"string\"\n            },\n            \"e\": {\n              \"type\": \"string\"\n            },\n            \"ext\": {\n              \"type\": \"boolean\"\n            },\n            \"key_ops\": {\n              \"type\": \"array\",\n              \"items\": {\n                \"type\": \"string\"\n              }\n            },\n            \"kid\": {\n              \"type\": \"string\"\n            },\n            \"kty\": {\n              \"type\": \"string\"\n            },\n            \"n\": {\n              \"type\": \"string\"\n            },\n            \"use\": {\n              \"type\": \"string\"\n            },\n            \"x\": {\n              \"type\": \"string\"\n            },\n            \"y\": {\n              \"type\": \"string\"\n            }\n          },\n          \"required\": [\n            \"kty\"\n          ],\n          \"description\": \"Encapsulates a JSON web key type that includes only the public properties that can be used in DID documents.\\n\\nThe private properties are intentionally omitted to discourage the use (and accidental disclosure) of private keys in DID documents.\"\n        },\n        \"ConditionWeightedThreshold\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"condition\": {\n              \"$ref\": \"#/components/schemas/VerificationMethod\"\n            },\n            \"weight\": {\n              \"type\": \"number\"\n            }\n          },\n          \"required\": [\n            \"condition\",\n            \"weight\"\n          ]\n        },\n        \"Service\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"id\": {\n              \"type\": \"string\"\n            },\n            \"type\": {\n              \"type\": \"string\"\n            },\n            \"serviceEndpoint\": {\n              \"anyOf\": [\n                {\n                  \"$ref\": \"#/components/schemas/ServiceEndpoint\"\n                },\n                {\n                  \"type\": \"array\",\n                  \"items\": {\n                    \"$ref\": \"#/components/schemas/ServiceEndpoint\"\n                  }\n                }\n              ]\n            }\n          },\n          \"required\": [\n            \"id\",\n            \"type\",\n            \"serviceEndpoint\"\n          ],\n          \"description\": \"Represents a Service entry in a  {@link https://www.w3.org/TR/did-core/#did-document-properties | DID document } .\"\n        },\n        \"ServiceEndpoint\": {\n          \"anyOf\": [\n            {\n              \"type\": \"string\"\n            },\n            {\n              \"type\": \"object\"\n            }\n          ],\n          \"description\": \"Represents an endpoint of a Service entry in a DID document.\"\n        },\n        \"DIDDocumentSection\": {\n          \"anyOf\": [\n            {\n              \"$ref\": \"#/components/schemas/KeyCapabilitySection\"\n            },\n            {\n              \"type\": \"string\",\n              \"const\": \"verificationMethod\"\n            },\n            {\n              \"type\": \"string\",\n              \"const\": \"publicKey\"\n            },\n            {\n              \"type\": \"string\",\n              \"const\": \"service\"\n            }\n          ],\n          \"description\": \"Refers to a section of a DID document. Either the list of verification methods or services or one of the verification relationships.\\n\\nSee  {@link https://www.w3.org/TR/did-core/#verification-relationships | verification relationships }\"\n        },\n        \"KeyCapabilitySection\": {\n          \"type\": \"string\",\n          \"enum\": [\n            \"authentication\",\n            \"assertionMethod\",\n            \"keyAgreement\",\n            \"capabilityInvocation\",\n            \"capabilityDelegation\"\n          ],\n          \"description\": \"Represents the Verification Relationship between a DID subject and a Verification Method.\"\n        },\n        \"DIDDocComponent\": {\n          \"anyOf\": [\n            {\n              \"$ref\": \"#/components/schemas/VerificationMethod\"\n            },\n            {\n              \"$ref\": \"#/components/schemas/ServiceEndpoint\"\n            }\n          ],\n          \"description\": \"Return type of  {@link IResolver.getDIDComponentById | getDIDComponentById }  represents a `VerificationMethod` or a `ServiceEndpoint` entry from a  {@link did-resolver#DIDDocument | DIDDocument }\"\n        },\n        \"ResolveDidArgs\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"didUrl\": {\n              \"type\": \"string\",\n              \"description\": \"DID URL\"\n            },\n            \"options\": {\n              \"$ref\": \"#/components/schemas/DIDResolutionOptions\",\n              \"description\": \"DID resolution options that will be passed to the method specific resolver. See: https://w3c.github.io/did-spec-registries/#did-resolution-input-metadata See: https://www.w3.org/TR/did-core/#did-resolution-options\"\n            }\n          },\n          \"required\": [\n            \"didUrl\"\n          ],\n          \"description\": \"Input arguments for  {@link IResolver.resolveDid | resolveDid }\"\n        },\n        \"DIDResolutionOptions\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"accept\": {\n              \"type\": \"string\"\n            }\n          },\n          \"description\": \"Describes the options forwarded to the resolver when executing a  {@link  Resolvable.resolve }  operation.\"\n        },\n        \"DIDResolutionResult\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"@context\": {\n              \"anyOf\": [\n                {\n                  \"type\": \"string\",\n                  \"const\": \"https://w3id.org/did-resolution/v1\"\n                },\n                {\n                  \"type\": \"string\"\n                },\n                {\n                  \"type\": \"array\",\n                  \"items\": {\n                    \"type\": \"string\"\n                  }\n                }\n              ]\n            },\n            \"didResolutionMetadata\": {\n              \"$ref\": \"#/components/schemas/DIDResolutionMetadata\"\n            },\n            \"didDocument\": {\n              \"anyOf\": [\n                {\n                  \"$ref\": \"#/components/schemas/DIDDocument\"\n                },\n                {\n                  \"type\": \"null\"\n                }\n              ]\n            },\n            \"didDocumentMetadata\": {\n              \"$ref\": \"#/components/schemas/DIDDocumentMetadata\"\n            }\n          },\n          \"required\": [\n            \"didResolutionMetadata\",\n            \"didDocument\",\n            \"didDocumentMetadata\"\n          ],\n          \"description\": \"Defines the result of a DID resolution operation.\"\n        },\n        \"DIDResolutionMetadata\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"contentType\": {\n              \"type\": \"string\"\n            },\n            \"error\": {\n              \"type\": \"string\"\n            }\n          },\n          \"description\": \"Encapsulates the resolution metadata resulting from a  {@link  Resolvable.resolve }  operation.\"\n        },\n        \"DIDDocumentMetadata\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"created\": {\n              \"type\": \"string\"\n            },\n            \"updated\": {\n              \"type\": \"string\"\n            },\n            \"deactivated\": {\n              \"type\": \"boolean\"\n            },\n            \"versionId\": {\n              \"type\": \"string\"\n            },\n            \"nextUpdate\": {\n              \"type\": \"string\"\n            },\n            \"nextVersionId\": {\n              \"type\": \"string\"\n            },\n            \"equivalentId\": {\n              \"type\": \"string\"\n            },\n            \"canonicalId\": {\n              \"type\": \"string\"\n            }\n          },\n          \"description\": \"Represents metadata about the DID document resulting from a  {@link  Resolvable.resolve }  operation.\"\n        }\n      },\n      \"methods\": {\n        \"getDIDComponentById\": {\n          \"description\": \"Dereferences a DID URL fragment and returns the corresponding DID document entry.\",\n          \"arguments\": {\n            \"$ref\": \"#/components/schemas/GetDIDComponentArgs\"\n          },\n          \"returnType\": {\n            \"$ref\": \"#/components/schemas/DIDDocComponent\"\n          }\n        },\n        \"resolveDid\": {\n          \"description\": \"Resolves DID and returns DID Resolution Result\",\n          \"arguments\": {\n            \"$ref\": \"#/components/schemas/ResolveDidArgs\"\n          },\n          \"returnType\": {\n            \"$ref\": \"#/components/schemas/DIDResolutionResult\"\n          }\n        }\n      }\n    }\n  },\n  \"IKeyManager\": {\n    \"components\": {\n      \"schemas\": {\n        \"IKeyManagerCreateArgs\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"type\": {\n              \"$ref\": \"#/components/schemas/TKeyType\",\n              \"description\": \"Key type\"\n            },\n            \"kms\": {\n              \"type\": \"string\",\n              \"description\": \"Key Management System\"\n            },\n            \"meta\": {\n              \"$ref\": \"#/components/schemas/KeyMetadata\",\n              \"description\": \"Optional. Key meta data\"\n            },\n            \"kid\": {\n              \"type\": \"string\",\n              \"description\": \"Optional. Key ID\"\n            }\n          },\n          \"required\": [\n            \"type\",\n            \"kms\"\n          ],\n          \"description\": \"Input arguments for  {@link IKeyManager.keyManagerCreate | keyManagerCreate }\"\n        },\n        \"TKeyType\": {\n          \"type\": \"string\",\n          \"description\": \"Cryptographic key type.\"\n        },\n        \"KeyMetadata\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"algorithms\": {\n              \"type\": \"array\",\n              \"items\": {\n                \"$ref\": \"#/components/schemas/TAlg\"\n              }\n            }\n          },\n          \"description\": \"This encapsulates data about a key.\\n\\nImplementations of  {@link  @veramo/key-manager#AbstractKeyManagementSystem | AbstractKeyManagementSystem }  should populate this object, for each key, with the algorithms that can be performed using it.\\n\\nThis can also be used to add various tags to the keys under management.\"\n        },\n        \"TAlg\": {\n          \"type\": \"string\",\n          \"description\": \"Known algorithms supported by some of the above key types defined by  {@link  TKeyType } .\\n\\nActual implementations of  {@link  @veramo/key-manager#AbstractKeyManagementSystem | Key Management Systems }  can support more. One should check the  {@link IKey.meta | IKey.meta.algorithms }  property to see what is possible for a particular managed key.\"\n        },\n        \"ManagedKeyInfo\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"kid\": {\n              \"type\": \"string\",\n              \"description\": \"Key ID\"\n            },\n            \"kms\": {\n              \"type\": \"string\",\n              \"description\": \"Key Management System\"\n            },\n            \"type\": {\n              \"$ref\": \"#/components/schemas/TKeyType\",\n              \"description\": \"Key type\"\n            },\n            \"publicKeyHex\": {\n              \"type\": \"string\",\n              \"description\": \"Public key\"\n            },\n            \"meta\": {\n              \"anyOf\": [\n                {\n                  \"$ref\": \"#/components/schemas/KeyMetadata\"\n                },\n                {\n                  \"type\": \"null\"\n                }\n              ],\n              \"description\": \"Optional. Key metadata. This should be used to determine which algorithms are supported.\"\n            }\n          },\n          \"required\": [\n            \"kid\",\n            \"kms\",\n            \"type\",\n            \"publicKeyHex\"\n          ],\n          \"description\": \"Represents information about a managed key. Private or secret key material is NOT present.\"\n        },\n        \"IKeyManagerDecryptJWEArgs\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"kid\": {\n              \"type\": \"string\",\n              \"description\": \"Key ID\"\n            },\n            \"data\": {\n              \"type\": \"string\",\n              \"description\": \"Encrypted data\"\n            }\n          },\n          \"required\": [\n            \"kid\",\n            \"data\"\n          ],\n          \"description\": \"Input arguments for  {@link IKeyManager.keyManagerDecryptJWE | keyManagerDecryptJWE }\"\n        },\n        \"IKeyManagerDeleteArgs\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"kid\": {\n              \"type\": \"string\",\n              \"description\": \"Key ID\"\n            }\n          },\n          \"required\": [\n            \"kid\"\n          ],\n          \"description\": \"Input arguments for  {@link IKeyManager.keyManagerDelete | keyManagerDelete }\"\n        },\n        \"IKeyManagerEncryptJWEArgs\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"kid\": {\n              \"type\": \"string\",\n              \"description\": \"Key ID to use for encryption\"\n            },\n            \"to\": {\n              \"type\": \"object\",\n              \"properties\": {\n                \"kid\": {\n                  \"type\": \"string\",\n                  \"description\": \"Key ID\"\n                },\n                \"type\": {\n                  \"$ref\": \"#/components/schemas/TKeyType\",\n                  \"description\": \"Key type\"\n                },\n                \"publicKeyHex\": {\n                  \"type\": \"string\",\n                  \"description\": \"Public key\"\n                },\n                \"privateKeyHex\": {\n                  \"type\": \"string\",\n                  \"description\": \"Optional. Private key\"\n                },\n                \"meta\": {\n                  \"anyOf\": [\n                    {\n                      \"$ref\": \"#/components/schemas/KeyMetadata\"\n                    },\n                    {\n                      \"type\": \"null\"\n                    }\n                  ],\n                  \"description\": \"Optional. Key metadata. This should be used to determine which algorithms are supported.\"\n                }\n              },\n              \"required\": [\n                \"kid\",\n                \"type\",\n                \"publicKeyHex\"\n              ],\n              \"description\": \"Recipient key object\"\n            },\n            \"data\": {\n              \"type\": \"string\",\n              \"description\": \"Data to encrypt\"\n            }\n          },\n          \"required\": [\n            \"kid\",\n            \"to\",\n            \"data\"\n          ],\n          \"description\": \"Input arguments for  {@link IKeyManager.keyManagerEncryptJWE | keyManagerEncryptJWE }\"\n        },\n        \"IKeyManagerGetArgs\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"kid\": {\n              \"type\": \"string\",\n              \"description\": \"Key ID\"\n            }\n          },\n          \"required\": [\n            \"kid\"\n          ],\n          \"description\": \"Input arguments for  {@link IKeyManager.keyManagerGet | keyManagerGet }\"\n        },\n        \"IKey\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"kid\": {\n              \"type\": \"string\",\n              \"description\": \"Key ID\"\n            },\n            \"kms\": {\n              \"type\": \"string\",\n              \"description\": \"Key Management System\"\n            },\n            \"type\": {\n              \"$ref\": \"#/components/schemas/TKeyType\",\n              \"description\": \"Key type\"\n            },\n            \"publicKeyHex\": {\n              \"type\": \"string\",\n              \"description\": \"Public key\"\n            },\n            \"privateKeyHex\": {\n              \"type\": \"string\",\n              \"description\": \"Optional. Private key\"\n            },\n            \"meta\": {\n              \"anyOf\": [\n                {\n                  \"$ref\": \"#/components/schemas/KeyMetadata\"\n                },\n                {\n                  \"type\": \"null\"\n                }\n              ],\n              \"description\": \"Optional. Key metadata. This should be used to determine which algorithms are supported.\"\n            }\n          },\n          \"required\": [\n            \"kid\",\n            \"kms\",\n            \"type\",\n            \"publicKeyHex\"\n          ],\n          \"description\": \"Cryptographic key, usually managed by the current Veramo instance.\"\n        },\n        \"MinimalImportableKey\": {\n          \"$ref\": \"#/components/schemas/RequireOnly<IKey,(\\\"privateKeyHex\\\"|\\\"type\\\"|\\\"kms\\\")>\",\n          \"description\": \"Represents the properties required to import a key.\"\n        },\n        \"RequireOnly<IKey,(\\\"privateKeyHex\\\"|\\\"type\\\"|\\\"kms\\\")>\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"kid\": {\n              \"type\": \"string\",\n              \"description\": \"Key ID\"\n            },\n            \"kms\": {\n              \"type\": \"string\",\n              \"description\": \"Key Management System\"\n            },\n            \"type\": {\n              \"$ref\": \"#/components/schemas/TKeyType\",\n              \"description\": \"Key type\"\n            },\n            \"publicKeyHex\": {\n              \"type\": \"string\",\n              \"description\": \"Public key\"\n            },\n            \"privateKeyHex\": {\n              \"type\": \"string\",\n              \"description\": \"Optional. Private key\"\n            },\n            \"meta\": {\n              \"anyOf\": [\n                {\n                  \"$ref\": \"#/components/schemas/KeyMetadata\"\n                },\n                {\n                  \"type\": \"null\"\n                }\n              ],\n              \"description\": \"Optional. Key metadata. This should be used to determine which algorithms are supported.\"\n            }\n          },\n          \"description\": \"Represents an object type where a subset of keys is required and everything else is optional.\"\n        },\n        \"IKeyManagerSharedSecretArgs\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"secretKeyRef\": {\n              \"type\": \"string\",\n              \"description\": \"The secret key handle (`kid`) as returned by  {@link IKeyManager.keyManagerCreate | keyManagerCreate }\"\n            },\n            \"publicKey\": {\n              \"type\": \"object\",\n              \"properties\": {\n                \"publicKeyHex\": {\n                  \"type\": \"string\",\n                  \"description\": \"Public key\"\n                },\n                \"type\": {\n                  \"$ref\": \"#/components/schemas/TKeyType\",\n                  \"description\": \"Key type\"\n                }\n              },\n              \"required\": [\n                \"publicKeyHex\",\n                \"type\"\n              ],\n              \"description\": \"The public key of the other party. The `type` of key MUST be compatible with the type referenced by `secretKeyRef`\"\n            }\n          },\n          \"required\": [\n            \"secretKeyRef\",\n            \"publicKey\"\n          ],\n          \"description\": \"Input arguments for  {@link IKeyManager.keyManagerSharedSecret | keyManagerSharedSecret }\"\n        },\n        \"IKeyManagerSignArgs\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"keyRef\": {\n              \"type\": \"string\",\n              \"description\": \"The key handle, as returned during `keyManagerCreateKey`\"\n            },\n            \"algorithm\": {\n              \"type\": \"string\",\n              \"description\": \"The algorithm to use for signing. This must be one of the algorithms supported by the KMS for this key type.\\n\\nThe algorithm used here should match one of the names listed in `IKey.meta.algorithms`\"\n            },\n            \"data\": {\n              \"type\": \"string\",\n              \"description\": \"Data to sign\"\n            },\n            \"encoding\": {\n              \"type\": \"string\",\n              \"enum\": [\n                \"utf-8\",\n                \"base16\",\n                \"base64\",\n                \"hex\"\n              ],\n              \"description\": \"If the data is a \\\"string\\\" then you can specify which encoding is used. Default is \\\"utf-8\\\"\"\n            }\n          },\n          \"required\": [\n            \"keyRef\",\n            \"data\"\n          ],\n          \"description\": \"Input arguments for  {@link IKeyManager.keyManagerSign | keyManagerSign }\"\n        },\n        \"IKeyManagerSignEthTXArgs\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"kid\": {\n              \"type\": \"string\",\n              \"description\": \"Key ID\"\n            },\n            \"transaction\": {\n              \"type\": \"object\",\n              \"description\": \"Ethereum transaction object\"\n            }\n          },\n          \"required\": [\n            \"kid\",\n            \"transaction\"\n          ],\n          \"description\": \"Input arguments for  {@link IKeyManager.keyManagerSignEthTX | keyManagerSignEthTX }\"\n        },\n        \"IKeyManagerSignJWTArgs\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"kid\": {\n              \"type\": \"string\",\n              \"description\": \"Key ID\"\n            },\n            \"data\": {\n              \"anyOf\": [\n                {\n                  \"type\": \"string\"\n                },\n                {\n                  \"type\": \"object\",\n                  \"properties\": {\n                    \"BYTES_PER_ELEMENT\": {\n                      \"type\": \"number\"\n                    },\n                    \"buffer\": {\n                      \"anyOf\": [\n                        {\n                          \"type\": \"object\",\n                          \"properties\": {\n                            \"byteLength\": {\n                              \"type\": \"number\"\n                            }\n                          },\n                          \"required\": [\n                            \"byteLength\"\n                          ]\n                        },\n                        {}\n                      ]\n                    },\n                    \"byteLength\": {\n                      \"type\": \"number\"\n                    },\n                    \"byteOffset\": {\n                      \"type\": \"number\"\n                    },\n                    \"length\": {\n                      \"type\": \"number\"\n                    }\n                  },\n                  \"required\": [\n                    \"BYTES_PER_ELEMENT\",\n                    \"buffer\",\n                    \"byteLength\",\n                    \"byteOffset\",\n                    \"length\"\n                  ],\n                  \"additionalProperties\": {\n                    \"type\": \"number\"\n                  }\n                }\n              ],\n              \"description\": \"Data to sign\"\n            }\n          },\n          \"required\": [\n            \"kid\",\n            \"data\"\n          ],\n          \"description\": \"Input arguments for  {@link IKeyManager.keyManagerSignJWT | keyManagerSignJWT }\"\n        }\n      },\n      \"methods\": {\n        \"keyManagerCreate\": {\n          \"description\": \"Creates and returns a new key\",\n          \"arguments\": {\n            \"$ref\": \"#/components/schemas/IKeyManagerCreateArgs\"\n          },\n          \"returnType\": {\n            \"$ref\": \"#/components/schemas/ManagedKeyInfo\"\n          }\n        },\n        \"keyManagerDecryptJWE\": {\n          \"description\": \"Decrypts data This API may change without a BREAKING CHANGE notice.\",\n          \"arguments\": {\n            \"$ref\": \"#/components/schemas/IKeyManagerDecryptJWEArgs\"\n          },\n          \"returnType\": {\n            \"type\": \"string\"\n          }\n        },\n        \"keyManagerDelete\": {\n          \"description\": \"Deletes a key\",\n          \"arguments\": {\n            \"$ref\": \"#/components/schemas/IKeyManagerDeleteArgs\"\n          },\n          \"returnType\": {\n            \"type\": \"boolean\"\n          }\n        },\n        \"keyManagerEncryptJWE\": {\n          \"description\": \"Encrypts data This API may change without a BREAKING CHANGE notice.\",\n          \"arguments\": {\n            \"$ref\": \"#/components/schemas/IKeyManagerEncryptJWEArgs\"\n          },\n          \"returnType\": {\n            \"type\": \"string\"\n          }\n        },\n        \"keyManagerGet\": {\n          \"description\": \"Returns an existing key\",\n          \"arguments\": {\n            \"$ref\": \"#/components/schemas/IKeyManagerGetArgs\"\n          },\n          \"returnType\": {\n            \"$ref\": \"#/components/schemas/IKey\"\n          }\n        },\n        \"keyManagerGetKeyManagementSystems\": {\n          \"description\": \"Lists available key management systems\",\n          \"arguments\": {\n            \"type\": \"object\"\n          },\n          \"returnType\": {\n            \"type\": \"array\",\n            \"items\": {\n              \"type\": \"string\"\n            }\n          }\n        },\n        \"keyManagerImport\": {\n          \"description\": \"Imports a created key\",\n          \"arguments\": {\n            \"$ref\": \"#/components/schemas/MinimalImportableKey\"\n          },\n          \"returnType\": {\n            \"$ref\": \"#/components/schemas/ManagedKeyInfo\"\n          }\n        },\n        \"keyManagerSharedSecret\": {\n          \"description\": \"Compute a shared secret with the public key of another party.\",\n          \"arguments\": {\n            \"$ref\": \"#/components/schemas/IKeyManagerSharedSecretArgs\"\n          },\n          \"returnType\": {\n            \"type\": \"string\"\n          }\n        },\n        \"keyManagerSign\": {\n          \"description\": \"Generates a signature according to the algorithm specified.\",\n          \"arguments\": {\n            \"$ref\": \"#/components/schemas/IKeyManagerSignArgs\"\n          },\n          \"returnType\": {\n            \"type\": \"string\"\n          }\n        },\n        \"keyManagerSignEthTX\": {\n          \"description\": \"Signs Ethereum transaction\",\n          \"arguments\": {\n            \"$ref\": \"#/components/schemas/IKeyManagerSignEthTXArgs\"\n          },\n          \"returnType\": {\n            \"type\": \"string\"\n          }\n        },\n        \"keyManagerSignJWT\": {\n          \"description\": \"Signs JWT\",\n          \"arguments\": {\n            \"$ref\": \"#/components/schemas/IKeyManagerSignJWTArgs\"\n          },\n          \"returnType\": {\n            \"type\": \"string\"\n          }\n        }\n      }\n    }\n  },\n  \"IDIDManager\": {\n    \"components\": {\n      \"schemas\": {\n        \"IDIDManagerAddKeyArgs\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"did\": {\n              \"type\": \"string\",\n              \"description\": \"DID\"\n            },\n            \"key\": {\n              \"$ref\": \"#/components/schemas/IKey\",\n              \"description\": \"Key object\"\n            },\n            \"options\": {\n              \"type\": \"object\",\n              \"properties\": {\n                \"localOnly\": {\n                  \"type\": \"boolean\",\n                  \"description\": \"Optional flag to indicate that the key should only be added to the local DIDStore tracking and this update will not be published to any underlying registries\",\n                  \"default\": false\n                }\n              },\n              \"description\": \"Optional. Identifier-provider specific options\"\n            }\n          },\n          \"required\": [\n            \"did\",\n            \"key\"\n          ],\n          \"description\": \"Input arguments for  {@link IDIDManager.didManagerAddKey | didManagerAddKey }\"\n        },\n        \"IKey\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"kid\": {\n              \"type\": \"string\",\n              \"description\": \"Key ID\"\n            },\n            \"kms\": {\n              \"type\": \"string\",\n              \"description\": \"Key Management System\"\n            },\n            \"type\": {\n              \"$ref\": \"#/components/schemas/TKeyType\",\n              \"description\": \"Key type\"\n            },\n            \"publicKeyHex\": {\n              \"type\": \"string\",\n              \"description\": \"Public key\"\n            },\n            \"privateKeyHex\": {\n              \"type\": \"string\",\n              \"description\": \"Optional. Private key\"\n            },\n            \"meta\": {\n              \"anyOf\": [\n                {\n                  \"$ref\": \"#/components/schemas/KeyMetadata\"\n                },\n                {\n                  \"type\": \"null\"\n                }\n              ],\n              \"description\": \"Optional. Key metadata. This should be used to determine which algorithms are supported.\"\n            }\n          },\n          \"required\": [\n            \"kid\",\n            \"kms\",\n            \"type\",\n            \"publicKeyHex\"\n          ],\n          \"description\": \"Cryptographic key, usually managed by the current Veramo instance.\"\n        },\n        \"TKeyType\": {\n          \"type\": \"string\",\n          \"description\": \"Cryptographic key type.\"\n        },\n        \"KeyMetadata\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"algorithms\": {\n              \"type\": \"array\",\n              \"items\": {\n                \"$ref\": \"#/components/schemas/TAlg\"\n              }\n            }\n          },\n          \"description\": \"This encapsulates data about a key.\\n\\nImplementations of  {@link  @veramo/key-manager#AbstractKeyManagementSystem | AbstractKeyManagementSystem }  should populate this object, for each key, with the algorithms that can be performed using it.\\n\\nThis can also be used to add various tags to the keys under management.\"\n        },\n        \"TAlg\": {\n          \"type\": \"string\",\n          \"description\": \"Known algorithms supported by some of the above key types defined by  {@link  TKeyType } .\\n\\nActual implementations of  {@link  @veramo/key-manager#AbstractKeyManagementSystem | Key Management Systems }  can support more. One should check the  {@link IKey.meta | IKey.meta.algorithms }  property to see what is possible for a particular managed key.\"\n        },\n        \"IDIDManagerAddServiceArgs\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"did\": {\n              \"type\": \"string\",\n              \"description\": \"DID\"\n            },\n            \"service\": {\n              \"$ref\": \"#/components/schemas/IService\",\n              \"description\": \"Service object\"\n            },\n            \"options\": {\n              \"type\": \"object\",\n              \"properties\": {\n                \"localOnly\": {\n                  \"type\": \"boolean\",\n                  \"description\": \"Optional flag to indicate that the service should only be added to the local DIDStore tracking and this update will not be published to any underlying registries\",\n                  \"default\": false\n                }\n              },\n              \"description\": \"Optional. Identifier-provider specific options\"\n            }\n          },\n          \"required\": [\n            \"did\",\n            \"service\"\n          ],\n          \"description\": \"Input arguments for  {@link IDIDManager.didManagerAddService | didManagerAddService }\"\n        },\n        \"IService\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"id\": {\n              \"type\": \"string\",\n              \"description\": \"ID\"\n            },\n            \"type\": {\n              \"type\": \"string\",\n              \"description\": \"Service type\"\n            },\n            \"serviceEndpoint\": {\n              \"anyOf\": [\n                {\n                  \"$ref\": \"#/components/schemas/IServiceEndpoint\"\n                },\n                {\n                  \"type\": \"array\",\n                  \"items\": {\n                    \"$ref\": \"#/components/schemas/IServiceEndpoint\"\n                  }\n                }\n              ],\n              \"description\": \"Endpoint URL\"\n            },\n            \"description\": {\n              \"type\": \"string\",\n              \"description\": \"Optional. Description\"\n            }\n          },\n          \"required\": [\n            \"id\",\n            \"type\",\n            \"serviceEndpoint\"\n          ],\n          \"description\": \"Identifier service\"\n        },\n        \"IServiceEndpoint\": {\n          \"anyOf\": [\n            {\n              \"type\": \"string\"\n            },\n            {\n              \"type\": \"object\"\n            }\n          ],\n          \"description\": \"Represents a service endpoint URL or a map of URLs\"\n        },\n        \"IDIDManagerCreateArgs\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"alias\": {\n              \"type\": \"string\",\n              \"description\": \"Optional. Identifier alias. Can be used to reference an object in an external system\"\n            },\n            \"provider\": {\n              \"type\": \"string\",\n              \"description\": \"Optional. Identifier provider\"\n            },\n            \"kms\": {\n              \"type\": \"string\",\n              \"description\": \"Optional. Key Management System\"\n            },\n            \"options\": {\n              \"type\": \"object\",\n              \"description\": \"Optional. Identifier-provider specific options\"\n            }\n          },\n          \"description\": \"Input arguments for  {@link IDIDManager.didManagerCreate | didManagerCreate }\"\n        },\n        \"IIdentifier\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"did\": {\n              \"type\": \"string\",\n              \"description\": \"Decentralized identifier\"\n            },\n            \"alias\": {\n              \"type\": \"string\",\n              \"description\": \"Optional. Identifier alias. Can be used to reference an object in an external system\"\n            },\n            \"provider\": {\n              \"type\": \"string\",\n              \"description\": \"Identifier provider name\"\n            },\n            \"controllerKeyId\": {\n              \"type\": \"string\",\n              \"description\": \"Controller key id\"\n            },\n            \"keys\": {\n              \"type\": \"array\",\n              \"items\": {\n                \"$ref\": \"#/components/schemas/IKey\"\n              },\n              \"description\": \"Array of managed keys\"\n            },\n            \"services\": {\n              \"type\": \"array\",\n              \"items\": {\n                \"$ref\": \"#/components/schemas/IService\"\n              },\n              \"description\": \"Array of services\"\n            }\n          },\n          \"required\": [\n            \"did\",\n            \"provider\",\n            \"keys\",\n            \"services\"\n          ],\n          \"description\": \"Identifier interface\"\n        },\n        \"IDIDManagerDeleteArgs\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"did\": {\n              \"type\": \"string\",\n              \"description\": \"DID\"\n            }\n          },\n          \"required\": [\n            \"did\"\n          ],\n          \"description\": \"Input arguments for  {@link IDIDManager.didManagerDelete | didManagerDelete }\"\n        },\n        \"IDIDManagerFindArgs\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"alias\": {\n              \"type\": \"string\",\n              \"description\": \"Optional. Alias\"\n            },\n            \"provider\": {\n              \"type\": \"string\",\n              \"description\": \"Optional. Provider\"\n            }\n          },\n          \"description\": \"Input arguments for  {@link IDIDManager.didManagerFind | didManagerFind }\"\n        },\n        \"IDIDManagerGetArgs\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"did\": {\n              \"type\": \"string\",\n              \"description\": \"DID\"\n            }\n          },\n          \"required\": [\n            \"did\"\n          ],\n          \"description\": \"Input arguments for  {@link IDIDManager.didManagerGet | didManagerGet }\"\n        },\n        \"IDIDManagerGetByAliasArgs\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"alias\": {\n              \"type\": \"string\",\n              \"description\": \"Alias\"\n            },\n            \"provider\": {\n              \"type\": \"string\",\n              \"description\": \"Optional provider\"\n            }\n          },\n          \"required\": [\n            \"alias\"\n          ],\n          \"description\": \"Input arguments for  {@link IDIDManager.didManagerGetByAlias | didManagerGetByAlias }\"\n        },\n        \"IDIDManagerGetOrCreateArgs\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"alias\": {\n              \"type\": \"string\",\n              \"description\": \"Identifier alias. Can be used to reference an object in an external system\"\n            },\n            \"provider\": {\n              \"type\": \"string\",\n              \"description\": \"Optional. Identifier provider\"\n            },\n            \"kms\": {\n              \"type\": \"string\",\n              \"description\": \"Optional. Key Management System\"\n            },\n            \"options\": {\n              \"type\": \"object\",\n              \"description\": \"Optional. Identifier-provider specific options\"\n            }\n          },\n          \"required\": [\n            \"alias\"\n          ],\n          \"description\": \"Input arguments for  {@link IDIDManager.didManagerGetOrCreate | didManagerGetOrCreate }\"\n        },\n        \"MinimalImportableIdentifier\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"did\": {\n              \"type\": \"string\",\n              \"description\": \"Decentralized identifier\"\n            },\n            \"alias\": {\n              \"type\": \"string\",\n              \"description\": \"Optional. Identifier alias. Can be used to reference an object in an external system\"\n            },\n            \"provider\": {\n              \"type\": \"string\",\n              \"description\": \"Identifier provider name\"\n            },\n            \"controllerKeyId\": {\n              \"type\": \"string\",\n              \"description\": \"Controller key id\"\n            },\n            \"keys\": {\n              \"type\": \"array\",\n              \"items\": {\n                \"$ref\": \"#/components/schemas/MinimalImportableKey\"\n              }\n            },\n            \"services\": {\n              \"type\": \"array\",\n              \"items\": {\n                \"$ref\": \"#/components/schemas/IService\"\n              }\n            }\n          },\n          \"required\": [\n            \"did\",\n            \"keys\",\n            \"provider\"\n          ],\n          \"description\": \"Represents the minimum amount of information needed to import an  {@link  IIdentifier } .\"\n        },\n        \"MinimalImportableKey\": {\n          \"$ref\": \"#/components/schemas/RequireOnly<IKey,(\\\"privateKeyHex\\\"|\\\"type\\\"|\\\"kms\\\")>\",\n          \"description\": \"Represents the properties required to import a key.\"\n        },\n        \"RequireOnly<IKey,(\\\"privateKeyHex\\\"|\\\"type\\\"|\\\"kms\\\")>\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"kid\": {\n              \"type\": \"string\",\n              \"description\": \"Key ID\"\n            },\n            \"kms\": {\n              \"type\": \"string\",\n              \"description\": \"Key Management System\"\n            },\n            \"type\": {\n              \"$ref\": \"#/components/schemas/TKeyType\",\n              \"description\": \"Key type\"\n            },\n            \"publicKeyHex\": {\n              \"type\": \"string\",\n              \"description\": \"Public key\"\n            },\n            \"privateKeyHex\": {\n              \"type\": \"string\",\n              \"description\": \"Optional. Private key\"\n            },\n            \"meta\": {\n              \"anyOf\": [\n                {\n                  \"$ref\": \"#/components/schemas/KeyMetadata\"\n                },\n                {\n                  \"type\": \"null\"\n                }\n              ],\n              \"description\": \"Optional. Key metadata. This should be used to determine which algorithms are supported.\"\n            }\n          },\n          \"description\": \"Represents an object type where a subset of keys is required and everything else is optional.\"\n        },\n        \"IDIDManagerRemoveKeyArgs\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"did\": {\n              \"type\": \"string\",\n              \"description\": \"DID\"\n            },\n            \"kid\": {\n              \"type\": \"string\",\n              \"description\": \"Key ID\"\n            },\n            \"options\": {\n              \"type\": \"object\",\n              \"properties\": {\n                \"localOnly\": {\n                  \"type\": \"boolean\",\n                  \"description\": \"Optional flag to indicate that the key should only be removed from the local DIDStore tracking and this update will not be published to any underlying registries\",\n                  \"default\": false\n                }\n              },\n              \"description\": \"Optional. Identifier-provider specific options\"\n            }\n          },\n          \"required\": [\n            \"did\",\n            \"kid\"\n          ],\n          \"description\": \"Input arguments for  {@link IDIDManager.didManagerRemoveKey | didManagerRemoveKey }\"\n        },\n        \"IDIDManagerRemoveServiceArgs\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"did\": {\n              \"type\": \"string\",\n              \"description\": \"DID\"\n            },\n            \"id\": {\n              \"type\": \"string\",\n              \"description\": \"Service ID\"\n            },\n            \"options\": {\n              \"type\": \"object\",\n              \"properties\": {\n                \"localOnly\": {\n                  \"type\": \"boolean\",\n                  \"description\": \"Optional flag to indicate that the service should only be removed from the local DIDStore tracking and this update will not be published to any underlying registries\",\n                  \"default\": false\n                }\n              },\n              \"description\": \"Optional. Identifier-provider specific options\"\n            }\n          },\n          \"required\": [\n            \"did\",\n            \"id\"\n          ],\n          \"description\": \"Input arguments for  {@link IDIDManager.didManagerRemoveService | didManagerRemoveService }\"\n        },\n        \"IDIDManagerSetAliasArgs\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"did\": {\n              \"type\": \"string\",\n              \"description\": \"Required. DID\"\n            },\n            \"alias\": {\n              \"type\": \"string\",\n              \"description\": \"Required. Identifier alias\"\n            }\n          },\n          \"required\": [\n            \"did\",\n            \"alias\"\n          ],\n          \"description\": \"Input arguments for  {@link IDIDManager.didManagerSetAlias | didManagerSetAlias }\"\n        },\n        \"IDIDManagerUpdateArgs\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"did\": {\n              \"type\": \"string\",\n              \"description\": \"Required. DID\"\n            },\n            \"document\": {\n              \"type\": \"object\",\n              \"properties\": {\n                \"@context\": {\n                  \"anyOf\": [\n                    {\n                      \"type\": \"object\",\n                      \"properties\": {}\n                    },\n                    {\n                      \"type\": \"string\"\n                    },\n                    {\n                      \"allOf\": [\n                        {\n                          \"type\": \"array\",\n                          \"items\": {\n                            \"type\": \"string\"\n                          }\n                        },\n                        {\n                          \"type\": \"object\",\n                          \"properties\": {}\n                        }\n                      ]\n                    }\n                  ]\n                },\n                \"id\": {\n                  \"type\": \"string\"\n                },\n                \"alsoKnownAs\": {\n                  \"allOf\": [\n                    {\n                      \"type\": \"array\",\n                      \"items\": {\n                        \"type\": \"string\"\n                      }\n                    },\n                    {\n                      \"type\": \"object\",\n                      \"properties\": {}\n                    }\n                  ]\n                },\n                \"controller\": {\n                  \"anyOf\": [\n                    {\n                      \"type\": \"string\"\n                    },\n                    {\n                      \"allOf\": [\n                        {\n                          \"type\": \"array\",\n                          \"items\": {\n                            \"type\": \"string\"\n                          }\n                        },\n                        {\n                          \"type\": \"object\",\n                          \"properties\": {}\n                        }\n                      ]\n                    }\n                  ]\n                },\n                \"verificationMethod\": {\n                  \"allOf\": [\n                    {\n                      \"type\": \"array\",\n                      \"items\": {\n                        \"$ref\": \"#/components/schemas/VerificationMethod\"\n                      }\n                    },\n                    {\n                      \"type\": \"object\",\n                      \"properties\": {}\n                    }\n                  ]\n                },\n                \"service\": {\n                  \"allOf\": [\n                    {\n                      \"type\": \"array\",\n                      \"items\": {\n                        \"$ref\": \"#/components/schemas/Service\"\n                      }\n                    },\n                    {\n                      \"type\": \"object\",\n                      \"properties\": {}\n                    }\n                  ]\n                },\n                \"publicKey\": {\n                  \"allOf\": [\n                    {\n                      \"type\": \"array\",\n                      \"items\": {\n                        \"$ref\": \"#/components/schemas/VerificationMethod\"\n                      }\n                    },\n                    {\n                      \"type\": \"object\",\n                      \"properties\": {}\n                    }\n                  ],\n                  \"deprecated\": true\n                },\n                \"authentication\": {\n                  \"allOf\": [\n                    {\n                      \"type\": \"array\",\n                      \"items\": {\n                        \"anyOf\": [\n                          {\n                            \"type\": \"string\"\n                          },\n                          {\n                            \"$ref\": \"#/components/schemas/VerificationMethod\"\n                          }\n                        ]\n                      }\n                    },\n                    {\n                      \"type\": \"object\",\n                      \"properties\": {}\n                    }\n                  ]\n                },\n                \"assertionMethod\": {\n                  \"allOf\": [\n                    {\n                      \"type\": \"array\",\n                      \"items\": {\n                        \"anyOf\": [\n                          {\n                            \"type\": \"string\"\n                          },\n                          {\n                            \"$ref\": \"#/components/schemas/VerificationMethod\"\n                          }\n                        ]\n                      }\n                    },\n                    {\n                      \"type\": \"object\",\n                      \"properties\": {}\n                    }\n                  ]\n                },\n                \"keyAgreement\": {\n                  \"allOf\": [\n                    {\n                      \"type\": \"array\",\n                      \"items\": {\n                        \"anyOf\": [\n                          {\n                            \"type\": \"string\"\n                          },\n                          {\n                            \"$ref\": \"#/components/schemas/VerificationMethod\"\n                          }\n                        ]\n                      }\n                    },\n                    {\n                      \"type\": \"object\",\n                      \"properties\": {}\n                    }\n                  ]\n                },\n                \"capabilityInvocation\": {\n                  \"allOf\": [\n                    {\n                      \"type\": \"array\",\n                      \"items\": {\n                        \"anyOf\": [\n                          {\n                            \"type\": \"string\"\n                          },\n                          {\n                            \"$ref\": \"#/components/schemas/VerificationMethod\"\n                          }\n                        ]\n                      }\n                    },\n                    {\n                      \"type\": \"object\",\n                      \"properties\": {}\n                    }\n                  ]\n                },\n                \"capabilityDelegation\": {\n                  \"allOf\": [\n                    {\n                      \"type\": \"array\",\n                      \"items\": {\n                        \"anyOf\": [\n                          {\n                            \"type\": \"string\"\n                          },\n                          {\n                            \"$ref\": \"#/components/schemas/VerificationMethod\"\n                          }\n                        ]\n                      }\n                    },\n                    {\n                      \"type\": \"object\",\n                      \"properties\": {}\n                    }\n                  ]\n                }\n              },\n              \"description\": \"Required\"\n            },\n            \"options\": {\n              \"type\": \"object\",\n              \"properties\": {\n                \"localOnly\": {\n                  \"type\": \"boolean\",\n                  \"description\": \"Optional flag to indicate that the changes will only be applied to the local DIDStore tracking and this update will not be published to any underlying registries AbstractIdentifierProvider implementations must respect this flag where applicable. Defaults to false.\",\n                  \"default\": false\n                }\n              },\n              \"description\": \"Identifier provider specific options.\"\n            }\n          },\n          \"required\": [\n            \"did\",\n            \"document\"\n          ],\n          \"description\": \"The arguments necessary to perform a full DID document update for a DID.\"\n        },\n        \"VerificationMethod\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"id\": {\n              \"type\": \"string\"\n            },\n            \"type\": {\n              \"type\": \"string\"\n            },\n            \"controller\": {\n              \"type\": \"string\"\n            },\n            \"publicKeyBase58\": {\n              \"type\": \"string\"\n            },\n            \"publicKeyBase64\": {\n              \"type\": \"string\"\n            },\n            \"publicKeyJwk\": {\n              \"$ref\": \"#/components/schemas/JsonWebKey\"\n            },\n            \"publicKeyHex\": {\n              \"type\": \"string\"\n            },\n            \"publicKeyMultibase\": {\n              \"type\": \"string\"\n            },\n            \"blockchainAccountId\": {\n              \"type\": \"string\"\n            },\n            \"ethereumAddress\": {\n              \"type\": \"string\"\n            },\n            \"conditionOr\": {\n              \"type\": \"array\",\n              \"items\": {\n                \"$ref\": \"#/components/schemas/VerificationMethod\"\n              }\n            },\n            \"conditionAnd\": {\n              \"type\": \"array\",\n              \"items\": {\n                \"$ref\": \"#/components/schemas/VerificationMethod\"\n              }\n            },\n            \"threshold\": {\n              \"type\": \"number\"\n            },\n            \"conditionThreshold\": {\n              \"type\": \"array\",\n              \"items\": {\n                \"$ref\": \"#/components/schemas/VerificationMethod\"\n              }\n            },\n            \"conditionWeightedThreshold\": {\n              \"type\": \"array\",\n              \"items\": {\n                \"$ref\": \"#/components/schemas/ConditionWeightedThreshold\"\n              }\n            },\n            \"conditionDelegated\": {\n              \"type\": \"string\"\n            },\n            \"relationshipParent\": {\n              \"type\": \"array\",\n              \"items\": {\n                \"type\": \"string\"\n              }\n            },\n            \"relationshipChild\": {\n              \"type\": \"array\",\n              \"items\": {\n                \"type\": \"string\"\n              }\n            },\n            \"relationshipSibling\": {\n              \"type\": \"array\",\n              \"items\": {\n                \"type\": \"string\"\n              }\n            }\n          },\n          \"required\": [\n            \"id\",\n            \"type\",\n            \"controller\"\n          ],\n          \"description\": \"Represents the properties of a Verification Method listed in a DID document.\\n\\nThis data type includes public key representations that are no longer present in the spec but are still used by several DID methods / resolvers and kept for backward compatibility.\"\n        },\n        \"JsonWebKey\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"alg\": {\n              \"type\": \"string\"\n            },\n            \"crv\": {\n              \"type\": \"string\"\n            },\n            \"e\": {\n              \"type\": \"string\"\n            },\n            \"ext\": {\n              \"type\": \"boolean\"\n            },\n            \"key_ops\": {\n              \"type\": \"array\",\n              \"items\": {\n                \"type\": \"string\"\n              }\n            },\n            \"kid\": {\n              \"type\": \"string\"\n            },\n            \"kty\": {\n              \"type\": \"string\"\n            },\n            \"n\": {\n              \"type\": \"string\"\n            },\n            \"use\": {\n              \"type\": \"string\"\n            },\n            \"x\": {\n              \"type\": \"string\"\n            },\n            \"y\": {\n              \"type\": \"string\"\n            }\n          },\n          \"required\": [\n            \"kty\"\n          ],\n          \"description\": \"Encapsulates a JSON web key type that includes only the public properties that can be used in DID documents.\\n\\nThe private properties are intentionally omitted to discourage the use (and accidental disclosure) of private keys in DID documents.\"\n        },\n        \"ConditionWeightedThreshold\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"condition\": {\n              \"$ref\": \"#/components/schemas/VerificationMethod\"\n            },\n            \"weight\": {\n              \"type\": \"number\"\n            }\n          },\n          \"required\": [\n            \"condition\",\n            \"weight\"\n          ]\n        },\n        \"Service\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"id\": {\n              \"type\": \"string\"\n            },\n            \"type\": {\n              \"type\": \"string\"\n            },\n            \"serviceEndpoint\": {\n              \"anyOf\": [\n                {\n                  \"$ref\": \"#/components/schemas/ServiceEndpoint\"\n                },\n                {\n                  \"type\": \"array\",\n                  \"items\": {\n                    \"$ref\": \"#/components/schemas/ServiceEndpoint\"\n                  }\n                }\n              ]\n            }\n          },\n          \"required\": [\n            \"id\",\n            \"type\",\n            \"serviceEndpoint\"\n          ],\n          \"description\": \"Represents a Service entry in a  {@link https://www.w3.org/TR/did-core/#did-document-properties | DID document } .\"\n        },\n        \"ServiceEndpoint\": {\n          \"anyOf\": [\n            {\n              \"type\": \"string\"\n            },\n            {\n              \"type\": \"object\"\n            }\n          ],\n          \"description\": \"Represents an endpoint of a Service entry in a DID document.\"\n        }\n      },\n      \"methods\": {\n        \"didManagerAddKey\": {\n          \"description\": \"Adds a key to a DID Document\",\n          \"arguments\": {\n            \"$ref\": \"#/components/schemas/IDIDManagerAddKeyArgs\"\n          },\n          \"returnType\": {\n            \"type\": \"object\"\n          }\n        },\n        \"didManagerAddService\": {\n          \"description\": \"Adds a service to a DID Document\",\n          \"arguments\": {\n            \"$ref\": \"#/components/schemas/IDIDManagerAddServiceArgs\"\n          },\n          \"returnType\": {\n            \"type\": \"object\"\n          }\n        },\n        \"didManagerCreate\": {\n          \"description\": \"Creates and returns a new identifier\",\n          \"arguments\": {\n            \"$ref\": \"#/components/schemas/IDIDManagerCreateArgs\"\n          },\n          \"returnType\": {\n            \"$ref\": \"#/components/schemas/IIdentifier\"\n          }\n        },\n        \"didManagerDelete\": {\n          \"description\": \"Deletes identifier\",\n          \"arguments\": {\n            \"$ref\": \"#/components/schemas/IDIDManagerDeleteArgs\"\n          },\n          \"returnType\": {\n            \"type\": \"boolean\"\n          }\n        },\n        \"didManagerFind\": {\n          \"description\": \"Returns a list of managed identifiers\",\n          \"arguments\": {\n            \"$ref\": \"#/components/schemas/IDIDManagerFindArgs\"\n          },\n          \"returnType\": {\n            \"type\": \"array\",\n            \"items\": {\n              \"$ref\": \"#/components/schemas/IIdentifier\"\n            }\n          }\n        },\n        \"didManagerGet\": {\n          \"description\": \"Returns a specific identifier\",\n          \"arguments\": {\n            \"$ref\": \"#/components/schemas/IDIDManagerGetArgs\"\n          },\n          \"returnType\": {\n            \"$ref\": \"#/components/schemas/IIdentifier\"\n          }\n        },\n        \"didManagerGetByAlias\": {\n          \"description\": \"Returns a specific identifier by alias\",\n          \"arguments\": {\n            \"$ref\": \"#/components/schemas/IDIDManagerGetByAliasArgs\"\n          },\n          \"returnType\": {\n            \"$ref\": \"#/components/schemas/IIdentifier\"\n          }\n        },\n        \"didManagerGetOrCreate\": {\n          \"description\": \"Returns an existing identifier or creates a new one for a specific alias\",\n          \"arguments\": {\n            \"$ref\": \"#/components/schemas/IDIDManagerGetOrCreateArgs\"\n          },\n          \"returnType\": {\n            \"$ref\": \"#/components/schemas/IIdentifier\"\n          }\n        },\n        \"didManagerGetProviders\": {\n          \"description\": \"Returns a list of available identifier providers\",\n          \"arguments\": {\n            \"type\": \"object\"\n          },\n          \"returnType\": {\n            \"type\": \"array\",\n            \"items\": {\n              \"type\": \"string\"\n            }\n          }\n        },\n        \"didManagerImport\": {\n          \"description\": \"Imports identifier\",\n          \"arguments\": {\n            \"$ref\": \"#/components/schemas/MinimalImportableIdentifier\"\n          },\n          \"returnType\": {\n            \"$ref\": \"#/components/schemas/IIdentifier\"\n          }\n        },\n        \"didManagerRemoveKey\": {\n          \"description\": \"Removes a key from a DID Document\",\n          \"arguments\": {\n            \"$ref\": \"#/components/schemas/IDIDManagerRemoveKeyArgs\"\n          },\n          \"returnType\": {\n            \"type\": \"object\"\n          }\n        },\n        \"didManagerRemoveService\": {\n          \"description\": \"Removes a service from a DID Document\",\n          \"arguments\": {\n            \"$ref\": \"#/components/schemas/IDIDManagerRemoveServiceArgs\"\n          },\n          \"returnType\": {\n            \"type\": \"object\"\n          }\n        },\n        \"didManagerSetAlias\": {\n          \"description\": \"Sets identifier alias\",\n          \"arguments\": {\n            \"$ref\": \"#/components/schemas/IDIDManagerSetAliasArgs\"\n          },\n          \"returnType\": {\n            \"type\": \"boolean\"\n          }\n        },\n        \"didManagerUpdate\": {\n          \"description\": \"Updates the DID document of a managed \",\n          \"arguments\": {\n            \"$ref\": \"#/components/schemas/IDIDManagerUpdateArgs\"\n          },\n          \"returnType\": {\n            \"$ref\": \"#/components/schemas/IIdentifier\"\n          }\n        }\n      }\n    }\n  },\n  \"IDataStore\": {\n    \"components\": {\n      \"schemas\": {\n        \"IDataStoreDeleteMessageArgs\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"id\": {\n              \"type\": \"string\",\n              \"description\": \"Required. Message ID\"\n            }\n          },\n          \"required\": [\n            \"id\"\n          ],\n          \"description\": \"Input arguments for  {@link IDataStore.dataStoreDeleteMessage | dataStoreDeleteMessage }\"\n        },\n        \"IDataStoreDeleteVerifiableCredentialArgs\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"hash\": {\n              \"type\": \"string\",\n              \"description\": \"Required. VerifiableCredential hash\"\n            }\n          },\n          \"required\": [\n            \"hash\"\n          ],\n          \"description\": \"Input arguments for  {@link IDataStoreDeleteVerifiableCredentialArgs | IDataStoreDeleteVerifiableCredentialArgs }\"\n        },\n        \"IDataStoreGetMessageArgs\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"id\": {\n              \"type\": \"string\",\n              \"description\": \"Required. Message ID\"\n            }\n          },\n          \"required\": [\n            \"id\"\n          ],\n          \"description\": \"Input arguments for  {@link IDataStore.dataStoreGetMessage | dataStoreGetMessage }\"\n        },\n        \"IMessage\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"id\": {\n              \"type\": \"string\",\n              \"description\": \"Unique message ID\"\n            },\n            \"type\": {\n              \"type\": \"string\",\n              \"description\": \"Message type\"\n            },\n            \"createdAt\": {\n              \"type\": \"string\",\n              \"description\": \"Optional. Creation date (ISO 8601)\"\n            },\n            \"expiresAt\": {\n              \"type\": \"string\",\n              \"description\": \"Optional. Expiration date (ISO 8601)\"\n            },\n            \"threadId\": {\n              \"type\": \"string\",\n              \"description\": \"Optional. Thread ID\"\n            },\n            \"raw\": {\n              \"type\": \"string\",\n              \"description\": \"Optional. Original message raw data\"\n            },\n            \"data\": {\n              \"anyOf\": [\n                {\n                  \"type\": \"object\"\n                },\n                {\n                  \"type\": \"null\"\n                }\n              ],\n              \"description\": \"Optional. Parsed data\"\n            },\n            \"replyTo\": {\n              \"type\": \"array\",\n              \"items\": {\n                \"type\": \"string\"\n              },\n              \"description\": \"Optional. List of DIDs to reply to\"\n            },\n            \"replyUrl\": {\n              \"type\": \"string\",\n              \"description\": \"Optional. URL to post a reply message to\"\n            },\n            \"from\": {\n              \"type\": \"string\",\n              \"description\": \"Optional. Sender DID\"\n            },\n            \"to\": {\n              \"type\": \"string\",\n              \"description\": \"Optional. Recipient DID\"\n            },\n            \"metaData\": {\n              \"anyOf\": [\n                {\n                  \"type\": \"array\",\n                  \"items\": {\n                    \"$ref\": \"#/components/schemas/IMetaData\"\n                  }\n                },\n                {\n                  \"type\": \"null\"\n                }\n              ],\n              \"description\": \"Optional. Array of message metadata\"\n            },\n            \"credentials\": {\n              \"type\": \"array\",\n              \"items\": {\n                \"$ref\": \"#/components/schemas/VerifiableCredential\"\n              },\n              \"description\": \"Optional. Array of attached verifiable credentials\"\n            },\n            \"presentations\": {\n              \"type\": \"array\",\n              \"items\": {\n                \"$ref\": \"#/components/schemas/VerifiablePresentation\"\n              },\n              \"description\": \"Optional. Array of attached verifiable presentations\"\n            },\n            \"attachments\": {\n              \"type\": \"array\",\n              \"items\": {\n                \"$ref\": \"#/components/schemas/IMessageAttachment\"\n              },\n              \"description\": \"Optional. Array of generic attachments\"\n            },\n            \"returnRoute\": {\n              \"type\": \"string\",\n              \"description\": \"Optional. Signal how to reuse transport for return messages\"\n            }\n          },\n          \"required\": [\n            \"id\",\n            \"type\"\n          ],\n          \"description\": \"Represents a DIDComm v1 message payload, with optionally decoded credentials and presentations.\"\n        },\n        \"IMetaData\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"type\": {\n              \"type\": \"string\",\n              \"description\": \"Type\"\n            },\n            \"value\": {\n              \"type\": \"string\",\n              \"description\": \"Optional. Value\"\n            }\n          },\n          \"required\": [\n            \"type\"\n          ],\n          \"description\": \"Message meta data\"\n        },\n        \"VerifiableCredential\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"proof\": {\n              \"$ref\": \"#/components/schemas/ProofType\"\n            },\n            \"issuer\": {\n              \"$ref\": \"#/components/schemas/IssuerType\"\n            },\n            \"credentialSubject\": {\n              \"$ref\": \"#/components/schemas/CredentialSubject\"\n            },\n            \"type\": {\n              \"anyOf\": [\n                {\n                  \"type\": \"array\",\n                  \"items\": {\n                    \"type\": \"string\"\n                  }\n                },\n                {\n                  \"type\": \"string\"\n                }\n              ]\n            },\n            \"@context\": {\n              \"$ref\": \"#/components/schemas/ContextType\"\n            },\n            \"issuanceDate\": {\n              \"type\": \"string\"\n            },\n            \"expirationDate\": {\n              \"type\": \"string\"\n            },\n            \"credentialStatus\": {\n              \"$ref\": \"#/components/schemas/CredentialStatusReference\"\n            },\n            \"id\": {\n              \"type\": \"string\"\n            }\n          },\n          \"required\": [\n            \"@context\",\n            \"credentialSubject\",\n            \"issuanceDate\",\n            \"issuer\",\n            \"proof\"\n          ],\n          \"description\": \"Represents a signed Verifiable Credential payload (includes proof), using a JSON representation. See  {@link https://www.w3.org/TR/vc-data-model/#credentials | VC data model }\"\n        },\n        \"ProofType\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"type\": {\n              \"type\": \"string\"\n            },\n            \"proofValue\": {\n              \"type\": \"string\"\n            }\n          },\n          \"description\": \"A proof property of a  {@link  VerifiableCredential }  or  {@link  VerifiablePresentation }\"\n        },\n        \"IssuerType\": {\n          \"anyOf\": [\n            {\n              \"type\": \"object\",\n              \"properties\": {\n                \"id\": {\n                  \"type\": \"string\"\n                }\n              },\n              \"required\": [\n                \"id\"\n              ]\n            },\n            {\n              \"type\": \"string\"\n            }\n          ],\n          \"description\": \"The issuer of a  {@link  VerifiableCredential }  or the holder of a  {@link  VerifiablePresentation } .\\n\\nThe value of the issuer property MUST be either a URI or an object containing an id property. It is RECOMMENDED that the URI in the issuer or its id be one which, if de-referenced, results in a document containing machine-readable information about the issuer that can be used to verify the information expressed in the credential.\\n\\nSee  {@link https://www.w3.org/TR/vc-data-model/#issuer | Issuer data model }\"\n        },\n        \"CredentialSubject\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"id\": {\n              \"type\": \"string\"\n            }\n          },\n          \"description\": \"The value of the credentialSubject property is defined as a set of objects that contain one or more properties that are each related to a subject of the verifiable credential. Each object MAY contain an id.\\n\\nSee  {@link https://www.w3.org/TR/vc-data-model/#credential-subject | Credential Subject }\"\n        },\n        \"ContextType\": {\n          \"anyOf\": [\n            {\n              \"type\": \"string\"\n            },\n            {\n              \"type\": \"object\"\n            },\n            {\n              \"type\": \"array\",\n              \"items\": {\n                \"anyOf\": [\n                  {\n                    \"type\": \"string\"\n                  },\n                  {\n                    \"type\": \"object\"\n                  }\n                ]\n              }\n            }\n          ],\n          \"description\": \"The data type for `@context` properties of credentials, presentations, etc.\"\n        },\n        \"CredentialStatusReference\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"id\": {\n              \"type\": \"string\"\n            },\n            \"type\": {\n              \"type\": \"string\"\n            }\n          },\n          \"required\": [\n            \"id\",\n            \"type\"\n          ],\n          \"description\": \"Used for the discovery of information about the current status of a verifiable credential, such as whether it is suspended or revoked. The precise contents of the credential status information are determined by the specific `credentialStatus` type  definition and vary depending on factors such as whether it is simple to implement or if it is privacy-enhancing.\\n\\nSee  {@link https://www.w3.org/TR/vc-data-model/#status | Credential Status }\"\n        },\n        \"VerifiablePresentation\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"proof\": {\n              \"$ref\": \"#/components/schemas/ProofType\"\n            },\n            \"holder\": {\n              \"type\": \"string\"\n            },\n            \"verifiableCredential\": {\n              \"type\": \"array\",\n              \"items\": {\n                \"$ref\": \"#/components/schemas/W3CVerifiableCredential\"\n              }\n            },\n            \"type\": {\n              \"anyOf\": [\n                {\n                  \"type\": \"array\",\n                  \"items\": {\n                    \"type\": \"string\"\n                  }\n                },\n                {\n                  \"type\": \"string\"\n                }\n              ]\n            },\n            \"@context\": {\n              \"$ref\": \"#/components/schemas/ContextType\"\n            },\n            \"verifier\": {\n              \"type\": \"array\",\n              \"items\": {\n                \"type\": \"string\"\n              }\n            },\n            \"issuanceDate\": {\n              \"type\": \"string\"\n            },\n            \"expirationDate\": {\n              \"type\": \"string\"\n            },\n            \"id\": {\n              \"type\": \"string\"\n            }\n          },\n          \"required\": [\n            \"@context\",\n            \"holder\",\n            \"proof\"\n          ],\n          \"description\": \"Represents a signed Verifiable Presentation (includes proof), using a JSON representation. See  {@link https://www.w3.org/TR/vc-data-model/#presentations | VP data model }\"\n        },\n        \"W3CVerifiableCredential\": {\n          \"anyOf\": [\n            {\n              \"$ref\": \"#/components/schemas/VerifiableCredential\"\n            },\n            {\n              \"$ref\": \"#/components/schemas/CompactJWT\"\n            }\n          ],\n          \"description\": \"Represents a signed Verifiable Credential (includes proof), in either JSON or compact JWT format. See  {@link https://www.w3.org/TR/vc-data-model/#credentials | VC data model }  See  {@link https://www.w3.org/TR/vc-data-model-1.1/#proof-formats | proof formats }\"\n        },\n        \"CompactJWT\": {\n          \"type\": \"string\",\n          \"description\": \"Represents a Json Web Token in compact form. \\\"header.payload.signature\\\"\"\n        },\n        \"IMessageAttachment\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"id\": {\n              \"type\": \"string\"\n            },\n            \"description\": {\n              \"type\": \"string\"\n            },\n            \"filename\": {\n              \"type\": \"string\"\n            },\n            \"media_type\": {\n              \"type\": \"string\"\n            },\n            \"format\": {\n              \"type\": \"string\"\n            },\n            \"lastmod_time\": {\n              \"type\": \"string\"\n            },\n            \"byte_count\": {\n              \"type\": \"number\"\n            },\n            \"data\": {\n              \"$ref\": \"#/components/schemas/IMessageAttachmentData\"\n            }\n          },\n          \"required\": [\n            \"data\"\n          ],\n          \"description\": \"Message attachment\"\n        },\n        \"IMessageAttachmentData\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"jws\": {},\n            \"hash\": {\n              \"type\": \"string\"\n            },\n            \"links\": {\n              \"type\": \"array\",\n              \"items\": {\n                \"type\": \"string\"\n              }\n            },\n            \"base64\": {\n              \"type\": \"string\"\n            },\n            \"json\": {}\n          },\n          \"description\": \"The DIDComm message structure for data in an attachment. See https://identity.foundation/didcomm-messaging/spec/#attachments\"\n        },\n        \"IDataStoreGetVerifiableCredentialArgs\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"hash\": {\n              \"type\": \"string\",\n              \"description\": \"Required. VerifiableCredential hash\"\n            }\n          },\n          \"required\": [\n            \"hash\"\n          ],\n          \"description\": \"Input arguments for  {@link IDataStore.dataStoreGetVerifiableCredential | dataStoreGetVerifiableCredential }\"\n        },\n        \"IDataStoreGetVerifiablePresentationArgs\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"hash\": {\n              \"type\": \"string\",\n              \"description\": \"Required. VerifiablePresentation hash\"\n            }\n          },\n          \"required\": [\n            \"hash\"\n          ],\n          \"description\": \"Input arguments for  {@link IDataStore.dataStoreGetVerifiablePresentation | dataStoreGetVerifiablePresentation }\"\n        },\n        \"IDataStoreSaveMessageArgs\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"message\": {\n              \"$ref\": \"#/components/schemas/IMessage\",\n              \"description\": \"Required. Message\"\n            }\n          },\n          \"required\": [\n            \"message\"\n          ],\n          \"description\": \"Input arguments for  {@link IDataStore.dataStoreSaveMessage | dataStoreSaveMessage }\"\n        },\n        \"IDataStoreSaveVerifiableCredentialArgs\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"verifiableCredential\": {\n              \"$ref\": \"#/components/schemas/VerifiableCredential\",\n              \"description\": \"Required. VerifiableCredential\"\n            }\n          },\n          \"required\": [\n            \"verifiableCredential\"\n          ],\n          \"description\": \"Input arguments for  {@link IDataStore.dataStoreSaveVerifiableCredential | dataStoreSaveVerifiableCredential }\"\n        },\n        \"IDataStoreSaveVerifiablePresentationArgs\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"verifiablePresentation\": {\n              \"$ref\": \"#/components/schemas/VerifiablePresentation\",\n              \"description\": \"Required. VerifiablePresentation\"\n            }\n          },\n          \"required\": [\n            \"verifiablePresentation\"\n          ],\n          \"description\": \"Input arguments for  {@link IDataStore.dataStoreSaveVerifiablePresentation | dataStoreSaveVerifiablePresentation }\"\n        }\n      },\n      \"methods\": {\n        \"dataStoreDeleteMessage\": {\n          \"description\": \"Deletes message from the data store\",\n          \"arguments\": {\n            \"$ref\": \"#/components/schemas/IDataStoreDeleteMessageArgs\"\n          },\n          \"returnType\": {\n            \"type\": \"boolean\"\n          }\n        },\n        \"dataStoreDeleteVerifiableCredential\": {\n          \"description\": \"Deletes verifiable credential from the data store\",\n          \"arguments\": {\n            \"$ref\": \"#/components/schemas/IDataStoreDeleteVerifiableCredentialArgs\"\n          },\n          \"returnType\": {\n            \"type\": \"boolean\"\n          }\n        },\n        \"dataStoreGetMessage\": {\n          \"description\": \"Gets message from the data store\",\n          \"arguments\": {\n            \"$ref\": \"#/components/schemas/IDataStoreGetMessageArgs\"\n          },\n          \"returnType\": {\n            \"$ref\": \"#/components/schemas/IMessage\"\n          }\n        },\n        \"dataStoreGetVerifiableCredential\": {\n          \"description\": \"Gets verifiable credential from the data store\",\n          \"arguments\": {\n            \"$ref\": \"#/components/schemas/IDataStoreGetVerifiableCredentialArgs\"\n          },\n          \"returnType\": {\n            \"$ref\": \"#/components/schemas/VerifiableCredential\"\n          }\n        },\n        \"dataStoreGetVerifiablePresentation\": {\n          \"description\": \"Gets verifiable presentation from the data store\",\n          \"arguments\": {\n            \"$ref\": \"#/components/schemas/IDataStoreGetVerifiablePresentationArgs\"\n          },\n          \"returnType\": {\n            \"$ref\": \"#/components/schemas/VerifiablePresentation\"\n          }\n        },\n        \"dataStoreSaveMessage\": {\n          \"description\": \"Saves message to the data store\",\n          \"arguments\": {\n            \"$ref\": \"#/components/schemas/IDataStoreSaveMessageArgs\"\n          },\n          \"returnType\": {\n            \"type\": \"string\"\n          }\n        },\n        \"dataStoreSaveVerifiableCredential\": {\n          \"description\": \"Saves verifiable credential to the data store\",\n          \"arguments\": {\n            \"$ref\": \"#/components/schemas/IDataStoreSaveVerifiableCredentialArgs\"\n          },\n          \"returnType\": {\n            \"type\": \"string\"\n          }\n        },\n        \"dataStoreSaveVerifiablePresentation\": {\n          \"description\": \"Saves verifiable presentation to the data store\",\n          \"arguments\": {\n            \"$ref\": \"#/components/schemas/IDataStoreSaveVerifiablePresentationArgs\"\n          },\n          \"returnType\": {\n            \"type\": \"string\"\n          }\n        }\n      }\n    }\n  },\n  \"IDataStoreORM\": {\n    \"components\": {\n      \"schemas\": {\n        \"FindIdentifiersArgs\": {\n          \"$ref\": \"#/components/schemas/FindArgs-TIdentifiersColumns\",\n          \"description\": \"The filter that can be used to find  {@link  IIdentifier } s in the data store.\"\n        },\n        \"FindArgs-TIdentifiersColumns\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"where\": {\n              \"type\": \"array\",\n              \"items\": {\n                \"$ref\": \"#/components/schemas/Where-TIdentifiersColumns\"\n              },\n              \"description\": \"Imposes constraints on the values of the given columns. WHERE clauses are combined using AND.\"\n            },\n            \"order\": {\n              \"type\": \"array\",\n              \"items\": {\n                \"$ref\": \"#/components/schemas/Order-TIdentifiersColumns\"\n              },\n              \"description\": \"Sorts the results according to the given array of column priorities.\"\n            },\n            \"skip\": {\n              \"type\": \"number\",\n              \"description\": \"Ignores the first number of entries in a  {@link  IDataStoreORM }  query result.\"\n            },\n            \"take\": {\n              \"type\": \"number\",\n              \"description\": \"Returns at most this number of results from a  {@link  IDataStoreORM }  query.\"\n            }\n          },\n          \"description\": \"Represents an  {@link  IDataStoreORM }  Query.\"\n        },\n        \"Where-TIdentifiersColumns\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"column\": {\n              \"$ref\": \"#/components/schemas/TIdentifiersColumns\"\n            },\n            \"value\": {\n              \"type\": \"array\",\n              \"items\": {\n                \"type\": \"string\"\n              }\n            },\n            \"not\": {\n              \"type\": \"boolean\"\n            },\n            \"op\": {\n              \"type\": \"string\",\n              \"enum\": [\n                \"LessThan\",\n                \"LessThanOrEqual\",\n                \"MoreThan\",\n                \"MoreThanOrEqual\",\n                \"Equal\",\n                \"Like\",\n                \"Between\",\n                \"In\",\n                \"Any\",\n                \"IsNull\"\n              ]\n            }\n          },\n          \"required\": [\n            \"column\"\n          ],\n          \"description\": \"Represents a WHERE predicate for a  {@link  FindArgs }  query. In situations where multiple WHERE predicates are present, they are combined with AND.\"\n        },\n        \"TIdentifiersColumns\": {\n          \"type\": \"string\",\n          \"enum\": [\n            \"did\",\n            \"alias\",\n            \"provider\"\n          ],\n          \"description\": \"The columns that can be queried for an  {@link  IIdentifier }\",\n          \"deprecated\": \"This type will be removed in future versions of this plugin interface.\"\n        },\n        \"Order-TIdentifiersColumns\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"column\": {\n              \"$ref\": \"#/components/schemas/TIdentifiersColumns\"\n            },\n            \"direction\": {\n              \"type\": \"string\",\n              \"enum\": [\n                \"ASC\",\n                \"DESC\"\n              ]\n            }\n          },\n          \"required\": [\n            \"column\",\n            \"direction\"\n          ],\n          \"description\": \"Represents the sort order of results from a  {@link  FindArgs }  query.\"\n        },\n        \"PartialIdentifier\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"did\": {\n              \"type\": \"string\",\n              \"description\": \"Decentralized identifier\"\n            },\n            \"alias\": {\n              \"type\": \"string\",\n              \"description\": \"Optional. Identifier alias. Can be used to reference an object in an external system\"\n            },\n            \"provider\": {\n              \"type\": \"string\",\n              \"description\": \"Identifier provider name\"\n            },\n            \"controllerKeyId\": {\n              \"type\": \"string\",\n              \"description\": \"Controller key id\"\n            },\n            \"keys\": {\n              \"type\": \"array\",\n              \"items\": {\n                \"$ref\": \"#/components/schemas/IKey\"\n              },\n              \"description\": \"Array of managed keys\"\n            },\n            \"services\": {\n              \"type\": \"array\",\n              \"items\": {\n                \"$ref\": \"#/components/schemas/IService\"\n              },\n              \"description\": \"Array of services\"\n            }\n          },\n          \"description\": \"The result of a  {@link  IDataStoreORM.dataStoreORMGetIdentifiers }  query.\"\n        },\n        \"IKey\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"kid\": {\n              \"type\": \"string\",\n              \"description\": \"Key ID\"\n            },\n            \"kms\": {\n              \"type\": \"string\",\n              \"description\": \"Key Management System\"\n            },\n            \"type\": {\n              \"$ref\": \"#/components/schemas/TKeyType\",\n              \"description\": \"Key type\"\n            },\n            \"publicKeyHex\": {\n              \"type\": \"string\",\n              \"description\": \"Public key\"\n            },\n            \"privateKeyHex\": {\n              \"type\": \"string\",\n              \"description\": \"Optional. Private key\"\n            },\n            \"meta\": {\n              \"anyOf\": [\n                {\n                  \"$ref\": \"#/components/schemas/KeyMetadata\"\n                },\n                {\n                  \"type\": \"null\"\n                }\n              ],\n              \"description\": \"Optional. Key metadata. This should be used to determine which algorithms are supported.\"\n            }\n          },\n          \"required\": [\n            \"kid\",\n            \"kms\",\n            \"type\",\n            \"publicKeyHex\"\n          ],\n          \"description\": \"Cryptographic key, usually managed by the current Veramo instance.\"\n        },\n        \"TKeyType\": {\n          \"type\": \"string\",\n          \"description\": \"Cryptographic key type.\"\n        },\n        \"KeyMetadata\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"algorithms\": {\n              \"type\": \"array\",\n              \"items\": {\n                \"$ref\": \"#/components/schemas/TAlg\"\n              }\n            }\n          },\n          \"description\": \"This encapsulates data about a key.\\n\\nImplementations of  {@link  @veramo/key-manager#AbstractKeyManagementSystem | AbstractKeyManagementSystem }  should populate this object, for each key, with the algorithms that can be performed using it.\\n\\nThis can also be used to add various tags to the keys under management.\"\n        },\n        \"TAlg\": {\n          \"type\": \"string\",\n          \"description\": \"Known algorithms supported by some of the above key types defined by  {@link  TKeyType } .\\n\\nActual implementations of  {@link  @veramo/key-manager#AbstractKeyManagementSystem | Key Management Systems }  can support more. One should check the  {@link IKey.meta | IKey.meta.algorithms }  property to see what is possible for a particular managed key.\"\n        },\n        \"IService\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"id\": {\n              \"type\": \"string\",\n              \"description\": \"ID\"\n            },\n            \"type\": {\n              \"type\": \"string\",\n              \"description\": \"Service type\"\n            },\n            \"serviceEndpoint\": {\n              \"anyOf\": [\n                {\n                  \"$ref\": \"#/components/schemas/IServiceEndpoint\"\n                },\n                {\n                  \"type\": \"array\",\n                  \"items\": {\n                    \"$ref\": \"#/components/schemas/IServiceEndpoint\"\n                  }\n                }\n              ],\n              \"description\": \"Endpoint URL\"\n            },\n            \"description\": {\n              \"type\": \"string\",\n              \"description\": \"Optional. Description\"\n            }\n          },\n          \"required\": [\n            \"id\",\n            \"type\",\n            \"serviceEndpoint\"\n          ],\n          \"description\": \"Identifier service\"\n        },\n        \"IServiceEndpoint\": {\n          \"anyOf\": [\n            {\n              \"type\": \"string\"\n            },\n            {\n              \"type\": \"object\"\n            }\n          ],\n          \"description\": \"Represents a service endpoint URL or a map of URLs\"\n        },\n        \"FindMessagesArgs\": {\n          \"$ref\": \"#/components/schemas/FindArgs-TMessageColumns\",\n          \"description\": \"The filter that can be used to find  {@link  IMessage } s in the data store. See  {@link  IDataStoreORM.dataStoreORMGetMessages }\"\n        },\n        \"FindArgs-TMessageColumns\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"where\": {\n              \"type\": \"array\",\n              \"items\": {\n                \"$ref\": \"#/components/schemas/Where-TMessageColumns\"\n              },\n              \"description\": \"Imposes constraints on the values of the given columns. WHERE clauses are combined using AND.\"\n            },\n            \"order\": {\n              \"type\": \"array\",\n              \"items\": {\n                \"$ref\": \"#/components/schemas/Order-TMessageColumns\"\n              },\n              \"description\": \"Sorts the results according to the given array of column priorities.\"\n            },\n            \"skip\": {\n              \"type\": \"number\",\n              \"description\": \"Ignores the first number of entries in a  {@link  IDataStoreORM }  query result.\"\n            },\n            \"take\": {\n              \"type\": \"number\",\n              \"description\": \"Returns at most this number of results from a  {@link  IDataStoreORM }  query.\"\n            }\n          },\n          \"description\": \"Represents an  {@link  IDataStoreORM }  Query.\"\n        },\n        \"Where-TMessageColumns\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"column\": {\n              \"$ref\": \"#/components/schemas/TMessageColumns\"\n            },\n            \"value\": {\n              \"type\": \"array\",\n              \"items\": {\n                \"type\": \"string\"\n              }\n            },\n            \"not\": {\n              \"type\": \"boolean\"\n            },\n            \"op\": {\n              \"type\": \"string\",\n              \"enum\": [\n                \"LessThan\",\n                \"LessThanOrEqual\",\n                \"MoreThan\",\n                \"MoreThanOrEqual\",\n                \"Equal\",\n                \"Like\",\n                \"Between\",\n                \"In\",\n                \"Any\",\n                \"IsNull\"\n              ]\n            }\n          },\n          \"required\": [\n            \"column\"\n          ],\n          \"description\": \"Represents a WHERE predicate for a  {@link  FindArgs }  query. In situations where multiple WHERE predicates are present, they are combined with AND.\"\n        },\n        \"TMessageColumns\": {\n          \"type\": \"string\",\n          \"enum\": [\n            \"from\",\n            \"to\",\n            \"id\",\n            \"createdAt\",\n            \"expiresAt\",\n            \"threadId\",\n            \"type\",\n            \"raw\",\n            \"replyTo\",\n            \"replyUrl\"\n          ],\n          \"description\": \"The columns that can be queried for an  {@link  IMessage } \\n\\nSee  {@link  IDataStoreORM.dataStoreORMGetMessagesCount }\"\n        },\n        \"Order-TMessageColumns\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"column\": {\n              \"$ref\": \"#/components/schemas/TMessageColumns\"\n            },\n            \"direction\": {\n              \"type\": \"string\",\n              \"enum\": [\n                \"ASC\",\n                \"DESC\"\n              ]\n            }\n          },\n          \"required\": [\n            \"column\",\n            \"direction\"\n          ],\n          \"description\": \"Represents the sort order of results from a  {@link  FindArgs }  query.\"\n        },\n        \"IMessage\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"id\": {\n              \"type\": \"string\",\n              \"description\": \"Unique message ID\"\n            },\n            \"type\": {\n              \"type\": \"string\",\n              \"description\": \"Message type\"\n            },\n            \"createdAt\": {\n              \"type\": \"string\",\n              \"description\": \"Optional. Creation date (ISO 8601)\"\n            },\n            \"expiresAt\": {\n              \"type\": \"string\",\n              \"description\": \"Optional. Expiration date (ISO 8601)\"\n            },\n            \"threadId\": {\n              \"type\": \"string\",\n              \"description\": \"Optional. Thread ID\"\n            },\n            \"raw\": {\n              \"type\": \"string\",\n              \"description\": \"Optional. Original message raw data\"\n            },\n            \"data\": {\n              \"anyOf\": [\n                {\n                  \"type\": \"object\"\n                },\n                {\n                  \"type\": \"null\"\n                }\n              ],\n              \"description\": \"Optional. Parsed data\"\n            },\n            \"replyTo\": {\n              \"type\": \"array\",\n              \"items\": {\n                \"type\": \"string\"\n              },\n              \"description\": \"Optional. List of DIDs to reply to\"\n            },\n            \"replyUrl\": {\n              \"type\": \"string\",\n              \"description\": \"Optional. URL to post a reply message to\"\n            },\n            \"from\": {\n              \"type\": \"string\",\n              \"description\": \"Optional. Sender DID\"\n            },\n            \"to\": {\n              \"type\": \"string\",\n              \"description\": \"Optional. Recipient DID\"\n            },\n            \"metaData\": {\n              \"anyOf\": [\n                {\n                  \"type\": \"array\",\n                  \"items\": {\n                    \"$ref\": \"#/components/schemas/IMetaData\"\n                  }\n                },\n                {\n                  \"type\": \"null\"\n                }\n              ],\n              \"description\": \"Optional. Array of message metadata\"\n            },\n            \"credentials\": {\n              \"type\": \"array\",\n              \"items\": {\n                \"$ref\": \"#/components/schemas/VerifiableCredential\"\n              },\n              \"description\": \"Optional. Array of attached verifiable credentials\"\n            },\n            \"presentations\": {\n              \"type\": \"array\",\n              \"items\": {\n                \"$ref\": \"#/components/schemas/VerifiablePresentation\"\n              },\n              \"description\": \"Optional. Array of attached verifiable presentations\"\n            },\n            \"attachments\": {\n              \"type\": \"array\",\n              \"items\": {\n                \"$ref\": \"#/components/schemas/IMessageAttachment\"\n              },\n              \"description\": \"Optional. Array of generic attachments\"\n            },\n            \"returnRoute\": {\n              \"type\": \"string\",\n              \"description\": \"Optional. Signal how to reuse transport for return messages\"\n            }\n          },\n          \"required\": [\n            \"id\",\n            \"type\"\n          ],\n          \"description\": \"Represents a DIDComm v1 message payload, with optionally decoded credentials and presentations.\"\n        },\n        \"IMetaData\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"type\": {\n              \"type\": \"string\",\n              \"description\": \"Type\"\n            },\n            \"value\": {\n              \"type\": \"string\",\n              \"description\": \"Optional. Value\"\n            }\n          },\n          \"required\": [\n            \"type\"\n          ],\n          \"description\": \"Message meta data\"\n        },\n        \"VerifiableCredential\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"proof\": {\n              \"$ref\": \"#/components/schemas/ProofType\"\n            },\n            \"issuer\": {\n              \"$ref\": \"#/components/schemas/IssuerType\"\n            },\n            \"credentialSubject\": {\n              \"$ref\": \"#/components/schemas/CredentialSubject\"\n            },\n            \"type\": {\n              \"anyOf\": [\n                {\n                  \"type\": \"array\",\n                  \"items\": {\n                    \"type\": \"string\"\n                  }\n                },\n                {\n                  \"type\": \"string\"\n                }\n              ]\n            },\n            \"@context\": {\n              \"$ref\": \"#/components/schemas/ContextType\"\n            },\n            \"issuanceDate\": {\n              \"type\": \"string\"\n            },\n            \"expirationDate\": {\n              \"type\": \"string\"\n            },\n            \"credentialStatus\": {\n              \"$ref\": \"#/components/schemas/CredentialStatusReference\"\n            },\n            \"id\": {\n              \"type\": \"string\"\n            }\n          },\n          \"required\": [\n            \"@context\",\n            \"credentialSubject\",\n            \"issuanceDate\",\n            \"issuer\",\n            \"proof\"\n          ],\n          \"description\": \"Represents a signed Verifiable Credential payload (includes proof), using a JSON representation. See  {@link https://www.w3.org/TR/vc-data-model/#credentials | VC data model }\"\n        },\n        \"ProofType\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"type\": {\n              \"type\": \"string\"\n            },\n            \"proofValue\": {\n              \"type\": \"string\"\n            }\n          },\n          \"description\": \"A proof property of a  {@link  VerifiableCredential }  or  {@link  VerifiablePresentation }\"\n        },\n        \"IssuerType\": {\n          \"anyOf\": [\n            {\n              \"type\": \"object\",\n              \"properties\": {\n                \"id\": {\n                  \"type\": \"string\"\n                }\n              },\n              \"required\": [\n                \"id\"\n              ]\n            },\n            {\n              \"type\": \"string\"\n            }\n          ],\n          \"description\": \"The issuer of a  {@link  VerifiableCredential }  or the holder of a  {@link  VerifiablePresentation } .\\n\\nThe value of the issuer property MUST be either a URI or an object containing an id property. It is RECOMMENDED that the URI in the issuer or its id be one which, if de-referenced, results in a document containing machine-readable information about the issuer that can be used to verify the information expressed in the credential.\\n\\nSee  {@link https://www.w3.org/TR/vc-data-model/#issuer | Issuer data model }\"\n        },\n        \"CredentialSubject\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"id\": {\n              \"type\": \"string\"\n            }\n          },\n          \"description\": \"The value of the credentialSubject property is defined as a set of objects that contain one or more properties that are each related to a subject of the verifiable credential. Each object MAY contain an id.\\n\\nSee  {@link https://www.w3.org/TR/vc-data-model/#credential-subject | Credential Subject }\"\n        },\n        \"ContextType\": {\n          \"anyOf\": [\n            {\n              \"type\": \"string\"\n            },\n            {\n              \"type\": \"object\"\n            },\n            {\n              \"type\": \"array\",\n              \"items\": {\n                \"anyOf\": [\n                  {\n                    \"type\": \"string\"\n                  },\n                  {\n                    \"type\": \"object\"\n                  }\n                ]\n              }\n            }\n          ],\n          \"description\": \"The data type for `@context` properties of credentials, presentations, etc.\"\n        },\n        \"CredentialStatusReference\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"id\": {\n              \"type\": \"string\"\n            },\n            \"type\": {\n              \"type\": \"string\"\n            }\n          },\n          \"required\": [\n            \"id\",\n            \"type\"\n          ],\n          \"description\": \"Used for the discovery of information about the current status of a verifiable credential, such as whether it is suspended or revoked. The precise contents of the credential status information are determined by the specific `credentialStatus` type  definition and vary depending on factors such as whether it is simple to implement or if it is privacy-enhancing.\\n\\nSee  {@link https://www.w3.org/TR/vc-data-model/#status | Credential Status }\"\n        },\n        \"VerifiablePresentation\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"proof\": {\n              \"$ref\": \"#/components/schemas/ProofType\"\n            },\n            \"holder\": {\n              \"type\": \"string\"\n            },\n            \"verifiableCredential\": {\n              \"type\": \"array\",\n              \"items\": {\n                \"$ref\": \"#/components/schemas/W3CVerifiableCredential\"\n              }\n            },\n            \"type\": {\n              \"anyOf\": [\n                {\n                  \"type\": \"array\",\n                  \"items\": {\n                    \"type\": \"string\"\n                  }\n                },\n                {\n                  \"type\": \"string\"\n                }\n              ]\n            },\n            \"@context\": {\n              \"$ref\": \"#/components/schemas/ContextType\"\n            },\n            \"verifier\": {\n              \"type\": \"array\",\n              \"items\": {\n                \"type\": \"string\"\n              }\n            },\n            \"issuanceDate\": {\n              \"type\": \"string\"\n            },\n            \"expirationDate\": {\n              \"type\": \"string\"\n            },\n            \"id\": {\n              \"type\": \"string\"\n            }\n          },\n          \"required\": [\n            \"@context\",\n            \"holder\",\n            \"proof\"\n          ],\n          \"description\": \"Represents a signed Verifiable Presentation (includes proof), using a JSON representation. See  {@link https://www.w3.org/TR/vc-data-model/#presentations | VP data model }\"\n        },\n        \"W3CVerifiableCredential\": {\n          \"anyOf\": [\n            {\n              \"$ref\": \"#/components/schemas/VerifiableCredential\"\n            },\n            {\n              \"$ref\": \"#/components/schemas/CompactJWT\"\n            }\n          ],\n          \"description\": \"Represents a signed Verifiable Credential (includes proof), in either JSON or compact JWT format. See  {@link https://www.w3.org/TR/vc-data-model/#credentials | VC data model }  See  {@link https://www.w3.org/TR/vc-data-model-1.1/#proof-formats | proof formats }\"\n        },\n        \"CompactJWT\": {\n          \"type\": \"string\",\n          \"description\": \"Represents a Json Web Token in compact form. \\\"header.payload.signature\\\"\"\n        },\n        \"IMessageAttachment\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"id\": {\n              \"type\": \"string\"\n            },\n            \"description\": {\n              \"type\": \"string\"\n            },\n            \"filename\": {\n              \"type\": \"string\"\n            },\n            \"media_type\": {\n              \"type\": \"string\"\n            },\n            \"format\": {\n              \"type\": \"string\"\n            },\n            \"lastmod_time\": {\n              \"type\": \"string\"\n            },\n            \"byte_count\": {\n              \"type\": \"number\"\n            },\n            \"data\": {\n              \"$ref\": \"#/components/schemas/IMessageAttachmentData\"\n            }\n          },\n          \"required\": [\n            \"data\"\n          ],\n          \"description\": \"Message attachment\"\n        },\n        \"IMessageAttachmentData\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"jws\": {},\n            \"hash\": {\n              \"type\": \"string\"\n            },\n            \"links\": {\n              \"type\": \"array\",\n              \"items\": {\n                \"type\": \"string\"\n              }\n            },\n            \"base64\": {\n              \"type\": \"string\"\n            },\n            \"json\": {}\n          },\n          \"description\": \"The DIDComm message structure for data in an attachment. See https://identity.foundation/didcomm-messaging/spec/#attachments\"\n        },\n        \"FindCredentialsArgs\": {\n          \"$ref\": \"#/components/schemas/FindArgs-TCredentialColumns\",\n          \"description\": \"The filter that can be used to find  {@link  VerifiableCredential } s in the data store. See  {@link  IDataStoreORM.dataStoreORMGetVerifiableCredentials }\"\n        },\n        \"FindArgs-TCredentialColumns\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"where\": {\n              \"type\": \"array\",\n              \"items\": {\n                \"$ref\": \"#/components/schemas/Where-TCredentialColumns\"\n              },\n              \"description\": \"Imposes constraints on the values of the given columns. WHERE clauses are combined using AND.\"\n            },\n            \"order\": {\n              \"type\": \"array\",\n              \"items\": {\n                \"$ref\": \"#/components/schemas/Order-TCredentialColumns\"\n              },\n              \"description\": \"Sorts the results according to the given array of column priorities.\"\n            },\n            \"skip\": {\n              \"type\": \"number\",\n              \"description\": \"Ignores the first number of entries in a  {@link  IDataStoreORM }  query result.\"\n            },\n            \"take\": {\n              \"type\": \"number\",\n              \"description\": \"Returns at most this number of results from a  {@link  IDataStoreORM }  query.\"\n            }\n          },\n          \"description\": \"Represents an  {@link  IDataStoreORM }  Query.\"\n        },\n        \"Where-TCredentialColumns\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"column\": {\n              \"$ref\": \"#/components/schemas/TCredentialColumns\"\n            },\n            \"value\": {\n              \"type\": \"array\",\n              \"items\": {\n                \"type\": \"string\"\n              }\n            },\n            \"not\": {\n              \"type\": \"boolean\"\n            },\n            \"op\": {\n              \"type\": \"string\",\n              \"enum\": [\n                \"LessThan\",\n                \"LessThanOrEqual\",\n                \"MoreThan\",\n                \"MoreThanOrEqual\",\n                \"Equal\",\n                \"Like\",\n                \"Between\",\n                \"In\",\n                \"Any\",\n                \"IsNull\"\n              ]\n            }\n          },\n          \"required\": [\n            \"column\"\n          ],\n          \"description\": \"Represents a WHERE predicate for a  {@link  FindArgs }  query. In situations where multiple WHERE predicates are present, they are combined with AND.\"\n        },\n        \"TCredentialColumns\": {\n          \"type\": \"string\",\n          \"enum\": [\n            \"context\",\n            \"type\",\n            \"id\",\n            \"issuer\",\n            \"subject\",\n            \"expirationDate\",\n            \"issuanceDate\",\n            \"hash\"\n          ],\n          \"description\": \"The columns that can be searched for a  {@link  VerifiableCredential } \\n\\nSee  {@link  IDataStoreORM.dataStoreORMGetVerifiableCredentials }  See  {@link  IDataStoreORM.dataStoreORMGetVerifiableCredentialsCount }\"\n        },\n        \"Order-TCredentialColumns\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"column\": {\n              \"$ref\": \"#/components/schemas/TCredentialColumns\"\n            },\n            \"direction\": {\n              \"type\": \"string\",\n              \"enum\": [\n                \"ASC\",\n                \"DESC\"\n              ]\n            }\n          },\n          \"required\": [\n            \"column\",\n            \"direction\"\n          ],\n          \"description\": \"Represents the sort order of results from a  {@link  FindArgs }  query.\"\n        },\n        \"UniqueVerifiableCredential\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"hash\": {\n              \"type\": \"string\"\n            },\n            \"verifiableCredential\": {\n              \"$ref\": \"#/components/schemas/VerifiableCredential\"\n            }\n          },\n          \"required\": [\n            \"hash\",\n            \"verifiableCredential\"\n          ],\n          \"description\": \"Represents the result of a Query for  {@link  VerifiableCredential } s\\n\\nSee  {@link  IDataStoreORM.dataStoreORMGetVerifiableCredentials }  See  {@link  IDataStoreORM.dataStoreORMGetVerifiableCredentialsByClaims }\"\n        },\n        \"FindClaimsArgs\": {\n          \"$ref\": \"#/components/schemas/FindArgs-TClaimsColumns\",\n          \"description\": \"The filter that can be used to find  {@link  VerifiableCredential } s in the data store, based on the types and values of their claims.\\n\\nSee  {@link  IDataStoreORM.dataStoreORMGetVerifiableCredentialsByClaims }\"\n        },\n        \"FindArgs-TClaimsColumns\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"where\": {\n              \"type\": \"array\",\n              \"items\": {\n                \"$ref\": \"#/components/schemas/Where-TClaimsColumns\"\n              },\n              \"description\": \"Imposes constraints on the values of the given columns. WHERE clauses are combined using AND.\"\n            },\n            \"order\": {\n              \"type\": \"array\",\n              \"items\": {\n                \"$ref\": \"#/components/schemas/Order-TClaimsColumns\"\n              },\n              \"description\": \"Sorts the results according to the given array of column priorities.\"\n            },\n            \"skip\": {\n              \"type\": \"number\",\n              \"description\": \"Ignores the first number of entries in a  {@link  IDataStoreORM }  query result.\"\n            },\n            \"take\": {\n              \"type\": \"number\",\n              \"description\": \"Returns at most this number of results from a  {@link  IDataStoreORM }  query.\"\n            }\n          },\n          \"description\": \"Represents an  {@link  IDataStoreORM }  Query.\"\n        },\n        \"Where-TClaimsColumns\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"column\": {\n              \"$ref\": \"#/components/schemas/TClaimsColumns\"\n            },\n            \"value\": {\n              \"type\": \"array\",\n              \"items\": {\n                \"type\": \"string\"\n              }\n            },\n            \"not\": {\n              \"type\": \"boolean\"\n            },\n            \"op\": {\n              \"type\": \"string\",\n              \"enum\": [\n                \"LessThan\",\n                \"LessThanOrEqual\",\n                \"MoreThan\",\n                \"MoreThanOrEqual\",\n                \"Equal\",\n                \"Like\",\n                \"Between\",\n                \"In\",\n                \"Any\",\n                \"IsNull\"\n              ]\n            }\n          },\n          \"required\": [\n            \"column\"\n          ],\n          \"description\": \"Represents a WHERE predicate for a  {@link  FindArgs }  query. In situations where multiple WHERE predicates are present, they are combined with AND.\"\n        },\n        \"TClaimsColumns\": {\n          \"type\": \"string\",\n          \"enum\": [\n            \"context\",\n            \"credentialType\",\n            \"type\",\n            \"value\",\n            \"isObj\",\n            \"id\",\n            \"issuer\",\n            \"subject\",\n            \"expirationDate\",\n            \"issuanceDate\"\n          ],\n          \"description\": \"The columns that can be searched for the claims of a  {@link  VerifiableCredential } \\n\\nSee  {@link  IDataStoreORM.dataStoreORMGetVerifiableCredentialsByClaims }  See  {@link  IDataStoreORM.dataStoreORMGetVerifiableCredentialsByClaimsCount }\"\n        },\n        \"Order-TClaimsColumns\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"column\": {\n              \"$ref\": \"#/components/schemas/TClaimsColumns\"\n            },\n            \"direction\": {\n              \"type\": \"string\",\n              \"enum\": [\n                \"ASC\",\n                \"DESC\"\n              ]\n            }\n          },\n          \"required\": [\n            \"column\",\n            \"direction\"\n          ],\n          \"description\": \"Represents the sort order of results from a  {@link  FindArgs }  query.\"\n        },\n        \"FindPresentationsArgs\": {\n          \"$ref\": \"#/components/schemas/FindArgs-TPresentationColumns\",\n          \"description\": \"The filter that can be used to find  {@link  VerifiablePresentation } s in the data store. See  {@link  IDataStoreORM.dataStoreORMGetVerifiablePresentations }\"\n        },\n        \"FindArgs-TPresentationColumns\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"where\": {\n              \"type\": \"array\",\n              \"items\": {\n                \"$ref\": \"#/components/schemas/Where-TPresentationColumns\"\n              },\n              \"description\": \"Imposes constraints on the values of the given columns. WHERE clauses are combined using AND.\"\n            },\n            \"order\": {\n              \"type\": \"array\",\n              \"items\": {\n                \"$ref\": \"#/components/schemas/Order-TPresentationColumns\"\n              },\n              \"description\": \"Sorts the results according to the given array of column priorities.\"\n            },\n            \"skip\": {\n              \"type\": \"number\",\n              \"description\": \"Ignores the first number of entries in a  {@link  IDataStoreORM }  query result.\"\n            },\n            \"take\": {\n              \"type\": \"number\",\n              \"description\": \"Returns at most this number of results from a  {@link  IDataStoreORM }  query.\"\n            }\n          },\n          \"description\": \"Represents an  {@link  IDataStoreORM }  Query.\"\n        },\n        \"Where-TPresentationColumns\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"column\": {\n              \"$ref\": \"#/components/schemas/TPresentationColumns\"\n            },\n            \"value\": {\n              \"type\": \"array\",\n              \"items\": {\n                \"type\": \"string\"\n              }\n            },\n            \"not\": {\n              \"type\": \"boolean\"\n            },\n            \"op\": {\n              \"type\": \"string\",\n              \"enum\": [\n                \"LessThan\",\n                \"LessThanOrEqual\",\n                \"MoreThan\",\n                \"MoreThanOrEqual\",\n                \"Equal\",\n                \"Like\",\n                \"Between\",\n                \"In\",\n                \"Any\",\n                \"IsNull\"\n              ]\n            }\n          },\n          \"required\": [\n            \"column\"\n          ],\n          \"description\": \"Represents a WHERE predicate for a  {@link  FindArgs }  query. In situations where multiple WHERE predicates are present, they are combined with AND.\"\n        },\n        \"TPresentationColumns\": {\n          \"type\": \"string\",\n          \"enum\": [\n            \"context\",\n            \"type\",\n            \"id\",\n            \"holder\",\n            \"verifier\",\n            \"expirationDate\",\n            \"issuanceDate\"\n          ],\n          \"description\": \"The columns that can be searched for a  {@link  VerifiablePresentation } \\n\\nSee  {@link  IDataStoreORM.dataStoreORMGetVerifiablePresentations }  See  {@link  IDataStoreORM.dataStoreORMGetVerifiablePresentationsCount }\"\n        },\n        \"Order-TPresentationColumns\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"column\": {\n              \"$ref\": \"#/components/schemas/TPresentationColumns\"\n            },\n            \"direction\": {\n              \"type\": \"string\",\n              \"enum\": [\n                \"ASC\",\n                \"DESC\"\n              ]\n            }\n          },\n          \"required\": [\n            \"column\",\n            \"direction\"\n          ],\n          \"description\": \"Represents the sort order of results from a  {@link  FindArgs }  query.\"\n        },\n        \"UniqueVerifiablePresentation\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"hash\": {\n              \"type\": \"string\"\n            },\n            \"verifiablePresentation\": {\n              \"$ref\": \"#/components/schemas/VerifiablePresentation\"\n            }\n          },\n          \"required\": [\n            \"hash\",\n            \"verifiablePresentation\"\n          ],\n          \"description\": \"Represents the result of a Query for  {@link  VerifiablePresentation } s\\n\\nSee  {@link  IDataStoreORM.dataStoreORMGetVerifiablePresentations }\"\n        }\n      },\n      \"methods\": {\n        \"dataStoreORMGetIdentifiers\": {\n          \"description\": \"Tries to obtain a list of \",\n          \"arguments\": {\n            \"$ref\": \"#/components/schemas/FindIdentifiersArgs\"\n          },\n          \"returnType\": {\n            \"type\": \"array\",\n            \"items\": {\n              \"$ref\": \"#/components/schemas/PartialIdentifier\"\n            }\n          }\n        },\n        \"dataStoreORMGetIdentifiersCount\": {\n          \"description\": \"Tries to obtain a count of \",\n          \"arguments\": {\n            \"$ref\": \"#/components/schemas/FindIdentifiersArgs\"\n          },\n          \"returnType\": {\n            \"type\": \"number\"\n          }\n        },\n        \"dataStoreORMGetMessages\": {\n          \"description\": \"Returns a list of \",\n          \"arguments\": {\n            \"$ref\": \"#/components/schemas/FindMessagesArgs\"\n          },\n          \"returnType\": {\n            \"type\": \"array\",\n            \"items\": {\n              \"$ref\": \"#/components/schemas/IMessage\"\n            }\n          }\n        },\n        \"dataStoreORMGetMessagesCount\": {\n          \"description\": \"Returns a count of \",\n          \"arguments\": {\n            \"$ref\": \"#/components/schemas/FindMessagesArgs\"\n          },\n          \"returnType\": {\n            \"type\": \"number\"\n          }\n        },\n        \"dataStoreORMGetVerifiableCredentials\": {\n          \"description\": \"Returns a list of \",\n          \"arguments\": {\n            \"$ref\": \"#/components/schemas/FindCredentialsArgs\"\n          },\n          \"returnType\": {\n            \"type\": \"array\",\n            \"items\": {\n              \"$ref\": \"#/components/schemas/UniqueVerifiableCredential\"\n            }\n          }\n        },\n        \"dataStoreORMGetVerifiableCredentialsByClaims\": {\n          \"description\": \"Returns a list of \",\n          \"arguments\": {\n            \"$ref\": \"#/components/schemas/FindClaimsArgs\"\n          },\n          \"returnType\": {\n            \"type\": \"array\",\n            \"items\": {\n              \"$ref\": \"#/components/schemas/UniqueVerifiableCredential\"\n            }\n          }\n        },\n        \"dataStoreORMGetVerifiableCredentialsByClaimsCount\": {\n          \"description\": \"Returns a count of \",\n          \"arguments\": {\n            \"$ref\": \"#/components/schemas/FindClaimsArgs\"\n          },\n          \"returnType\": {\n            \"type\": \"number\"\n          }\n        },\n        \"dataStoreORMGetVerifiableCredentialsCount\": {\n          \"description\": \"Returns a count of \",\n          \"arguments\": {\n            \"$ref\": \"#/components/schemas/FindCredentialsArgs\"\n          },\n          \"returnType\": {\n            \"type\": \"number\"\n          }\n        },\n        \"dataStoreORMGetVerifiablePresentations\": {\n          \"description\": \"Returns a list of \",\n          \"arguments\": {\n            \"$ref\": \"#/components/schemas/FindPresentationsArgs\"\n          },\n          \"returnType\": {\n            \"type\": \"array\",\n            \"items\": {\n              \"$ref\": \"#/components/schemas/UniqueVerifiablePresentation\"\n            }\n          }\n        },\n        \"dataStoreORMGetVerifiablePresentationsCount\": {\n          \"description\": \"Returns a count of \",\n          \"arguments\": {\n            \"$ref\": \"#/components/schemas/FindPresentationsArgs\"\n          },\n          \"returnType\": {\n            \"type\": \"number\"\n          }\n        }\n      }\n    }\n  },\n  \"IMessageHandler\": {\n    \"components\": {\n      \"schemas\": {\n        \"IHandleMessageArgs\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"raw\": {\n              \"type\": \"string\",\n              \"description\": \"Raw message data\"\n            },\n            \"metaData\": {\n              \"type\": \"array\",\n              \"items\": {\n                \"$ref\": \"#/components/schemas/IMetaData\"\n              },\n              \"description\": \"Optional. Message meta data\"\n            },\n            \"save\": {\n              \"type\": \"boolean\",\n              \"description\": \"Optional. If set to `true`, the message will be saved using  {@link  @veramo/core-types#IDataStore.dataStoreSaveMessage | dataStoreSaveMessage }  <p/><p/>\",\n              \"deprecated\": \"Please call {@link @veramo/core-types#IDataStore.dataStoreSaveMessage | dataStoreSaveMessage()} after\\nhandling the message and determining that it must be saved.\"\n            }\n          },\n          \"required\": [\n            \"raw\"\n          ],\n          \"description\": \"Input arguments for  {@link IMessageHandler.handleMessage | handleMessage }\"\n        },\n        \"IMetaData\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"type\": {\n              \"type\": \"string\",\n              \"description\": \"Type\"\n            },\n            \"value\": {\n              \"type\": \"string\",\n              \"description\": \"Optional. Value\"\n            }\n          },\n          \"required\": [\n            \"type\"\n          ],\n          \"description\": \"Message meta data\"\n        },\n        \"IMessage\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"id\": {\n              \"type\": \"string\",\n              \"description\": \"Unique message ID\"\n            },\n            \"type\": {\n              \"type\": \"string\",\n              \"description\": \"Message type\"\n            },\n            \"createdAt\": {\n              \"type\": \"string\",\n              \"description\": \"Optional. Creation date (ISO 8601)\"\n            },\n            \"expiresAt\": {\n              \"type\": \"string\",\n              \"description\": \"Optional. Expiration date (ISO 8601)\"\n            },\n            \"threadId\": {\n              \"type\": \"string\",\n              \"description\": \"Optional. Thread ID\"\n            },\n            \"raw\": {\n              \"type\": \"string\",\n              \"description\": \"Optional. Original message raw data\"\n            },\n            \"data\": {\n              \"anyOf\": [\n                {\n                  \"type\": \"object\"\n                },\n                {\n                  \"type\": \"null\"\n                }\n              ],\n              \"description\": \"Optional. Parsed data\"\n            },\n            \"replyTo\": {\n              \"type\": \"array\",\n              \"items\": {\n                \"type\": \"string\"\n              },\n              \"description\": \"Optional. List of DIDs to reply to\"\n            },\n            \"replyUrl\": {\n              \"type\": \"string\",\n              \"description\": \"Optional. URL to post a reply message to\"\n            },\n            \"from\": {\n              \"type\": \"string\",\n              \"description\": \"Optional. Sender DID\"\n            },\n            \"to\": {\n              \"type\": \"string\",\n              \"description\": \"Optional. Recipient DID\"\n            },\n            \"metaData\": {\n              \"anyOf\": [\n                {\n                  \"type\": \"array\",\n                  \"items\": {\n                    \"$ref\": \"#/components/schemas/IMetaData\"\n                  }\n                },\n                {\n                  \"type\": \"null\"\n                }\n              ],\n              \"description\": \"Optional. Array of message metadata\"\n            },\n            \"credentials\": {\n              \"type\": \"array\",\n              \"items\": {\n                \"$ref\": \"#/components/schemas/VerifiableCredential\"\n              },\n              \"description\": \"Optional. Array of attached verifiable credentials\"\n            },\n            \"presentations\": {\n              \"type\": \"array\",\n              \"items\": {\n                \"$ref\": \"#/components/schemas/VerifiablePresentation\"\n              },\n              \"description\": \"Optional. Array of attached verifiable presentations\"\n            },\n            \"attachments\": {\n              \"type\": \"array\",\n              \"items\": {\n                \"$ref\": \"#/components/schemas/IMessageAttachment\"\n              },\n              \"description\": \"Optional. Array of generic attachments\"\n            },\n            \"returnRoute\": {\n              \"type\": \"string\",\n              \"description\": \"Optional. Signal how to reuse transport for return messages\"\n            }\n          },\n          \"required\": [\n            \"id\",\n            \"type\"\n          ],\n          \"description\": \"Represents a DIDComm v1 message payload, with optionally decoded credentials and presentations.\"\n        },\n        \"VerifiableCredential\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"proof\": {\n              \"$ref\": \"#/components/schemas/ProofType\"\n            },\n            \"issuer\": {\n              \"$ref\": \"#/components/schemas/IssuerType\"\n            },\n            \"credentialSubject\": {\n              \"$ref\": \"#/components/schemas/CredentialSubject\"\n            },\n            \"type\": {\n              \"anyOf\": [\n                {\n                  \"type\": \"array\",\n                  \"items\": {\n                    \"type\": \"string\"\n                  }\n                },\n                {\n                  \"type\": \"string\"\n                }\n              ]\n            },\n            \"@context\": {\n              \"$ref\": \"#/components/schemas/ContextType\"\n            },\n            \"issuanceDate\": {\n              \"type\": \"string\"\n            },\n            \"expirationDate\": {\n              \"type\": \"string\"\n            },\n            \"credentialStatus\": {\n              \"$ref\": \"#/components/schemas/CredentialStatusReference\"\n            },\n            \"id\": {\n              \"type\": \"string\"\n            }\n          },\n          \"required\": [\n            \"@context\",\n            \"credentialSubject\",\n            \"issuanceDate\",\n            \"issuer\",\n            \"proof\"\n          ],\n          \"description\": \"Represents a signed Verifiable Credential payload (includes proof), using a JSON representation. See  {@link https://www.w3.org/TR/vc-data-model/#credentials | VC data model }\"\n        },\n        \"ProofType\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"type\": {\n              \"type\": \"string\"\n            },\n            \"proofValue\": {\n              \"type\": \"string\"\n            }\n          },\n          \"description\": \"A proof property of a  {@link  VerifiableCredential }  or  {@link  VerifiablePresentation }\"\n        },\n        \"IssuerType\": {\n          \"anyOf\": [\n            {\n              \"type\": \"object\",\n              \"properties\": {\n                \"id\": {\n                  \"type\": \"string\"\n                }\n              },\n              \"required\": [\n                \"id\"\n              ]\n            },\n            {\n              \"type\": \"string\"\n            }\n          ],\n          \"description\": \"The issuer of a  {@link  VerifiableCredential }  or the holder of a  {@link  VerifiablePresentation } .\\n\\nThe value of the issuer property MUST be either a URI or an object containing an id property. It is RECOMMENDED that the URI in the issuer or its id be one which, if de-referenced, results in a document containing machine-readable information about the issuer that can be used to verify the information expressed in the credential.\\n\\nSee  {@link https://www.w3.org/TR/vc-data-model/#issuer | Issuer data model }\"\n        },\n        \"CredentialSubject\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"id\": {\n              \"type\": \"string\"\n            }\n          },\n          \"description\": \"The value of the credentialSubject property is defined as a set of objects that contain one or more properties that are each related to a subject of the verifiable credential. Each object MAY contain an id.\\n\\nSee  {@link https://www.w3.org/TR/vc-data-model/#credential-subject | Credential Subject }\"\n        },\n        \"ContextType\": {\n          \"anyOf\": [\n            {\n              \"type\": \"string\"\n            },\n            {\n              \"type\": \"object\"\n            },\n            {\n              \"type\": \"array\",\n              \"items\": {\n                \"anyOf\": [\n                  {\n                    \"type\": \"string\"\n                  },\n                  {\n                    \"type\": \"object\"\n                  }\n                ]\n              }\n            }\n          ],\n          \"description\": \"The data type for `@context` properties of credentials, presentations, etc.\"\n        },\n        \"CredentialStatusReference\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"id\": {\n              \"type\": \"string\"\n            },\n            \"type\": {\n              \"type\": \"string\"\n            }\n          },\n          \"required\": [\n            \"id\",\n            \"type\"\n          ],\n          \"description\": \"Used for the discovery of information about the current status of a verifiable credential, such as whether it is suspended or revoked. The precise contents of the credential status information are determined by the specific `credentialStatus` type  definition and vary depending on factors such as whether it is simple to implement or if it is privacy-enhancing.\\n\\nSee  {@link https://www.w3.org/TR/vc-data-model/#status | Credential Status }\"\n        },\n        \"VerifiablePresentation\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"proof\": {\n              \"$ref\": \"#/components/schemas/ProofType\"\n            },\n            \"holder\": {\n              \"type\": \"string\"\n            },\n            \"verifiableCredential\": {\n              \"type\": \"array\",\n              \"items\": {\n                \"$ref\": \"#/components/schemas/W3CVerifiableCredential\"\n              }\n            },\n            \"type\": {\n              \"anyOf\": [\n                {\n                  \"type\": \"array\",\n                  \"items\": {\n                    \"type\": \"string\"\n                  }\n                },\n                {\n                  \"type\": \"string\"\n                }\n              ]\n            },\n            \"@context\": {\n              \"$ref\": \"#/components/schemas/ContextType\"\n            },\n            \"verifier\": {\n              \"type\": \"array\",\n              \"items\": {\n                \"type\": \"string\"\n              }\n            },\n            \"issuanceDate\": {\n              \"type\": \"string\"\n            },\n            \"expirationDate\": {\n              \"type\": \"string\"\n            },\n            \"id\": {\n              \"type\": \"string\"\n            }\n          },\n          \"required\": [\n            \"@context\",\n            \"holder\",\n            \"proof\"\n          ],\n          \"description\": \"Represents a signed Verifiable Presentation (includes proof), using a JSON representation. See  {@link https://www.w3.org/TR/vc-data-model/#presentations | VP data model }\"\n        },\n        \"W3CVerifiableCredential\": {\n          \"anyOf\": [\n            {\n              \"$ref\": \"#/components/schemas/VerifiableCredential\"\n            },\n            {\n              \"$ref\": \"#/components/schemas/CompactJWT\"\n            }\n          ],\n          \"description\": \"Represents a signed Verifiable Credential (includes proof), in either JSON or compact JWT format. See  {@link https://www.w3.org/TR/vc-data-model/#credentials | VC data model }  See  {@link https://www.w3.org/TR/vc-data-model-1.1/#proof-formats | proof formats }\"\n        },\n        \"CompactJWT\": {\n          \"type\": \"string\",\n          \"description\": \"Represents a Json Web Token in compact form. \\\"header.payload.signature\\\"\"\n        },\n        \"IMessageAttachment\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"id\": {\n              \"type\": \"string\"\n            },\n            \"description\": {\n              \"type\": \"string\"\n            },\n            \"filename\": {\n              \"type\": \"string\"\n            },\n            \"media_type\": {\n              \"type\": \"string\"\n            },\n            \"format\": {\n              \"type\": \"string\"\n            },\n            \"lastmod_time\": {\n              \"type\": \"string\"\n            },\n            \"byte_count\": {\n              \"type\": \"number\"\n            },\n            \"data\": {\n              \"$ref\": \"#/components/schemas/IMessageAttachmentData\"\n            }\n          },\n          \"required\": [\n            \"data\"\n          ],\n          \"description\": \"Message attachment\"\n        },\n        \"IMessageAttachmentData\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"jws\": {},\n            \"hash\": {\n              \"type\": \"string\"\n            },\n            \"links\": {\n              \"type\": \"array\",\n              \"items\": {\n                \"type\": \"string\"\n              }\n            },\n            \"base64\": {\n              \"type\": \"string\"\n            },\n            \"json\": {}\n          },\n          \"description\": \"The DIDComm message structure for data in an attachment. See https://identity.foundation/didcomm-messaging/spec/#attachments\"\n        }\n      },\n      \"methods\": {\n        \"handleMessage\": {\n          \"description\": \"Parses a raw message.\",\n          \"arguments\": {\n            \"$ref\": \"#/components/schemas/IHandleMessageArgs\"\n          },\n          \"returnType\": {\n            \"$ref\": \"#/components/schemas/IMessage\"\n          }\n        }\n      }\n    }\n  },\n  \"ICredentialIssuer\": {\n    \"components\": {\n      \"schemas\": {\n        \"ICreateVerifiableCredentialArgs\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"resolutionOptions\": {\n              \"type\": \"object\",\n              \"properties\": {\n                \"publicKeyFormat\": {\n                  \"type\": \"string\"\n                },\n                \"accept\": {\n                  \"type\": \"string\"\n                }\n              },\n              \"description\": \"Options to be passed to the DID resolver.\"\n            },\n            \"credential\": {\n              \"$ref\": \"#/components/schemas/CredentialPayload\",\n              \"description\": \"The JSON payload of the Credential according to the  {@link https://www.w3.org/TR/vc-data-model/#credentials | canonical model } \\n\\nThe signer of the Credential is chosen based on the `issuer.id` property of the `credential`\\n\\n`@context`, `type` and `issuanceDate` will be added automatically if omitted\"\n            },\n            \"save\": {\n              \"type\": \"boolean\",\n              \"description\": \"If this parameter is true, the resulting VerifiableCredential is sent to the  {@link  @veramo/core-types#IDataStore | storage plugin }  to be saved.\",\n              \"deprecated\": \"Please call\\n{@link @veramo/core-types#IDataStore.dataStoreSaveVerifiableCredential | dataStoreSaveVerifiableCredential()} to\\nsave the credential after creating it.\"\n            },\n            \"proofFormat\": {\n              \"$ref\": \"#/components/schemas/ProofFormat\",\n              \"description\": \"The desired format for the VerifiableCredential to be created.\"\n            },\n            \"removeOriginalFields\": {\n              \"type\": \"boolean\",\n              \"description\": \"Remove payload members during JWT-JSON transformation. Defaults to `true`. See https://www.w3.org/TR/vc-data-model/#jwt-encoding\"\n            },\n            \"keyRef\": {\n              \"type\": \"string\",\n              \"description\": \"[Optional] The ID of the key that should sign this credential. If this is not specified, the first matching key will be used.\"\n            },\n            \"fetchRemoteContexts\": {\n              \"type\": \"boolean\",\n              \"description\": \"When dealing with JSON-LD, you also MUST provide the proper contexts. Set this to `true` ONLY if you want the `@context` URLs to be fetched in case they are not preloaded. The context definitions SHOULD rather be provided at startup instead of being fetched.\\n\\nDefaults to `false`\"\n            }\n          },\n          \"required\": [\n            \"credential\",\n            \"proofFormat\"\n          ],\n          \"additionalProperties\": {\n            \"description\": \"Any other options that can be forwarded to the lower level libraries\"\n          },\n          \"description\": \"Encapsulates the parameters required to create a  {@link https://www.w3.org/TR/vc-data-model/#credentials | W3C Verifiable Credential }\"\n        },\n        \"CredentialPayload\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"issuer\": {\n              \"$ref\": \"#/components/schemas/IssuerType\"\n            },\n            \"credentialSubject\": {\n              \"$ref\": \"#/components/schemas/CredentialSubject\"\n            },\n            \"type\": {\n              \"type\": \"array\",\n              \"items\": {\n                \"type\": \"string\"\n              }\n            },\n            \"@context\": {\n              \"$ref\": \"#/components/schemas/ContextType\"\n            },\n            \"issuanceDate\": {\n              \"$ref\": \"#/components/schemas/DateType\"\n            },\n            \"expirationDate\": {\n              \"$ref\": \"#/components/schemas/DateType\"\n            },\n            \"credentialStatus\": {\n              \"$ref\": \"#/components/schemas/CredentialStatusReference\"\n            },\n            \"id\": {\n              \"type\": \"string\"\n            }\n          },\n          \"required\": [\n            \"issuer\"\n          ],\n          \"description\": \"Used as input when creating Verifiable Credentials\"\n        },\n        \"IssuerType\": {\n          \"anyOf\": [\n            {\n              \"type\": \"object\",\n              \"properties\": {\n                \"id\": {\n                  \"type\": \"string\"\n                }\n              },\n              \"required\": [\n                \"id\"\n              ]\n            },\n            {\n              \"type\": \"string\"\n            }\n          ],\n          \"description\": \"The issuer of a  {@link  VerifiableCredential }  or the holder of a  {@link  VerifiablePresentation } .\\n\\nThe value of the issuer property MUST be either a URI or an object containing an id property. It is RECOMMENDED that the URI in the issuer or its id be one which, if de-referenced, results in a document containing machine-readable information about the issuer that can be used to verify the information expressed in the credential.\\n\\nSee  {@link https://www.w3.org/TR/vc-data-model/#issuer | Issuer data model }\"\n        },\n        \"CredentialSubject\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"id\": {\n              \"type\": \"string\"\n            }\n          },\n          \"description\": \"The value of the credentialSubject property is defined as a set of objects that contain one or more properties that are each related to a subject of the verifiable credential. Each object MAY contain an id.\\n\\nSee  {@link https://www.w3.org/TR/vc-data-model/#credential-subject | Credential Subject }\"\n        },\n        \"ContextType\": {\n          \"anyOf\": [\n            {\n              \"type\": \"string\"\n            },\n            {\n              \"type\": \"object\"\n            },\n            {\n              \"type\": \"array\",\n              \"items\": {\n                \"anyOf\": [\n                  {\n                    \"type\": \"string\"\n                  },\n                  {\n                    \"type\": \"object\"\n                  }\n                ]\n              }\n            }\n          ],\n          \"description\": \"The data type for `@context` properties of credentials, presentations, etc.\"\n        },\n        \"DateType\": {\n          \"anyOf\": [\n            {\n              \"type\": \"string\"\n            },\n            {\n              \"type\": \"string\",\n              \"format\": \"date-time\"\n            }\n          ],\n          \"description\": \"Represents an issuance or expiration date for Credentials / Presentations. This is used as input when creating them.\"\n        },\n        \"CredentialStatusReference\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"id\": {\n              \"type\": \"string\"\n            },\n            \"type\": {\n              \"type\": \"string\"\n            }\n          },\n          \"required\": [\n            \"id\",\n            \"type\"\n          ],\n          \"description\": \"Used for the discovery of information about the current status of a verifiable credential, such as whether it is suspended or revoked. The precise contents of the credential status information are determined by the specific `credentialStatus` type  definition and vary depending on factors such as whether it is simple to implement or if it is privacy-enhancing.\\n\\nSee  {@link https://www.w3.org/TR/vc-data-model/#status | Credential Status }\"\n        },\n        \"ProofFormat\": {\n          \"type\": \"string\",\n          \"description\": \"Represents a format for a particular type of verifiable data. This is an extensible union of several known formats implemented by Veramo\"\n        },\n        \"VerifiableCredential\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"proof\": {\n              \"$ref\": \"#/components/schemas/ProofType\"\n            },\n            \"issuer\": {\n              \"$ref\": \"#/components/schemas/IssuerType\"\n            },\n            \"credentialSubject\": {\n              \"$ref\": \"#/components/schemas/CredentialSubject\"\n            },\n            \"type\": {\n              \"anyOf\": [\n                {\n                  \"type\": \"array\",\n                  \"items\": {\n                    \"type\": \"string\"\n                  }\n                },\n                {\n                  \"type\": \"string\"\n                }\n              ]\n            },\n            \"@context\": {\n              \"$ref\": \"#/components/schemas/ContextType\"\n            },\n            \"issuanceDate\": {\n              \"type\": \"string\"\n            },\n            \"expirationDate\": {\n              \"type\": \"string\"\n            },\n            \"credentialStatus\": {\n              \"$ref\": \"#/components/schemas/CredentialStatusReference\"\n            },\n            \"id\": {\n              \"type\": \"string\"\n            }\n          },\n          \"required\": [\n            \"@context\",\n            \"credentialSubject\",\n            \"issuanceDate\",\n            \"issuer\",\n            \"proof\"\n          ],\n          \"description\": \"Represents a signed Verifiable Credential payload (includes proof), using a JSON representation. See  {@link https://www.w3.org/TR/vc-data-model/#credentials | VC data model }\"\n        },\n        \"ProofType\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"type\": {\n              \"type\": \"string\"\n            },\n            \"proofValue\": {\n              \"type\": \"string\"\n            }\n          },\n          \"description\": \"A proof property of a  {@link  VerifiableCredential }  or  {@link  VerifiablePresentation }\"\n        },\n        \"ICreateVerifiablePresentationArgs\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"resolutionOptions\": {\n              \"type\": \"object\",\n              \"properties\": {\n                \"publicKeyFormat\": {\n                  \"type\": \"string\"\n                },\n                \"accept\": {\n                  \"type\": \"string\"\n                }\n              },\n              \"description\": \"Options to be passed to the DID resolver.\"\n            },\n            \"presentation\": {\n              \"$ref\": \"#/components/schemas/PresentationPayload\",\n              \"description\": \"The JSON payload of the Presentation according to the  {@link https://www.w3.org/TR/vc-data-model/#presentations | canonical model } .\\n\\nThe signer of the Presentation is chosen based on the `holder` property of the `presentation`\\n\\n`@context`, `type` and `issuanceDate` will be added automatically if omitted\"\n            },\n            \"save\": {\n              \"type\": \"boolean\",\n              \"description\": \"If this parameter is true, the resulting VerifiablePresentation is sent to the  {@link  @veramo/core-types#IDataStore | storage plugin }  to be saved. <p/><p/>\",\n              \"deprecated\": \"Please call\\n{@link @veramo/core-types#IDataStore.dataStoreSaveVerifiablePresentation |}   *   dataStoreSaveVerifiablePresentation()} to save the credential after creating it.\"\n            },\n            \"challenge\": {\n              \"type\": \"string\",\n              \"description\": \"Optional (only JWT) string challenge parameter to add to the verifiable presentation.\"\n            },\n            \"domain\": {\n              \"type\": \"string\",\n              \"description\": \"Optional string domain parameter to add to the verifiable presentation.\"\n            },\n            \"proofFormat\": {\n              \"$ref\": \"#/components/schemas/ProofFormat\",\n              \"description\": \"The desired format for the VerifiablePresentation to be created.\"\n            },\n            \"removeOriginalFields\": {\n              \"type\": \"boolean\",\n              \"description\": \"Remove payload members during JWT-JSON transformation. Defaults to `true`. See https://www.w3.org/TR/vc-data-model/#jwt-encoding\"\n            },\n            \"keyRef\": {\n              \"type\": \"string\",\n              \"description\": \"[Optional] The ID of the key that should sign this presentation. If this is not specified, the first matching key will be used.\"\n            },\n            \"fetchRemoteContexts\": {\n              \"type\": \"boolean\",\n              \"description\": \"When dealing with JSON-LD, you also MUST provide the proper contexts. Set this to `true` ONLY if you want the `@context` URLs to be fetched in case they are not preloaded. The context definitions SHOULD rather be provided at startup instead of being fetched.\\n\\nDefaults to `false`\"\n            }\n          },\n          \"required\": [\n            \"presentation\",\n            \"proofFormat\"\n          ],\n          \"additionalProperties\": {\n            \"description\": \"Any other options that can be forwarded to the lower level libraries\"\n          },\n          \"description\": \"Encapsulates the parameters required to create a  {@link https://www.w3.org/TR/vc-data-model/#presentations | W3C Verifiable Presentation }\"\n        },\n        \"PresentationPayload\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"holder\": {\n              \"type\": \"string\"\n            },\n            \"verifiableCredential\": {\n              \"type\": \"array\",\n              \"items\": {\n                \"$ref\": \"#/components/schemas/W3CVerifiableCredential\"\n              }\n            },\n            \"type\": {\n              \"type\": \"array\",\n              \"items\": {\n                \"type\": \"string\"\n              }\n            },\n            \"@context\": {\n              \"$ref\": \"#/components/schemas/ContextType\"\n            },\n            \"verifier\": {\n              \"type\": \"array\",\n              \"items\": {\n                \"type\": \"string\"\n              }\n            },\n            \"issuanceDate\": {\n              \"$ref\": \"#/components/schemas/DateType\"\n            },\n            \"expirationDate\": {\n              \"$ref\": \"#/components/schemas/DateType\"\n            },\n            \"id\": {\n              \"type\": \"string\"\n            }\n          },\n          \"required\": [\n            \"holder\"\n          ],\n          \"description\": \"Used as input when creating Verifiable Presentations\"\n        },\n        \"W3CVerifiableCredential\": {\n          \"anyOf\": [\n            {\n              \"$ref\": \"#/components/schemas/VerifiableCredential\"\n            },\n            {\n              \"$ref\": \"#/components/schemas/CompactJWT\"\n            }\n          ],\n          \"description\": \"Represents a signed Verifiable Credential (includes proof), in either JSON or compact JWT format. See  {@link https://www.w3.org/TR/vc-data-model/#credentials | VC data model }  See  {@link https://www.w3.org/TR/vc-data-model-1.1/#proof-formats | proof formats }\"\n        },\n        \"CompactJWT\": {\n          \"type\": \"string\",\n          \"description\": \"Represents a Json Web Token in compact form. \\\"header.payload.signature\\\"\"\n        },\n        \"VerifiablePresentation\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"proof\": {\n              \"$ref\": \"#/components/schemas/ProofType\"\n            },\n            \"holder\": {\n              \"type\": \"string\"\n            },\n            \"verifiableCredential\": {\n              \"type\": \"array\",\n              \"items\": {\n                \"$ref\": \"#/components/schemas/W3CVerifiableCredential\"\n              }\n            },\n            \"type\": {\n              \"anyOf\": [\n                {\n                  \"type\": \"array\",\n                  \"items\": {\n                    \"type\": \"string\"\n                  }\n                },\n                {\n                  \"type\": \"string\"\n                }\n              ]\n            },\n            \"@context\": {\n              \"$ref\": \"#/components/schemas/ContextType\"\n            },\n            \"verifier\": {\n              \"type\": \"array\",\n              \"items\": {\n                \"type\": \"string\"\n              }\n            },\n            \"issuanceDate\": {\n              \"type\": \"string\"\n            },\n            \"expirationDate\": {\n              \"type\": \"string\"\n            },\n            \"id\": {\n              \"type\": \"string\"\n            }\n          },\n          \"required\": [\n            \"@context\",\n            \"holder\",\n            \"proof\"\n          ],\n          \"description\": \"Represents a signed Verifiable Presentation (includes proof), using a JSON representation. See  {@link https://www.w3.org/TR/vc-data-model/#presentations | VP data model }\"\n        },\n        \"IIdentifier\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"did\": {\n              \"type\": \"string\",\n              \"description\": \"Decentralized identifier\"\n            },\n            \"alias\": {\n              \"type\": \"string\",\n              \"description\": \"Optional. Identifier alias. Can be used to reference an object in an external system\"\n            },\n            \"provider\": {\n              \"type\": \"string\",\n              \"description\": \"Identifier provider name\"\n            },\n            \"controllerKeyId\": {\n              \"type\": \"string\",\n              \"description\": \"Controller key id\"\n            },\n            \"keys\": {\n              \"type\": \"array\",\n              \"items\": {\n                \"$ref\": \"#/components/schemas/IKey\"\n              },\n              \"description\": \"Array of managed keys\"\n            },\n            \"services\": {\n              \"type\": \"array\",\n              \"items\": {\n                \"$ref\": \"#/components/schemas/IService\"\n              },\n              \"description\": \"Array of services\"\n            }\n          },\n          \"required\": [\n            \"did\",\n            \"provider\",\n            \"keys\",\n            \"services\"\n          ],\n          \"description\": \"Identifier interface\"\n        },\n        \"IKey\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"kid\": {\n              \"type\": \"string\",\n              \"description\": \"Key ID\"\n            },\n            \"kms\": {\n              \"type\": \"string\",\n              \"description\": \"Key Management System\"\n            },\n            \"type\": {\n              \"$ref\": \"#/components/schemas/TKeyType\",\n              \"description\": \"Key type\"\n            },\n            \"publicKeyHex\": {\n              \"type\": \"string\",\n              \"description\": \"Public key\"\n            },\n            \"privateKeyHex\": {\n              \"type\": \"string\",\n              \"description\": \"Optional. Private key\"\n            },\n            \"meta\": {\n              \"anyOf\": [\n                {\n                  \"$ref\": \"#/components/schemas/KeyMetadata\"\n                },\n                {\n                  \"type\": \"null\"\n                }\n              ],\n              \"description\": \"Optional. Key metadata. This should be used to determine which algorithms are supported.\"\n            }\n          },\n          \"required\": [\n            \"kid\",\n            \"kms\",\n            \"type\",\n            \"publicKeyHex\"\n          ],\n          \"description\": \"Cryptographic key, usually managed by the current Veramo instance.\"\n        },\n        \"TKeyType\": {\n          \"type\": \"string\",\n          \"description\": \"Cryptographic key type.\"\n        },\n        \"KeyMetadata\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"algorithms\": {\n              \"type\": \"array\",\n              \"items\": {\n                \"$ref\": \"#/components/schemas/TAlg\"\n              }\n            }\n          },\n          \"description\": \"This encapsulates data about a key.\\n\\nImplementations of  {@link  @veramo/key-manager#AbstractKeyManagementSystem | AbstractKeyManagementSystem }  should populate this object, for each key, with the algorithms that can be performed using it.\\n\\nThis can also be used to add various tags to the keys under management.\"\n        },\n        \"TAlg\": {\n          \"type\": \"string\",\n          \"description\": \"Known algorithms supported by some of the above key types defined by  {@link  TKeyType } .\\n\\nActual implementations of  {@link  @veramo/key-manager#AbstractKeyManagementSystem | Key Management Systems }  can support more. One should check the  {@link IKey.meta | IKey.meta.algorithms }  property to see what is possible for a particular managed key.\"\n        },\n        \"IService\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"id\": {\n              \"type\": \"string\",\n              \"description\": \"ID\"\n            },\n            \"type\": {\n              \"type\": \"string\",\n              \"description\": \"Service type\"\n            },\n            \"serviceEndpoint\": {\n              \"anyOf\": [\n                {\n                  \"$ref\": \"#/components/schemas/IServiceEndpoint\"\n                },\n                {\n                  \"type\": \"array\",\n                  \"items\": {\n                    \"$ref\": \"#/components/schemas/IServiceEndpoint\"\n                  }\n                }\n              ],\n              \"description\": \"Endpoint URL\"\n            },\n            \"description\": {\n              \"type\": \"string\",\n              \"description\": \"Optional. Description\"\n            }\n          },\n          \"required\": [\n            \"id\",\n            \"type\",\n            \"serviceEndpoint\"\n          ],\n          \"description\": \"Identifier service\"\n        },\n        \"IServiceEndpoint\": {\n          \"anyOf\": [\n            {\n              \"type\": \"string\"\n            },\n            {\n              \"type\": \"object\"\n            }\n          ],\n          \"description\": \"Represents a service endpoint URL or a map of URLs\"\n        }\n      },\n      \"methods\": {\n        \"createVerifiableCredential\": {\n          \"description\": \"Creates a Verifiable Credential. The payload, signer, and format are chosen based on the \",\n          \"arguments\": {\n            \"$ref\": \"#/components/schemas/ICreateVerifiableCredentialArgs\"\n          },\n          \"returnType\": {\n            \"$ref\": \"#/components/schemas/VerifiableCredential\"\n          }\n        },\n        \"createVerifiablePresentation\": {\n          \"description\": \"Creates a Verifiable Presentation. The payload, signer and format are chosen based on the \",\n          \"arguments\": {\n            \"$ref\": \"#/components/schemas/ICreateVerifiablePresentationArgs\"\n          },\n          \"returnType\": {\n            \"$ref\": \"#/components/schemas/VerifiablePresentation\"\n          }\n        },\n        \"listUsableProofFormats\": {\n          \"description\": \"Returns a list of supported proof formats for verifiable data that this plugin can generate based on the specified issuer.\",\n          \"arguments\": {\n            \"$ref\": \"#/components/schemas/IIdentifier\"\n          },\n          \"returnType\": {\n            \"type\": \"array\",\n            \"items\": {\n              \"$ref\": \"#/components/schemas/ProofFormat\"\n            }\n          }\n        }\n      }\n    }\n  },\n  \"ICredentialVerifier\": {\n    \"components\": {\n      \"schemas\": {\n        \"IVerifyCredentialArgs\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"resolutionOptions\": {\n              \"type\": \"object\",\n              \"properties\": {\n                \"publicKeyFormat\": {\n                  \"type\": \"string\"\n                },\n                \"accept\": {\n                  \"type\": \"string\"\n                }\n              },\n              \"description\": \"Options to be passed to the DID resolver.\"\n            },\n            \"credential\": {\n              \"$ref\": \"#/components/schemas/W3CVerifiableCredential\",\n              \"description\": \"The Verifiable Credential object according to the  {@link https://www.w3.org/TR/vc-data-model/#credentials | canonical model }  or the  {@link https://www.w3.org/TR/vc-data-model-1.1/#json-web-token | JWT representation } .\\n\\nThe signer of the Credential is verified based on the `issuer.id` property of the `credential` or the `iss` property of the JWT payload respectively\"\n            },\n            \"fetchRemoteContexts\": {\n              \"type\": \"boolean\",\n              \"description\": \"When dealing with JSON-LD you also MUST provide the proper contexts. Set this to `true` ONLY if you want the `@context` URLs to be fetched in case they are not preloaded. The context definitions SHOULD rather be provided at application startup instead of being fetched.\\n\\nDefaults to `false`\"\n            },\n            \"policies\": {\n              \"$ref\": \"#/components/schemas/VerificationPolicies\",\n              \"description\": \"Overrides specific aspects of credential verification, where possible.\"\n            }\n          },\n          \"required\": [\n            \"credential\"\n          ],\n          \"additionalProperties\": {\n            \"description\": \"Other options can be specified for verification. They will be forwarded to the lower level modules. that perform the checks\"\n          },\n          \"description\": \"Encapsulates the parameters required to verify a  {@link https://www.w3.org/TR/vc-data-model/#credentials | W3C Verifiable Credential }\"\n        },\n        \"W3CVerifiableCredential\": {\n          \"anyOf\": [\n            {\n              \"$ref\": \"#/components/schemas/VerifiableCredential\"\n            },\n            {\n              \"$ref\": \"#/components/schemas/CompactJWT\"\n            }\n          ],\n          \"description\": \"Represents a signed Verifiable Credential (includes proof), in either JSON or compact JWT format. See  {@link https://www.w3.org/TR/vc-data-model/#credentials | VC data model }  See  {@link https://www.w3.org/TR/vc-data-model-1.1/#proof-formats | proof formats }\"\n        },\n        \"VerifiableCredential\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"proof\": {\n              \"$ref\": \"#/components/schemas/ProofType\"\n            },\n            \"issuer\": {\n              \"$ref\": \"#/components/schemas/IssuerType\"\n            },\n            \"credentialSubject\": {\n              \"$ref\": \"#/components/schemas/CredentialSubject\"\n            },\n            \"type\": {\n              \"anyOf\": [\n                {\n                  \"type\": \"array\",\n                  \"items\": {\n                    \"type\": \"string\"\n                  }\n                },\n                {\n                  \"type\": \"string\"\n                }\n              ]\n            },\n            \"@context\": {\n              \"$ref\": \"#/components/schemas/ContextType\"\n            },\n            \"issuanceDate\": {\n              \"type\": \"string\"\n            },\n            \"expirationDate\": {\n              \"type\": \"string\"\n            },\n            \"credentialStatus\": {\n              \"$ref\": \"#/components/schemas/CredentialStatusReference\"\n            },\n            \"id\": {\n              \"type\": \"string\"\n            }\n          },\n          \"required\": [\n            \"@context\",\n            \"credentialSubject\",\n            \"issuanceDate\",\n            \"issuer\",\n            \"proof\"\n          ],\n          \"description\": \"Represents a signed Verifiable Credential payload (includes proof), using a JSON representation. See  {@link https://www.w3.org/TR/vc-data-model/#credentials | VC data model }\"\n        },\n        \"ProofType\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"type\": {\n              \"type\": \"string\"\n            },\n            \"proofValue\": {\n              \"type\": \"string\"\n            }\n          },\n          \"description\": \"A proof property of a  {@link  VerifiableCredential }  or  {@link  VerifiablePresentation }\"\n        },\n        \"IssuerType\": {\n          \"anyOf\": [\n            {\n              \"type\": \"object\",\n              \"properties\": {\n                \"id\": {\n                  \"type\": \"string\"\n                }\n              },\n              \"required\": [\n                \"id\"\n              ]\n            },\n            {\n              \"type\": \"string\"\n            }\n          ],\n          \"description\": \"The issuer of a  {@link  VerifiableCredential }  or the holder of a  {@link  VerifiablePresentation } .\\n\\nThe value of the issuer property MUST be either a URI or an object containing an id property. It is RECOMMENDED that the URI in the issuer or its id be one which, if de-referenced, results in a document containing machine-readable information about the issuer that can be used to verify the information expressed in the credential.\\n\\nSee  {@link https://www.w3.org/TR/vc-data-model/#issuer | Issuer data model }\"\n        },\n        \"CredentialSubject\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"id\": {\n              \"type\": \"string\"\n            }\n          },\n          \"description\": \"The value of the credentialSubject property is defined as a set of objects that contain one or more properties that are each related to a subject of the verifiable credential. Each object MAY contain an id.\\n\\nSee  {@link https://www.w3.org/TR/vc-data-model/#credential-subject | Credential Subject }\"\n        },\n        \"ContextType\": {\n          \"anyOf\": [\n            {\n              \"type\": \"string\"\n            },\n            {\n              \"type\": \"object\"\n            },\n            {\n              \"type\": \"array\",\n              \"items\": {\n                \"anyOf\": [\n                  {\n                    \"type\": \"string\"\n                  },\n                  {\n                    \"type\": \"object\"\n                  }\n                ]\n              }\n            }\n          ],\n          \"description\": \"The data type for `@context` properties of credentials, presentations, etc.\"\n        },\n        \"CredentialStatusReference\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"id\": {\n              \"type\": \"string\"\n            },\n            \"type\": {\n              \"type\": \"string\"\n            }\n          },\n          \"required\": [\n            \"id\",\n            \"type\"\n          ],\n          \"description\": \"Used for the discovery of information about the current status of a verifiable credential, such as whether it is suspended or revoked. The precise contents of the credential status information are determined by the specific `credentialStatus` type  definition and vary depending on factors such as whether it is simple to implement or if it is privacy-enhancing.\\n\\nSee  {@link https://www.w3.org/TR/vc-data-model/#status | Credential Status }\"\n        },\n        \"CompactJWT\": {\n          \"type\": \"string\",\n          \"description\": \"Represents a Json Web Token in compact form. \\\"header.payload.signature\\\"\"\n        },\n        \"VerificationPolicies\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"now\": {\n              \"type\": \"number\",\n              \"description\": \"policy to over the now (current time) during the verification check (UNIX time in seconds)\"\n            },\n            \"issuanceDate\": {\n              \"type\": \"boolean\",\n              \"description\": \"policy to skip the issuanceDate (nbf) timestamp check when set to `false`\"\n            },\n            \"expirationDate\": {\n              \"type\": \"boolean\",\n              \"description\": \"policy to skip the expirationDate (exp) timestamp check when set to `false`\"\n            },\n            \"audience\": {\n              \"type\": \"boolean\",\n              \"description\": \"policy to skip the audience check when set to `false`\"\n            },\n            \"credentialStatus\": {\n              \"type\": \"boolean\",\n              \"description\": \"policy to skip the revocation check (credentialStatus) when set to `false`\"\n            }\n          },\n          \"additionalProperties\": {\n            \"description\": \"Other options can be specified for verification. They will be forwarded to the lower level modules that perform the checks\"\n          },\n          \"description\": \"These optional settings can be used to override some default checks that are performed on Presentations during verification.\"\n        },\n        \"IVerifyResult\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"verified\": {\n              \"type\": \"boolean\",\n              \"description\": \"This value is used to transmit the result of verification.\"\n            },\n            \"error\": {\n              \"$ref\": \"#/components/schemas/IError\",\n              \"description\": \"Optional Error object for the but currently the machine readable errors are not expored from DID-JWT package to be imported here\"\n            }\n          },\n          \"required\": [\n            \"verified\"\n          ],\n          \"additionalProperties\": {\n            \"description\": \"Other options can be specified for verification. They will be forwarded to the lower level modules. that performt the checks\"\n          },\n          \"description\": \"Encapsulates the response object to verifyPresentation method after verifying a  {@link https://www.w3.org/TR/vc-data-model/#presentations | W3C Verifiable Presentation }\"\n        },\n        \"IError\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"message\": {\n              \"type\": \"string\",\n              \"description\": \"The details of the error being throw or forwarded\"\n            },\n            \"errorCode\": {\n              \"type\": \"string\",\n              \"description\": \"The code for the error being throw\"\n            }\n          },\n          \"description\": \"An error object, which can contain a code.\"\n        },\n        \"IVerifyPresentationArgs\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"resolutionOptions\": {\n              \"type\": \"object\",\n              \"properties\": {\n                \"publicKeyFormat\": {\n                  \"type\": \"string\"\n                },\n                \"accept\": {\n                  \"type\": \"string\"\n                }\n              },\n              \"description\": \"Options to be passed to the DID resolver.\"\n            },\n            \"presentation\": {\n              \"$ref\": \"#/components/schemas/W3CVerifiablePresentation\",\n              \"description\": \"The Verifiable Presentation object according to the  {@link https://www.w3.org/TR/vc-data-model/#presentations | canonical model }  or the JWT representation.\\n\\nThe signer of the Presentation is verified based on the `holder` property of the `presentation` or the `iss` property of the JWT payload respectively\"\n            },\n            \"challenge\": {\n              \"type\": \"string\",\n              \"description\": \"Optional (only for JWT) string challenge parameter to verify the verifiable presentation against\"\n            },\n            \"domain\": {\n              \"type\": \"string\",\n              \"description\": \"Optional (only for JWT) string domain parameter to verify the verifiable presentation against\"\n            },\n            \"fetchRemoteContexts\": {\n              \"type\": \"boolean\",\n              \"description\": \"When dealing with JSON-LD you also MUST provide the proper contexts. Set this to `true` ONLY if you want the `@context` URLs to be fetched in case they are not preloaded. The context definitions SHOULD rather be provided at startup instead of being fetched.\\n\\nDefaults to `false`\"\n            },\n            \"policies\": {\n              \"$ref\": \"#/components/schemas/VerificationPolicies\",\n              \"description\": \"Overrides specific aspects of credential verification, where possible.\"\n            }\n          },\n          \"required\": [\n            \"presentation\"\n          ],\n          \"additionalProperties\": {\n            \"description\": \"Other options can be specified for verification. They will be forwarded to the lower level modules. that perform the checks\"\n          },\n          \"description\": \"Encapsulates the parameters required to verify a  {@link https://www.w3.org/TR/vc-data-model/#presentations | W3C Verifiable Presentation }\"\n        },\n        \"W3CVerifiablePresentation\": {\n          \"anyOf\": [\n            {\n              \"$ref\": \"#/components/schemas/VerifiablePresentation\"\n            },\n            {\n              \"$ref\": \"#/components/schemas/CompactJWT\"\n            }\n          ],\n          \"description\": \"Represents a signed Verifiable Presentation (includes proof) in either JSON or compact JWT format. See  {@link https://www.w3.org/TR/vc-data-model/#credentials | VC data model }\"\n        },\n        \"VerifiablePresentation\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"proof\": {\n              \"$ref\": \"#/components/schemas/ProofType\"\n            },\n            \"holder\": {\n              \"type\": \"string\"\n            },\n            \"verifiableCredential\": {\n              \"type\": \"array\",\n              \"items\": {\n                \"$ref\": \"#/components/schemas/W3CVerifiableCredential\"\n              }\n            },\n            \"type\": {\n              \"anyOf\": [\n                {\n                  \"type\": \"array\",\n                  \"items\": {\n                    \"type\": \"string\"\n                  }\n                },\n                {\n                  \"type\": \"string\"\n                }\n              ]\n            },\n            \"@context\": {\n              \"$ref\": \"#/components/schemas/ContextType\"\n            },\n            \"verifier\": {\n              \"type\": \"array\",\n              \"items\": {\n                \"type\": \"string\"\n              }\n            },\n            \"issuanceDate\": {\n              \"type\": \"string\"\n            },\n            \"expirationDate\": {\n              \"type\": \"string\"\n            },\n            \"id\": {\n              \"type\": \"string\"\n            }\n          },\n          \"required\": [\n            \"@context\",\n            \"holder\",\n            \"proof\"\n          ],\n          \"description\": \"Represents a signed Verifiable Presentation (includes proof), using a JSON representation. See  {@link https://www.w3.org/TR/vc-data-model/#presentations | VP data model }\"\n        }\n      },\n      \"methods\": {\n        \"verifyCredential\": {\n          \"description\": \"Verifies a Verifiable Credential\",\n          \"arguments\": {\n            \"$ref\": \"#/components/schemas/IVerifyCredentialArgs\"\n          },\n          \"returnType\": {\n            \"$ref\": \"#/components/schemas/IVerifyResult\"\n          }\n        },\n        \"verifyPresentation\": {\n          \"description\": \"Verifies a Verifiable Presentation JWT or LDS Format.\",\n          \"arguments\": {\n            \"$ref\": \"#/components/schemas/IVerifyPresentationArgs\"\n          },\n          \"returnType\": {\n            \"$ref\": \"#/components/schemas/IVerifyResult\"\n          }\n        }\n      }\n    }\n  },\n  \"ICredentialPlugin\": {\n    \"components\": {\n      \"schemas\": {},\n      \"methods\": {}\n    }\n  },\n  \"ICredentialStatus\": {\n    \"components\": {\n      \"schemas\": {},\n      \"methods\": {}\n    }\n  },\n  \"ICredentialStatusVerifier\": {\n    \"components\": {\n      \"schemas\": {\n        \"ICheckCredentialStatusArgs\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"resolutionOptions\": {\n              \"type\": \"object\",\n              \"properties\": {\n                \"publicKeyFormat\": {\n                  \"type\": \"string\"\n                },\n                \"accept\": {\n                  \"type\": \"string\"\n                }\n              },\n              \"description\": \"Options to be passed to the DID resolver.\"\n            },\n            \"credential\": {\n              \"$ref\": \"#/components/schemas/VerifiableCredential\",\n              \"description\": \"The credential whose status needs to be checked\"\n            },\n            \"didDocumentOverride\": {\n              \"$ref\": \"#/components/schemas/DIDDocument\",\n              \"description\": \"The DID document of the issuer. This can be used in case the DID Document is already resolver, to avoid a potentially expensive DID resolution operation.\"\n            }\n          },\n          \"required\": [\n            \"credential\"\n          ],\n          \"description\": \"Arguments for calling  {@link ICredentialStatusVerifier.checkCredentialStatus | checkCredentialStatus } .\\n\\nThe credential whose status should be checked and the DID document of the credential issuer.\\n\\nSee  {@link https://www.w3.org/TR/vc-data-model/#status | Credential Status }\"\n        },\n        \"VerifiableCredential\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"proof\": {\n              \"$ref\": \"#/components/schemas/ProofType\"\n            },\n            \"issuer\": {\n              \"$ref\": \"#/components/schemas/IssuerType\"\n            },\n            \"credentialSubject\": {\n              \"$ref\": \"#/components/schemas/CredentialSubject\"\n            },\n            \"type\": {\n              \"anyOf\": [\n                {\n                  \"type\": \"array\",\n                  \"items\": {\n                    \"type\": \"string\"\n                  }\n                },\n                {\n                  \"type\": \"string\"\n                }\n              ]\n            },\n            \"@context\": {\n              \"$ref\": \"#/components/schemas/ContextType\"\n            },\n            \"issuanceDate\": {\n              \"type\": \"string\"\n            },\n            \"expirationDate\": {\n              \"type\": \"string\"\n            },\n            \"credentialStatus\": {\n              \"$ref\": \"#/components/schemas/CredentialStatusReference\"\n            },\n            \"id\": {\n              \"type\": \"string\"\n            }\n          },\n          \"required\": [\n            \"@context\",\n            \"credentialSubject\",\n            \"issuanceDate\",\n            \"issuer\",\n            \"proof\"\n          ],\n          \"description\": \"Represents a signed Verifiable Credential payload (includes proof), using a JSON representation. See  {@link https://www.w3.org/TR/vc-data-model/#credentials | VC data model }\"\n        },\n        \"ProofType\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"type\": {\n              \"type\": \"string\"\n            },\n            \"proofValue\": {\n              \"type\": \"string\"\n            }\n          },\n          \"description\": \"A proof property of a  {@link  VerifiableCredential }  or  {@link  VerifiablePresentation }\"\n        },\n        \"IssuerType\": {\n          \"anyOf\": [\n            {\n              \"type\": \"object\",\n              \"properties\": {\n                \"id\": {\n                  \"type\": \"string\"\n                }\n              },\n              \"required\": [\n                \"id\"\n              ]\n            },\n            {\n              \"type\": \"string\"\n            }\n          ],\n          \"description\": \"The issuer of a  {@link  VerifiableCredential }  or the holder of a  {@link  VerifiablePresentation } .\\n\\nThe value of the issuer property MUST be either a URI or an object containing an id property. It is RECOMMENDED that the URI in the issuer or its id be one which, if de-referenced, results in a document containing machine-readable information about the issuer that can be used to verify the information expressed in the credential.\\n\\nSee  {@link https://www.w3.org/TR/vc-data-model/#issuer | Issuer data model }\"\n        },\n        \"CredentialSubject\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"id\": {\n              \"type\": \"string\"\n            }\n          },\n          \"description\": \"The value of the credentialSubject property is defined as a set of objects that contain one or more properties that are each related to a subject of the verifiable credential. Each object MAY contain an id.\\n\\nSee  {@link https://www.w3.org/TR/vc-data-model/#credential-subject | Credential Subject }\"\n        },\n        \"ContextType\": {\n          \"anyOf\": [\n            {\n              \"type\": \"string\"\n            },\n            {\n              \"type\": \"object\"\n            },\n            {\n              \"type\": \"array\",\n              \"items\": {\n                \"anyOf\": [\n                  {\n                    \"type\": \"string\"\n                  },\n                  {\n                    \"type\": \"object\"\n                  }\n                ]\n              }\n            }\n          ],\n          \"description\": \"The data type for `@context` properties of credentials, presentations, etc.\"\n        },\n        \"CredentialStatusReference\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"id\": {\n              \"type\": \"string\"\n            },\n            \"type\": {\n              \"type\": \"string\"\n            }\n          },\n          \"required\": [\n            \"id\",\n            \"type\"\n          ],\n          \"description\": \"Used for the discovery of information about the current status of a verifiable credential, such as whether it is suspended or revoked. The precise contents of the credential status information are determined by the specific `credentialStatus` type  definition and vary depending on factors such as whether it is simple to implement or if it is privacy-enhancing.\\n\\nSee  {@link https://www.w3.org/TR/vc-data-model/#status | Credential Status }\"\n        },\n        \"DIDDocument\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"authentication\": {\n              \"type\": \"array\",\n              \"items\": {\n                \"anyOf\": [\n                  {\n                    \"type\": \"string\"\n                  },\n                  {\n                    \"$ref\": \"#/components/schemas/VerificationMethod\"\n                  }\n                ]\n              }\n            },\n            \"assertionMethod\": {\n              \"type\": \"array\",\n              \"items\": {\n                \"anyOf\": [\n                  {\n                    \"type\": \"string\"\n                  },\n                  {\n                    \"$ref\": \"#/components/schemas/VerificationMethod\"\n                  }\n                ]\n              }\n            },\n            \"keyAgreement\": {\n              \"type\": \"array\",\n              \"items\": {\n                \"anyOf\": [\n                  {\n                    \"type\": \"string\"\n                  },\n                  {\n                    \"$ref\": \"#/components/schemas/VerificationMethod\"\n                  }\n                ]\n              }\n            },\n            \"capabilityInvocation\": {\n              \"type\": \"array\",\n              \"items\": {\n                \"anyOf\": [\n                  {\n                    \"type\": \"string\"\n                  },\n                  {\n                    \"$ref\": \"#/components/schemas/VerificationMethod\"\n                  }\n                ]\n              }\n            },\n            \"capabilityDelegation\": {\n              \"type\": \"array\",\n              \"items\": {\n                \"anyOf\": [\n                  {\n                    \"type\": \"string\"\n                  },\n                  {\n                    \"$ref\": \"#/components/schemas/VerificationMethod\"\n                  }\n                ]\n              }\n            },\n            \"@context\": {\n              \"anyOf\": [\n                {\n                  \"type\": \"string\",\n                  \"const\": \"https://www.w3.org/ns/did/v1\"\n                },\n                {\n                  \"type\": \"string\"\n                },\n                {\n                  \"type\": \"array\",\n                  \"items\": {\n                    \"type\": \"string\"\n                  }\n                }\n              ]\n            },\n            \"id\": {\n              \"type\": \"string\"\n            },\n            \"alsoKnownAs\": {\n              \"type\": \"array\",\n              \"items\": {\n                \"type\": \"string\"\n              }\n            },\n            \"controller\": {\n              \"anyOf\": [\n                {\n                  \"type\": \"string\"\n                },\n                {\n                  \"type\": \"array\",\n                  \"items\": {\n                    \"type\": \"string\"\n                  }\n                }\n              ]\n            },\n            \"verificationMethod\": {\n              \"type\": \"array\",\n              \"items\": {\n                \"$ref\": \"#/components/schemas/VerificationMethod\"\n              }\n            },\n            \"service\": {\n              \"type\": \"array\",\n              \"items\": {\n                \"$ref\": \"#/components/schemas/Service\"\n              }\n            },\n            \"publicKey\": {\n              \"type\": \"array\",\n              \"items\": {\n                \"$ref\": \"#/components/schemas/VerificationMethod\"\n              },\n              \"deprecated\": true\n            }\n          },\n          \"required\": [\n            \"id\"\n          ],\n          \"description\": \"Represents a DID document.\"\n        },\n        \"VerificationMethod\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"id\": {\n              \"type\": \"string\"\n            },\n            \"type\": {\n              \"type\": \"string\"\n            },\n            \"controller\": {\n              \"type\": \"string\"\n            },\n            \"publicKeyBase58\": {\n              \"type\": \"string\"\n            },\n            \"publicKeyBase64\": {\n              \"type\": \"string\"\n            },\n            \"publicKeyJwk\": {\n              \"$ref\": \"#/components/schemas/JsonWebKey\"\n            },\n            \"publicKeyHex\": {\n              \"type\": \"string\"\n            },\n            \"publicKeyMultibase\": {\n              \"type\": \"string\"\n            },\n            \"blockchainAccountId\": {\n              \"type\": \"string\"\n            },\n            \"ethereumAddress\": {\n              \"type\": \"string\"\n            },\n            \"conditionOr\": {\n              \"type\": \"array\",\n              \"items\": {\n                \"$ref\": \"#/components/schemas/VerificationMethod\"\n              }\n            },\n            \"conditionAnd\": {\n              \"type\": \"array\",\n              \"items\": {\n                \"$ref\": \"#/components/schemas/VerificationMethod\"\n              }\n            },\n            \"threshold\": {\n              \"type\": \"number\"\n            },\n            \"conditionThreshold\": {\n              \"type\": \"array\",\n              \"items\": {\n                \"$ref\": \"#/components/schemas/VerificationMethod\"\n              }\n            },\n            \"conditionWeightedThreshold\": {\n              \"type\": \"array\",\n              \"items\": {\n                \"$ref\": \"#/components/schemas/ConditionWeightedThreshold\"\n              }\n            },\n            \"conditionDelegated\": {\n              \"type\": \"string\"\n            },\n            \"relationshipParent\": {\n              \"type\": \"array\",\n              \"items\": {\n                \"type\": \"string\"\n              }\n            },\n            \"relationshipChild\": {\n              \"type\": \"array\",\n              \"items\": {\n                \"type\": \"string\"\n              }\n            },\n            \"relationshipSibling\": {\n              \"type\": \"array\",\n              \"items\": {\n                \"type\": \"string\"\n              }\n            }\n          },\n          \"required\": [\n            \"id\",\n            \"type\",\n            \"controller\"\n          ],\n          \"description\": \"Represents the properties of a Verification Method listed in a DID document.\\n\\nThis data type includes public key representations that are no longer present in the spec but are still used by several DID methods / resolvers and kept for backward compatibility.\"\n        },\n        \"JsonWebKey\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"alg\": {\n              \"type\": \"string\"\n            },\n            \"crv\": {\n              \"type\": \"string\"\n            },\n            \"e\": {\n              \"type\": \"string\"\n            },\n            \"ext\": {\n              \"type\": \"boolean\"\n            },\n            \"key_ops\": {\n              \"type\": \"array\",\n              \"items\": {\n                \"type\": \"string\"\n              }\n            },\n            \"kid\": {\n              \"type\": \"string\"\n            },\n            \"kty\": {\n              \"type\": \"string\"\n            },\n            \"n\": {\n              \"type\": \"string\"\n            },\n            \"use\": {\n              \"type\": \"string\"\n            },\n            \"x\": {\n              \"type\": \"string\"\n            },\n            \"y\": {\n              \"type\": \"string\"\n            }\n          },\n          \"required\": [\n            \"kty\"\n          ],\n          \"description\": \"Encapsulates a JSON web key type that includes only the public properties that can be used in DID documents.\\n\\nThe private properties are intentionally omitted to discourage the use (and accidental disclosure) of private keys in DID documents.\"\n        },\n        \"ConditionWeightedThreshold\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"condition\": {\n              \"$ref\": \"#/components/schemas/VerificationMethod\"\n            },\n            \"weight\": {\n              \"type\": \"number\"\n            }\n          },\n          \"required\": [\n            \"condition\",\n            \"weight\"\n          ]\n        },\n        \"Service\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"id\": {\n              \"type\": \"string\"\n            },\n            \"type\": {\n              \"type\": \"string\"\n            },\n            \"serviceEndpoint\": {\n              \"anyOf\": [\n                {\n                  \"$ref\": \"#/components/schemas/ServiceEndpoint\"\n                },\n                {\n                  \"type\": \"array\",\n                  \"items\": {\n                    \"$ref\": \"#/components/schemas/ServiceEndpoint\"\n                  }\n                }\n              ]\n            }\n          },\n          \"required\": [\n            \"id\",\n            \"type\",\n            \"serviceEndpoint\"\n          ],\n          \"description\": \"Represents a Service entry in a  {@link https://www.w3.org/TR/did-core/#did-document-properties | DID document } .\"\n        },\n        \"ServiceEndpoint\": {\n          \"anyOf\": [\n            {\n              \"type\": \"string\"\n            },\n            {\n              \"type\": \"object\"\n            }\n          ],\n          \"description\": \"Represents an endpoint of a Service entry in a DID document.\"\n        },\n        \"CredentialStatus\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"revoked\": {\n              \"type\": \"boolean\"\n            }\n          },\n          \"required\": [\n            \"revoked\"\n          ],\n          \"description\": \"Represents the result of a status check.\\n\\nImplementations MUST populate the `revoked` boolean property, but they can return additional metadata that is method-specific.\"\n        }\n      },\n      \"methods\": {\n        \"checkCredentialStatus\": {\n          \"description\": \"Checks the status of a \",\n          \"arguments\": {\n            \"$ref\": \"#/components/schemas/ICheckCredentialStatusArgs\"\n          },\n          \"returnType\": {\n            \"$ref\": \"#/components/schemas/CredentialStatus\"\n          }\n        }\n      }\n    }\n  },\n  \"ICredentialStatusManager\": {\n    \"components\": {\n      \"schemas\": {\n        \"CredentialStatusGenerateArgs\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"type\": {\n              \"type\": \"string\",\n              \"description\": \"The credential status type (aka credential status method) to be used in the `credentialStatus` generation.\"\n            }\n          },\n          \"required\": [\n            \"type\"\n          ],\n          \"additionalProperties\": {\n            \"description\": \"Any other options will be forwarded to the credentialStatus method driver\"\n          },\n          \"description\": \"Arguments for generating a `credentialStatus` property for a  {@link  VerifiableCredential } .\"\n        },\n        \"CredentialStatusReference\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"id\": {\n              \"type\": \"string\"\n            },\n            \"type\": {\n              \"type\": \"string\"\n            }\n          },\n          \"required\": [\n            \"id\",\n            \"type\"\n          ],\n          \"description\": \"Used for the discovery of information about the current status of a verifiable credential, such as whether it is suspended or revoked. The precise contents of the credential status information are determined by the specific `credentialStatus` type  definition and vary depending on factors such as whether it is simple to implement or if it is privacy-enhancing.\\n\\nSee  {@link https://www.w3.org/TR/vc-data-model/#status | Credential Status }\"\n        },\n        \"CredentialStatusUpdateArgs\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"vc\": {\n              \"$ref\": \"#/components/schemas/VerifiableCredential\",\n              \"description\": \"The verifiable credential whose status will be updated.\"\n            },\n            \"options\": {\n              \"type\": \"object\",\n              \"description\": \"Options that will be forwarded to the credentialStatus method specific manager.\"\n            }\n          },\n          \"required\": [\n            \"vc\"\n          ],\n          \"description\": \"Input arguments for  {@link ICredentialStatusManager.credentialStatusUpdate | credentialStatusUpdate }\"\n        },\n        \"VerifiableCredential\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"proof\": {\n              \"$ref\": \"#/components/schemas/ProofType\"\n            },\n            \"issuer\": {\n              \"$ref\": \"#/components/schemas/IssuerType\"\n            },\n            \"credentialSubject\": {\n              \"$ref\": \"#/components/schemas/CredentialSubject\"\n            },\n            \"type\": {\n              \"anyOf\": [\n                {\n                  \"type\": \"array\",\n                  \"items\": {\n                    \"type\": \"string\"\n                  }\n                },\n                {\n                  \"type\": \"string\"\n                }\n              ]\n            },\n            \"@context\": {\n              \"$ref\": \"#/components/schemas/ContextType\"\n            },\n            \"issuanceDate\": {\n              \"type\": \"string\"\n            },\n            \"expirationDate\": {\n              \"type\": \"string\"\n            },\n            \"credentialStatus\": {\n              \"$ref\": \"#/components/schemas/CredentialStatusReference\"\n            },\n            \"id\": {\n              \"type\": \"string\"\n            }\n          },\n          \"required\": [\n            \"@context\",\n            \"credentialSubject\",\n            \"issuanceDate\",\n            \"issuer\",\n            \"proof\"\n          ],\n          \"description\": \"Represents a signed Verifiable Credential payload (includes proof), using a JSON representation. See  {@link https://www.w3.org/TR/vc-data-model/#credentials | VC data model }\"\n        },\n        \"ProofType\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"type\": {\n              \"type\": \"string\"\n            },\n            \"proofValue\": {\n              \"type\": \"string\"\n            }\n          },\n          \"description\": \"A proof property of a  {@link  VerifiableCredential }  or  {@link  VerifiablePresentation }\"\n        },\n        \"IssuerType\": {\n          \"anyOf\": [\n            {\n              \"type\": \"object\",\n              \"properties\": {\n                \"id\": {\n                  \"type\": \"string\"\n                }\n              },\n              \"required\": [\n                \"id\"\n              ]\n            },\n            {\n              \"type\": \"string\"\n            }\n          ],\n          \"description\": \"The issuer of a  {@link  VerifiableCredential }  or the holder of a  {@link  VerifiablePresentation } .\\n\\nThe value of the issuer property MUST be either a URI or an object containing an id property. It is RECOMMENDED that the URI in the issuer or its id be one which, if de-referenced, results in a document containing machine-readable information about the issuer that can be used to verify the information expressed in the credential.\\n\\nSee  {@link https://www.w3.org/TR/vc-data-model/#issuer | Issuer data model }\"\n        },\n        \"CredentialSubject\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"id\": {\n              \"type\": \"string\"\n            }\n          },\n          \"description\": \"The value of the credentialSubject property is defined as a set of objects that contain one or more properties that are each related to a subject of the verifiable credential. Each object MAY contain an id.\\n\\nSee  {@link https://www.w3.org/TR/vc-data-model/#credential-subject | Credential Subject }\"\n        },\n        \"ContextType\": {\n          \"anyOf\": [\n            {\n              \"type\": \"string\"\n            },\n            {\n              \"type\": \"object\"\n            },\n            {\n              \"type\": \"array\",\n              \"items\": {\n                \"anyOf\": [\n                  {\n                    \"type\": \"string\"\n                  },\n                  {\n                    \"type\": \"object\"\n                  }\n                ]\n              }\n            }\n          ],\n          \"description\": \"The data type for `@context` properties of credentials, presentations, etc.\"\n        }\n      },\n      \"methods\": {\n        \"credentialStatusGenerate\": {\n          \"description\": \"Generates a \",\n          \"arguments\": {\n            \"$ref\": \"#/components/schemas/CredentialStatusGenerateArgs\"\n          },\n          \"returnType\": {\n            \"$ref\": \"#/components/schemas/CredentialStatusReference\"\n          }\n        },\n        \"credentialStatusTypes\": {\n          \"description\": \"List all the credential status types (methods) available in the current agent instance.\",\n          \"arguments\": {\n            \"type\": \"object\"\n          },\n          \"returnType\": {\n            \"type\": \"array\",\n            \"items\": {\n              \"type\": \"string\"\n            }\n          }\n        },\n        \"credentialStatusUpdate\": {\n          \"description\": \"Changes the status of an existing \",\n          \"arguments\": {\n            \"$ref\": \"#/components/schemas/CredentialStatusUpdateArgs\"\n          },\n          \"returnType\": {\n            \"type\": \"object\"\n          }\n        }\n      }\n    }\n  }\n}"
  },
  {
    "path": "packages/core-types/src/types/IAgent.ts",
    "content": "/**\n * Agent base interface\n * @public\n */\nexport interface IAgentBase {\n  getSchema: () => IAgentPluginSchema\n  availableMethods: () => string[]\n}\n\n/**\n * Agent that can execute methods\n * @public\n */\nexport interface IAgent extends IAgentBase {\n  execute: <A = any, R = any>(method: string, args: A) => Promise<R>\n  emit: (eventType: string, data: any) => Promise<void>\n}\n\n/**\n * Agent plugin method interface\n * @public\n */\nexport interface IPluginMethod {\n  (args: any, context: any): Promise<any>\n}\n\n/**\n * Plugin method map interface\n * @public\n */\nexport interface IPluginMethodMap extends Record<string, IPluginMethod> {}\n\n/**\n * Agent plugin schema\n * @public\n */\nexport interface IAgentPluginSchema {\n  components: {\n    schemas: any\n    methods: any\n  }\n}\n\n/**\n * Describes a listener interface that needs to be implemented by components interested\n * in listening to events emitted by an agent.\n *\n * @public\n */\nexport interface IEventListener {\n  /**\n   * Declares the event types that this listener is interested in.\n   * @public\n   */\n  readonly eventTypes?: string[]\n  /**\n   * Processes an event emitted by the agent.\n   * @param context - Execution context. Requires agent with {@link @veramo/core-types#IDataStore} methods\n   * @public\n   */\n  onEvent?(event: { type: string; data: any }, context: IAgentContext<{}>): Promise<void>\n}\n\n/**\n * Agent plugin interface\n * @public\n */\nexport interface IAgentPlugin extends IEventListener {\n  readonly methods?: IPluginMethodMap\n  readonly schema?: IAgentPluginSchema\n}\n\n/**\n * Removes context parameter from plugin method interface\n * @public\n */\nexport interface RemoveContext<T extends IPluginMethod> {\n  (args?: Parameters<T>[0] | undefined): ReturnType<T>\n}\n\n/**\n * Utility type for constructing agent type that has a list of available methods\n * @public\n */\nexport type TAgent<T extends IPluginMethodMap> = {\n  [P in keyof T]: RemoveContext<T[P]>\n} & IAgent\n\n/**\n * Standard plugin method context interface\n *\n * @remarks\n * When executing plugin method, you don't need to pass in the context.\n * It is done automatically by the agent\n *\n * @example\n * ```typescript\n * await agent.resolveDid({\n *   didUrl: 'did:example:123'\n * })\n * ```\n * @public\n */\nexport interface IAgentContext<T extends IPluginMethodMap> {\n  /**\n   * Configured agent\n   */\n  agent: TAgent<T>\n}\n"
  },
  {
    "path": "packages/core-types/src/types/ICredentialIssuer.ts",
    "content": "import { IAgentContext, IPluginMethodMap } from './IAgent.js'\nimport {\n  CredentialPayload,\n  PresentationPayload,\n  VerifiableCredential,\n  VerifiablePresentation,\n} from './vc-data-model.js'\nimport { IResolver } from './IResolver.js'\nimport { IDIDManager } from './IDIDManager.js'\nimport { IDataStore } from './IDataStore.js'\nimport { IKeyManager } from './IKeyManager.js'\nimport { IIdentifier } from './IIdentifier.js'\nimport { UsingResolutionOptions } from './ICredentialVerifier.js'\n\n/**\n * Constants representing internally supported proof formats.\n *\n * @internal\n */\nexport const PROOF_FORMAT = {\n  ETHEREUM_EIP712_SIGNATURE_2021: 'EthereumEip712Signature2021',\n  JWT: 'jwt',\n  LD_SIGNATURE: 'lds',\n  BBS_PLUS: 'bbs+',\n} as const\n\n/**\n * Represents a format for a particular type of verifiable data.\n * This is an extensible union of several known formats implemented by Veramo\n * @public\n */\nexport type ProofFormat = (typeof PROOF_FORMAT)[keyof typeof PROOF_FORMAT] | (string & {})\n\n/**\n * Encapsulates the parameters required to create a\n * {@link https://www.w3.org/TR/vc-data-model/#presentations | W3C Verifiable Presentation}\n *\n * @public\n */\nexport interface ICreateVerifiablePresentationArgs extends UsingResolutionOptions {\n  /**\n   * The JSON payload of the Presentation according to the\n   * {@link https://www.w3.org/TR/vc-data-model/#presentations | canonical model}.\n   *\n   * The signer of the Presentation is chosen based on the `holder` property\n   * of the `presentation`\n   *\n   * `@context`, `type` and `issuanceDate` will be added automatically if omitted\n   */\n  presentation: PresentationPayload\n\n  /**\n   * If this parameter is true, the resulting VerifiablePresentation is sent to the\n   * {@link @veramo/core-types#IDataStore | storage plugin} to be saved.\n   * <p/><p/>\n   * @deprecated Please call\n   *   {@link @veramo/core-types#IDataStore.dataStoreSaveVerifiablePresentation |\n   *   dataStoreSaveVerifiablePresentation()} to save the credential after creating it.\n   */\n  save?: boolean\n\n  /**\n   * Optional (only JWT) string challenge parameter to add to the verifiable presentation.\n   */\n  challenge?: string\n\n  /**\n   * Optional string domain parameter to add to the verifiable presentation.\n   */\n  domain?: string\n\n  /**\n   * The desired format for the VerifiablePresentation to be created.\n   */\n  proofFormat: ProofFormat\n\n  /**\n   * Remove payload members during JWT-JSON transformation. Defaults to `true`.\n   * See https://www.w3.org/TR/vc-data-model/#jwt-encoding\n   */\n  removeOriginalFields?: boolean\n\n  /**\n   * [Optional] The ID of the key that should sign this presentation.\n   * If this is not specified, the first matching key will be used.\n   */\n  keyRef?: string\n\n  /**\n   * When dealing with JSON-LD, you also MUST provide the proper contexts.\n   * Set this to `true` ONLY if you want the `@context` URLs to be fetched in case they are not preloaded.\n   * The context definitions SHOULD rather be provided at startup instead of being fetched.\n   *\n   * Defaults to `false`\n   */\n  fetchRemoteContexts?: boolean\n\n  /**\n   * Any other options that can be forwarded to the lower level libraries\n   */\n  [x: string]: any\n}\n\n/**\n * Encapsulates the parameters required to create a\n * {@link https://www.w3.org/TR/vc-data-model/#credentials | W3C Verifiable Credential}\n *\n * @public\n */\nexport interface ICreateVerifiableCredentialArgs extends UsingResolutionOptions {\n  /**\n   * The JSON payload of the Credential according to the\n   * {@link https://www.w3.org/TR/vc-data-model/#credentials | canonical model}\n   *\n   * The signer of the Credential is chosen based on the `issuer.id` property\n   * of the `credential`\n   *\n   * `@context`, `type` and `issuanceDate` will be added automatically if omitted\n   */\n  credential: CredentialPayload\n\n  /**\n   * If this parameter is true, the resulting VerifiableCredential is sent to the\n   * {@link @veramo/core-types#IDataStore | storage plugin} to be saved.\n   *\n   * @deprecated Please call\n   *   {@link @veramo/core-types#IDataStore.dataStoreSaveVerifiableCredential | dataStoreSaveVerifiableCredential()} to\n   *   save the credential after creating it.\n   */\n  save?: boolean\n\n  /**\n   * The desired format for the VerifiableCredential to be created.\n   */\n  proofFormat: ProofFormat\n\n  /**\n   * Remove payload members during JWT-JSON transformation. Defaults to `true`.\n   * See https://www.w3.org/TR/vc-data-model/#jwt-encoding\n   */\n  removeOriginalFields?: boolean\n\n  /**\n   * [Optional] The ID of the key that should sign this credential.\n   * If this is not specified, the first matching key will be used.\n   */\n  keyRef?: string\n\n  /**\n   * When dealing with JSON-LD, you also MUST provide the proper contexts.\n   * Set this to `true` ONLY if you want the `@context` URLs to be fetched in case they are not preloaded.\n   * The context definitions SHOULD rather be provided at startup instead of being fetched.\n   *\n   * Defaults to `false`\n   */\n  fetchRemoteContexts?: boolean\n\n  /**\n   * Any other options that can be forwarded to the lower level libraries\n   */\n  [x: string]: any\n}\n\n/**\n * The interface definition for a plugin that can generate Verifiable Credentials and Presentations\n *\n * @see {@link @veramo/credential-w3c#CredentialPlugin} for an implementation.\n * @remarks Please see {@link https://www.w3.org/TR/vc-data-model | W3C Verifiable Credentials data model}\n *\n * @public\n */\nexport interface ICredentialIssuer extends IPluginMethodMap {\n  /**\n   * Creates a Verifiable Presentation.\n   * The payload, signer and format are chosen based on the `args` parameter.\n   *\n   * @param args - Arguments necessary to create the Presentation.\n   * @param context - This reserved param is automatically added and handled by the framework, *do not override*\n   *\n   * @returns - a promise that resolves to the {@link @veramo/core-types#VerifiablePresentation} that was requested or\n   *   rejects with an error if there was a problem with the input or while getting the key to sign\n   *\n   * @remarks Please see {@link https://www.w3.org/TR/vc-data-model/#presentations | Verifiable Presentation data model\n   *   }\n   */\n  createVerifiablePresentation(\n    args: ICreateVerifiablePresentationArgs,\n    context: IssuerAgentContext,\n  ): Promise<VerifiablePresentation>\n\n  /**\n   * Creates a Verifiable Credential.\n   * The payload, signer, and format are chosen based on the `args` parameter.\n   *\n   * @param args - Arguments necessary to create the Presentation.\n   * @param context - This reserved param is automatically added and handled by the framework, *do not override*\n   *\n   * @returns - a promise that resolves to the {@link @veramo/core-types#VerifiableCredential} that was requested or\n   *   rejects with an error if there was a problem with the input or while getting the key to sign\n   *\n   * @remarks Please see {@link https://www.w3.org/TR/vc-data-model/#credentials | Verifiable Credential data model}\n   */\n  createVerifiableCredential(\n    args: ICreateVerifiableCredentialArgs,\n    context: IssuerAgentContext,\n  ): Promise<VerifiableCredential>\n\n  /**\n   * Returns a list of supported proof formats for verifiable data that this plugin can generate based on the specified issuer.\n   * @param identifier - The identifier that may be used to sign a credential or presentation\n   * @param context - This reserved param is automatically added and handled by the framework, *do not override*\n   *\n   * @beta This API may change without a BREAKING CHANGE notice.\n   */\n  listUsableProofFormats(identifier: IIdentifier, context: IAgentContext<{}>): Promise<Array<ProofFormat>>\n}\n\n/**\n * Represents the requirements that this plugin has.\n * The agent using this plugin is expected to provide these methods.\n *\n * This interface can be used for static type checks to make sure your application is properly initialized.\n *\n * @beta\n */\nexport type IssuerAgentContext = IAgentContext<\n  IResolver &\n    Pick<IDIDManager, 'didManagerGet' | 'didManagerFind'> &\n    Pick<IDataStore, 'dataStoreSaveVerifiablePresentation' | 'dataStoreSaveVerifiableCredential'> &\n    Pick<IKeyManager, 'keyManagerGet' | 'keyManagerSign'>\n>\n"
  },
  {
    "path": "packages/core-types/src/types/ICredentialPlugin.ts",
    "content": "import { ICredentialIssuer } from './ICredentialIssuer.js'\nimport { ICredentialVerifier } from './ICredentialVerifier.js'\n\n/**\n * The interface definition for a plugin that can generate and verify Verifiable Credentials and Presentations\n *\n * @remarks Please see {@link https://www.w3.org/TR/vc-data-model | W3C Verifiable Credentials data model}\n *\n * @public\n */\nexport type ICredentialPlugin = ICredentialIssuer & ICredentialVerifier\n"
  },
  {
    "path": "packages/core-types/src/types/ICredentialStatus.ts",
    "content": "import { ICredentialStatusVerifier } from './ICredentialStatusVerifier.js'\nimport { ICredentialStatusManager } from './ICredentialStatusManager.js'\n\n/**\n * Veramo plugin interface for plugins implementing both the {@link ICredentialStatusManager | manager} and the\n * {@link ICredentialStatusVerifier | verifier} aspects of Credential Status flow.\n *\n * @see {@link https://www.w3.org/TR/vc-data-model/#status | credentialStatus} data model\n * @see {@link @veramo/credential-status#CredentialStatusPlugin | CredentialStatusPlugin}\n *\n * @beta\n */\nexport type ICredentialStatus = ICredentialStatusVerifier & ICredentialStatusManager\n"
  },
  {
    "path": "packages/core-types/src/types/ICredentialStatusManager.ts",
    "content": "export { DIDDocument, DIDResolutionOptions, DIDResolutionResult } from 'did-resolver'\nimport { IPluginMethodMap } from './IAgent.js'\nimport { CredentialStatusReference, VerifiableCredential } from './vc-data-model.js'\n\n/**\n * The arguments expected by a plugin that implements a credential status type/method\n * in order to change the status of an issued verifiable credential.\n *\n * Each credential status type has its own specific parameters according to their spec.\n *\n * @see {@link https://w3c-ccg.github.io/vc-status-list-2021/ | StatusList2021Entry }\n * @see {@link https://w3c-ccg.github.io/vc-csl2017/ | CredentialStatusList2017 }\n * @see {@link https://www.w3.org/TR/vc-data-model/#status | credential status data model }\n *\n * @beta\n */\ninterface CredentialStatusUpdateOptions {\n  [x: string]: any\n}\n\n/**\n * Input arguments for {@link ICredentialStatusManager.credentialStatusUpdate  | credentialStatusUpdate}\n * @beta\n */\nexport interface CredentialStatusUpdateArgs {\n  /**\n   * The verifiable credential whose status will be updated.\n   */\n  vc: VerifiableCredential\n\n  /**\n   * Options that will be forwarded to the credentialStatus method specific manager.\n   *\n   * @see {@link https://www.w3.org/TR/vc-data-model/#status}\n   */\n  options?: CredentialStatusUpdateOptions\n}\n\n/**\n * Arguments for generating a `credentialStatus` property for a {@link VerifiableCredential}.\n * @see {@link ICredentialStatusManager.credentialStatusGenerate | credentialStatusGenerate}\n *\n * @beta\n */\nexport interface CredentialStatusGenerateArgs {\n  /**\n   * The credential status type (aka credential status method) to be used in the `credentialStatus` generation.\n   */\n  type: string\n\n  /**\n   * Any other options will be forwarded to the credentialStatus method driver\n   */\n  [x: string]: any\n}\n\n/**\n * Credential status manager interface\n * @beta\n */\nexport interface ICredentialStatusManager extends IPluginMethodMap {\n  /**\n   * Changes the status of an existing {@link VerifiableCredential}.\n   * Commonly used to revoke an existing credential.\n   *\n   * @param args - Input arguments for updating the status(revoking) a credential\n   * @beta\n   */\n  credentialStatusUpdate(args: CredentialStatusUpdateArgs): Promise<any>\n\n  /**\n   * Generates a `credentialStatus` property for a future credential, not yet signed.\n   *\n   * This method is used during the creation of a {@link VerifiableCredential} in order to make it capable of\n   * having its status updated later (to be revoked).\n   *\n   * @param args - Input arguments for generating the `credentialStatus` field of a new credential\n   * @beta\n   */\n  credentialStatusGenerate(args: CredentialStatusGenerateArgs): Promise<CredentialStatusReference>\n\n  /**\n   * List all the credential status types (methods) available in the current agent instance.\n   */\n  credentialStatusTypes(): Promise<Array<string>>\n}\n"
  },
  {
    "path": "packages/core-types/src/types/ICredentialStatusVerifier.ts",
    "content": "import { DIDDocument } from 'did-resolver'\nimport { IAgentContext, IPluginMethodMap } from './IAgent.js'\nimport { VerifiableCredential, CredentialStatus } from './vc-data-model.js'\nimport { IResolver } from './IResolver.js'\nimport { UsingResolutionOptions } from './ICredentialVerifier.js'\n\n/**\n * Arguments for calling {@link ICredentialStatusVerifier.checkCredentialStatus | checkCredentialStatus}.\n *\n * The credential whose status should be checked and the DID document of the credential issuer.\n *\n * See {@link https://www.w3.org/TR/vc-data-model/#status | Credential Status}\n *\n * @beta This API may change without a BREAKING CHANGE notice.\n */\nexport interface ICheckCredentialStatusArgs extends UsingResolutionOptions {\n  /**\n   * The credential whose status needs to be checked\n   */\n  credential: VerifiableCredential\n\n  /**\n   * The DID document of the issuer. This can be used in case the DID Document is already resolver, to avoid a\n   * potentially expensive DID resolution operation.\n   */\n  didDocumentOverride?: DIDDocument\n}\n\n/**\n * This interface defines a plugin that can check the {@link https://www.w3.org/TR/vc-data-model/#status | status} of a\n * {@link @veramo/core-types#VerifiableCredential | Verifiable Credential}.\n *\n * This is used for the discovery of information about the current status of a verifiable credential, such as whether\n * it is suspended or revoked. The precise contents of the credential status information is determined by the specific\n * `credentialStatus` type definition, and varies depending on factors such as whether it is simple to implement or if\n * it is privacy-enhancing.\n *\n * The result provided by implementations of this plugin depend on whether the implementation of the StatusMethod is\n * available.\n *\n * @see {@link https://www.w3.org/TR/vc-data-model/#status | Credential Status} for data model documentation.\n * @see {@link @veramo/credential-status#CredentialStatusPlugin | CredentialStatusPlugin } for an implementation.\n *\n * @beta This API may change without a BREAKING CHANGE notice.\n */\nexport interface ICredentialStatusVerifier extends IPluginMethodMap {\n  /**\n   * Checks the status of a {@link @veramo/core-types#VerifiableCredential | Verifiable Credential}.\n   *\n   * @param args - The credential to be checked, along with the DID document of the issuer.\n   * @param context - *RESERVED* This is filled by the framework when the method is called.\n   */\n  checkCredentialStatus(\n    args: ICheckCredentialStatusArgs,\n    context: IAgentContext<IResolver>,\n  ): Promise<CredentialStatus>\n}\n"
  },
  {
    "path": "packages/core-types/src/types/ICredentialVerifier.ts",
    "content": "import { IAgentContext, IPluginMethodMap } from './IAgent.js'\nimport { IVerifyResult } from './IVerifyResult.js'\nimport { W3CVerifiableCredential, W3CVerifiablePresentation } from './vc-data-model.js'\nimport { IResolver } from './IResolver.js'\nimport { IDIDManager } from './IDIDManager.js'\nimport { DIDResolutionOptions } from 'did-resolver'\n\n/**\n * Options that are forwarded to the DID resolver.\n * @public\n */\nexport interface UsingResolutionOptions {\n  /**\n   * Options to be passed to the DID resolver.\n   */\n  resolutionOptions?: DIDResolutionOptions & {\n    // Used by did:key to determine the format of the public key. Specified here for discoverability.\n    publicKeyFormat?: string\n  }\n}\n\n/**\n * Encapsulates the parameters required to verify a\n * {@link https://www.w3.org/TR/vc-data-model/#credentials | W3C Verifiable Credential}\n *\n * @public\n */\nexport interface IVerifyCredentialArgs extends UsingResolutionOptions {\n  /**\n   * The Verifiable Credential object according to the\n   * {@link https://www.w3.org/TR/vc-data-model/#credentials | canonical model} or\n   * the {@link https://www.w3.org/TR/vc-data-model-1.1/#json-web-token | JWT representation}.\n   *\n   * The signer of the Credential is verified based on the `issuer.id` property\n   * of the `credential` or the `iss` property of the JWT payload respectively\n   *\n   */\n  credential: W3CVerifiableCredential\n\n  /**\n   * When dealing with JSON-LD you also MUST provide the proper contexts.\n   * Set this to `true` ONLY if you want the `@context` URLs to be fetched in case they are not preloaded.\n   * The context definitions SHOULD rather be provided at application startup instead of being fetched.\n   *\n   * Defaults to `false`\n   */\n  fetchRemoteContexts?: boolean\n\n  /**\n   * Overrides specific aspects of credential verification, where possible.\n   */\n  policies?: VerificationPolicies\n\n  /**\n   * Other options can be specified for verification.\n   * They will be forwarded to the lower level modules. that perform the checks\n   */\n  [x: string]: any\n}\n\n/**\n * Encapsulates the parameters required to verify a\n * {@link https://www.w3.org/TR/vc-data-model/#presentations | W3C Verifiable Presentation}\n *\n * @public\n */\nexport interface IVerifyPresentationArgs extends UsingResolutionOptions {\n  /**\n   * The Verifiable Presentation object according to the\n   * {@link https://www.w3.org/TR/vc-data-model/#presentations | canonical model} or the JWT representation.\n   *\n   * The signer of the Presentation is verified based on the `holder` property\n   * of the `presentation` or the `iss` property of the JWT payload respectively\n   *\n   */\n  presentation: W3CVerifiablePresentation\n\n  /**\n   * Optional (only for JWT) string challenge parameter to verify the verifiable presentation against\n   */\n  challenge?: string\n\n  /**\n   * Optional (only for JWT) string domain parameter to verify the verifiable presentation against\n   */\n  domain?: string\n\n  /**\n   * When dealing with JSON-LD you also MUST provide the proper contexts.\n   * Set this to `true` ONLY if you want the `@context` URLs to be fetched in case they are not preloaded.\n   * The context definitions SHOULD rather be provided at startup instead of being fetched.\n   *\n   * Defaults to `false`\n   */\n  fetchRemoteContexts?: boolean\n\n  /**\n   * Overrides specific aspects of credential verification, where possible.\n   */\n  policies?: VerificationPolicies\n\n  /**\n   * Other options can be specified for verification.\n   * They will be forwarded to the lower level modules. that perform the checks\n   */\n  [x: string]: any\n}\n\n/**\n * These optional settings can be used to override some default checks that are performed on Presentations during\n * verification.\n *\n * @beta\n */\nexport interface VerificationPolicies {\n  /**\n   * policy to over the now (current time) during the verification check (UNIX time in seconds)\n   */\n  now?: number\n\n  /**\n   * policy to skip the issuanceDate (nbf) timestamp check when set to `false`\n   */\n  issuanceDate?: boolean\n\n  /**\n   * policy to skip the expirationDate (exp) timestamp check when set to `false`\n   */\n  expirationDate?: boolean\n\n  /**\n   * policy to skip the audience check when set to `false`\n   */\n  audience?: boolean\n\n  /**\n   * policy to skip the revocation check (credentialStatus) when set to `false`\n   */\n  credentialStatus?: boolean\n\n  /**\n   * Other options can be specified for verification.\n   * They will be forwarded to the lower level modules that perform the checks\n   */\n  [x: string]: any\n}\n\n/**\n * The interface definition for a plugin that can generate Verifiable Credentials and Presentations\n *\n * @see {@link @veramo/credential-w3c#CredentialPlugin} for an implementation.\n * @remarks Please see {@link https://www.w3.org/TR/vc-data-model | W3C Verifiable Credentials data model}\n *\n * @public\n */\nexport interface ICredentialVerifier extends IPluginMethodMap {\n  /**\n   * Verifies a Verifiable Credential\n   *\n   * @param args - Arguments necessary to verify a VerifiableCredential\n   * @param context - This reserved param is automatically added and handled by the framework, *do not override*\n   *\n   * @returns - a promise that resolves to an object containing a `verified` boolean property and an optional `error`\n   *   for details\n   *\n   * @remarks Please see {@link https://www.w3.org/TR/vc-data-model/#credentials | Verifiable Credential data model}\n   */\n  verifyCredential(args: IVerifyCredentialArgs, context: VerifierAgentContext): Promise<IVerifyResult>\n\n  /**\n   * Verifies a Verifiable Presentation JWT or LDS Format.\n   *\n   * @param args - Arguments necessary to verify a VerifiableCredential\n   * @param context - This reserved param is automatically added and handled by the framework, *do not override*\n   *\n   * @returns - a promise that resolves to an object containing a `verified` boolean property and an optional `error`\n   *   for details\n   *\n   * @remarks Please see {@link https://www.w3.org/TR/vc-data-model/#presentations | Verifiable Credential data model}\n   */\n  verifyPresentation(args: IVerifyPresentationArgs, context: VerifierAgentContext): Promise<IVerifyResult>\n}\n\n/**\n * Represents the requirements that this plugin has.\n * The agent that is using this plugin is expected to provide these methods.\n *\n * This interface can be used for static type checks, to make sure your application is properly initialized.\n *\n * @beta\n */\nexport type VerifierAgentContext = IAgentContext<\n  IResolver & Pick<IDIDManager, 'didManagerGet' | 'didManagerFind'>\n>\n"
  },
  {
    "path": "packages/core-types/src/types/IDIDManager.ts",
    "content": "import { DIDDocument } from 'did-resolver'\nimport { IAgentContext, IPluginMethodMap } from './IAgent.js'\nimport { IIdentifier, IKey, IService, MinimalImportableIdentifier } from './IIdentifier.js'\nimport { IKeyManager } from './IKeyManager.js'\n\n/**\n * Input arguments for {@link IDIDManager.didManagerGet | didManagerGet}\n * @public\n */\nexport interface IDIDManagerGetArgs {\n  /**\n   * DID\n   */\n  did: string\n}\n\n/**\n * Input arguments for {@link IDIDManager.didManagerFind | didManagerFind}\n * @public\n */\nexport interface IDIDManagerFindArgs {\n  /**\n   * Optional. Alias\n   */\n  alias?: string\n\n  /**\n   * Optional. Provider\n   */\n  provider?: string\n}\n\n/**\n * Input arguments for {@link IDIDManager.didManagerGetByAlias | didManagerGetByAlias}\n * @public\n */\nexport interface IDIDManagerGetByAliasArgs {\n  /**\n   * Alias\n   */\n  alias: string\n\n  /**\n   * Optional provider\n   */\n  provider?: string\n}\n\n/**\n * Input arguments for {@link IDIDManager.didManagerDelete | didManagerDelete}\n * @public\n */\nexport interface IDIDManagerDeleteArgs {\n  /**\n   * DID\n   */\n  did: string\n}\n\n/**\n * Input arguments for {@link IDIDManager.didManagerCreate | didManagerCreate}\n * @public\n */\nexport interface IDIDManagerCreateArgs {\n  /**\n   * Optional. Identifier alias. Can be used to reference an object in an external system\n   */\n  alias?: string\n\n  /**\n   * Optional. Identifier provider\n   */\n  provider?: string\n\n  /**\n   * Optional. Key Management System\n   */\n  kms?: string\n\n  /**\n   * Optional. Identifier-provider specific options\n   */\n  options?: object\n}\n\n/**\n * Input arguments for {@link IDIDManager.didManagerSetAlias | didManagerSetAlias}\n * @public\n */\nexport interface IDIDManagerSetAliasArgs {\n  /**\n   * Required. DID\n   */\n  did: string\n\n  /**\n   * Required. Identifier alias\n   */\n  alias: string\n}\n\n/**\n * Input arguments for {@link IDIDManager.didManagerGetOrCreate | didManagerGetOrCreate}\n * @public\n */\nexport interface IDIDManagerGetOrCreateArgs {\n  /**\n   * Identifier alias. Can be used to reference an object in an external system\n   */\n  alias: string\n\n  /**\n   * Optional. Identifier provider\n   */\n  provider?: string\n\n  /**\n   * Optional. Key Management System\n   */\n  kms?: string\n\n  /**\n   * Optional. Identifier-provider specific options\n   */\n  options?: object\n}\n\n/**\n * The arguments necessary to perform a full DID document update for a DID.\n *\n * @see {@link IDIDManager.didManagerUpdate | didManagerUpdate}\n *\n * @beta\n */\nexport interface IDIDManagerUpdateArgs {\n  /**\n   * Required. DID\n   */\n  did: string\n\n  /**\n   * Required\n   */\n  document: Partial<DIDDocument>\n\n  /**\n   * Identifier provider specific options.\n   *\n   * @see {@link @veramo/did-manager#AbstractIdentifierProvider | AbstractIdentifierProvider}\n   */\n  options?: {\n    /**\n     * Optional flag to indicate that the changes will only be applied to the local DIDStore tracking and this update will not be published to any underlying registries\n     * AbstractIdentifierProvider implementations must respect this flag where applicable. Defaults to false.\n     * @default false\n     */\n    localOnly?: boolean\n    [x: string]: any\n  }\n}\n\n/**\n * Input arguments for {@link IDIDManager.didManagerAddKey | didManagerAddKey}\n * @public\n */\nexport interface IDIDManagerAddKeyArgs {\n  /**\n   * DID\n   */\n  did: string\n\n  /**\n   * Key object\n   */\n  key: IKey\n\n  /**\n   * Optional. Identifier-provider specific options\n   */\n  options?: {\n    /**\n     * Optional flag to indicate that the key should only be added to the local DIDStore tracking and this update will not be published to any underlying registries\n     * @default false\n     */\n    localOnly?: boolean\n    [key: string]: any\n  }\n}\n\n/**\n * Input arguments for {@link IDIDManager.didManagerRemoveKey | didManagerRemoveKey}\n * @public\n */\nexport interface IDIDManagerRemoveKeyArgs {\n  /**\n   * DID\n   */\n  did: string\n\n  /**\n   * Key ID\n   */\n  kid: string\n\n  /**\n   * Optional. Identifier-provider specific options\n   */\n  options?: {\n    /**\n     * Optional flag to indicate that the key should only be removed from the local DIDStore tracking and this update will not be published to any underlying registries\n     * @default false\n     */\n    localOnly?: boolean\n    [key: string]: any\n  }\n}\n\n/**\n * Input arguments for {@link IDIDManager.didManagerAddService | didManagerAddService}\n * @public\n */\nexport interface IDIDManagerAddServiceArgs {\n  /**\n   * DID\n   */\n  did: string\n\n  /**\n   * Service object\n   */\n  service: IService\n\n  /**\n   * Optional. Identifier-provider specific options\n   */\n  options?: {\n    /**\n     * Optional flag to indicate that the service should only be added to the local DIDStore tracking and this update will not be published to any underlying registries\n     * @default false\n     */\n    localOnly?: boolean\n    [key: string]: any\n  }\n}\n\n/**\n * Input arguments for {@link IDIDManager.didManagerRemoveService | didManagerRemoveService}\n * @public\n */\nexport interface IDIDManagerRemoveServiceArgs {\n  /**\n   * DID\n   */\n  did: string\n\n  /**\n   * Service ID\n   */\n  id: string\n\n  /**\n   * Optional. Identifier-provider specific options\n   */\n  options?: {\n    /**\n     * Optional flag to indicate that the service should only be removed from the local DIDStore tracking and this update will not be published to any underlying registries\n     * @default false\n     */\n    localOnly?: boolean\n    [key: string]: any\n  }\n}\n\n/**\n * Identifier manager interface\n * @public\n */\nexport interface IDIDManager extends IPluginMethodMap {\n  /**\n   * Returns a list of available identifier providers\n   */\n  didManagerGetProviders(): Promise<Array<string>>\n\n  /**\n   * Returns a list of managed identifiers\n   *\n   * @param args - Required. Arguments to get the list of identifiers\n   *\n   * @example\n   * ```typescript\n   * const aliceIdentifiers = await agent.didManagerFind({\n   *   alias: 'alice'\n   * })\n   *\n   * const sepoliaIdentifiers = await agent.didManagerFind({\n   *   provider: 'did:ethr'\n   * })\n   * ```\n   */\n  didManagerFind(args: IDIDManagerFindArgs): Promise<Array<IIdentifier>>\n\n  /**\n   * Returns a specific identifier\n   */\n  didManagerGet(args: IDIDManagerGetArgs): Promise<IIdentifier>\n\n  /**\n   * Returns a specific identifier by alias\n   *\n   * @param args - Required. Arguments to get the identifier\n   *\n   * @example\n   * ```typescript\n   * const identifier = await agent.didManagerGetByAlias({\n   *   alias: 'charlie',\n   *   provider: 'did:ethr'\n   * })\n   * ```\n   */\n  didManagerGetByAlias(args: IDIDManagerGetByAliasArgs): Promise<IIdentifier>\n\n  /**\n   * Creates and returns a new identifier\n   *\n   * @param args - Required. Arguments to create the identifier\n   * @param context - *RESERVED* This is filled by the framework when the method is called. This method's\n   *    <a href=\"/docs/agent/plugins#executing-plugin-methods\">execution context</a> requires an `agent` that has\n   *   {@link @veramo/core-types#IKeyManager} methods.\n   *\n   * @example\n   * ```typescript\n   * const identifier = await agent.didManagerCreate({\n   *   alias: 'charlie',\n   *   provider: 'did:ethr',\n   *   kms: 'local'\n   * })\n   * ```\n   */\n  didManagerCreate(args: IDIDManagerCreateArgs, context: IAgentContext<IKeyManager>): Promise<IIdentifier>\n\n  /**\n   * Sets identifier alias\n   *\n   * @param args - Required. Arguments to set identifier alias\n   * @param context - <a href=\"/docs/agent/plugins#executing-plugin-methods\">Execution context</a>. Requires `agent`\n   *   that has {@link @veramo/core-types#IKeyManager} methods\n   *\n   * @example\n   * ```typescript\n   * const identifier = await agent.didManagerCreate()\n   * const result = await agent.didManagerSetAlias({\n   *   did: identifier.did,\n   *   alias: 'carol',\n   * })\n   * ```\n   */\n  didManagerSetAlias(args: IDIDManagerSetAliasArgs, context: IAgentContext<IKeyManager>): Promise<boolean>\n\n  /**\n   * Returns an existing identifier or creates a new one for a specific alias\n   * @param args - The alias used for the search and the provider/kms/options used to create the DID when none is\n   *   found.\n   * @param context - *RESERVED* This is filled by the framework when the method is called. This method's\n   *    <a href=\"/docs/agent/plugins#executing-plugin-methods\">execution context</a> requires an `agent` that has\n   *   {@link @veramo/core-types#IKeyManager} methods.\n   */\n  didManagerGetOrCreate(\n    args: IDIDManagerGetOrCreateArgs,\n    context: IAgentContext<IKeyManager>,\n  ): Promise<IIdentifier>\n\n  /**\n   * Updates the DID document of a managed {@link @veramo/core-types#IIdentifier | DID}.\n   * @param args - the arguments necessary for the update. The options are specific for each DID provider.\n   * @param context - *RESERVED* This is filled by the framework when the method is called. This method's\n   *   <a href=\"/docs/agent/plugins#executing-plugin-methods\">execution context</a> requires an `agent` that has\n   *   {@link @veramo/core-types#IKeyManager} methods.\n   */\n  didManagerUpdate(args: IDIDManagerUpdateArgs, context: IAgentContext<IKeyManager>): Promise<IIdentifier>\n\n  /**\n   * Imports identifier\n   */\n  didManagerImport(\n    args: MinimalImportableIdentifier,\n    context: IAgentContext<IKeyManager>,\n  ): Promise<IIdentifier>\n\n  /**\n   * Deletes identifier\n   */\n  didManagerDelete(args: IDIDManagerDeleteArgs, context: IAgentContext<IKeyManager>): Promise<boolean>\n\n  /**\n   * Adds a key to a DID Document\n   * @returns identifier provider specific response. Can be txHash, etc,\n   */\n  didManagerAddKey(args: IDIDManagerAddKeyArgs, context: IAgentContext<IKeyManager>): Promise<any>\n\n  /**\n   * Removes a key from a DID Document\n   * @returns identifier provider specific response. Can be txHash, etc,\n   */\n  didManagerRemoveKey(args: IDIDManagerRemoveKeyArgs, context: IAgentContext<IKeyManager>): Promise<any> // txHash?\n\n  /**\n   * Adds a service to a DID Document\n   * @returns identifier provider specific response. Can be txHash, etc,\n   */\n  didManagerAddService(args: IDIDManagerAddServiceArgs, context: IAgentContext<IKeyManager>): Promise<any> //txHash?\n\n  /**\n   * Removes a service from a DID Document\n   * @returns identifier provider specific response. Can be txHash, etc,\n   */\n  didManagerRemoveService(\n    args: IDIDManagerRemoveServiceArgs,\n    context: IAgentContext<IKeyManager>,\n  ): Promise<any> //txHash?\n}\n"
  },
  {
    "path": "packages/core-types/src/types/IDataStore.ts",
    "content": "import { IPluginMethodMap } from './IAgent.js'\nimport { IMessage } from './IMessage.js'\nimport { VerifiableCredential, VerifiablePresentation } from './vc-data-model.js'\n\n/**\n * Input arguments for {@link IDataStore.dataStoreSaveMessage | dataStoreSaveMessage}\n * @public\n */\nexport interface IDataStoreSaveMessageArgs {\n  /**\n   * Required. Message\n   */\n  message: IMessage\n}\n\n/**\n * Input arguments for {@link IDataStore.dataStoreGetMessage | dataStoreGetMessage}\n * @public\n */\nexport interface IDataStoreGetMessageArgs {\n  /**\n   * Required. Message ID\n   */\n  id: string\n}\n\n/**\n * Input arguments for {@link IDataStore.dataStoreDeleteMessage | dataStoreDeleteMessage}\n * @public\n */\nexport interface IDataStoreDeleteMessageArgs {\n  /**\n   * Required. Message ID\n   */\n  id: string\n}\n\n/**\n * Input arguments for {@link IDataStore.dataStoreSaveVerifiableCredential | dataStoreSaveVerifiableCredential}\n * @public\n */\nexport interface IDataStoreSaveVerifiableCredentialArgs {\n  /**\n   * Required. VerifiableCredential\n   */\n  verifiableCredential: VerifiableCredential\n}\n\n/**\n * Input arguments for {@link IDataStore.dataStoreGetVerifiableCredential | dataStoreGetVerifiableCredential}\n * @public\n */\nexport interface IDataStoreGetVerifiableCredentialArgs {\n  /**\n   * Required. VerifiableCredential hash\n   */\n  hash: string\n}\n\n/**\n * Input arguments for {@link IDataStoreDeleteVerifiableCredentialArgs | IDataStoreDeleteVerifiableCredentialArgs}\n * @public\n */\nexport interface IDataStoreDeleteVerifiableCredentialArgs {\n  /**\n   * Required. VerifiableCredential hash\n   */\n  hash: string\n}\n\n/**\n * Input arguments for {@link IDataStore.dataStoreSaveVerifiablePresentation | dataStoreSaveVerifiablePresentation}\n * @public\n */\nexport interface IDataStoreSaveVerifiablePresentationArgs {\n  /**\n   * Required. VerifiablePresentation\n   */\n  verifiablePresentation: VerifiablePresentation\n}\n\n/**\n * Input arguments for {@link IDataStore.dataStoreGetVerifiablePresentation | dataStoreGetVerifiablePresentation}\n * @public\n */\nexport interface IDataStoreGetVerifiablePresentationArgs {\n  /**\n   * Required. VerifiablePresentation hash\n   */\n  hash: string\n}\n\n/**\n * Basic data store interface\n * @public\n */\nexport interface IDataStore extends IPluginMethodMap {\n  /**\n   * Saves message to the data store\n   * @param args - message\n   * @returns a promise that resolves to the id of the message\n   */\n  dataStoreSaveMessage(args: IDataStoreSaveMessageArgs): Promise<string>\n\n  /**\n   * Gets message from the data store\n   * @param args - arguments for getting message\n   * @returns a promise that resolves to the message\n   */\n  dataStoreGetMessage(args: IDataStoreGetMessageArgs): Promise<IMessage>\n\n  /**\n   * Deletes message from the data store\n   * @param args - arguments for deleting message\n   * @returns a promise that resolves to a boolean\n   */\n  dataStoreDeleteMessage(args: IDataStoreDeleteMessageArgs): Promise<boolean>\n\n  /**\n   * Saves verifiable credential to the data store\n   * @param args - verifiable credential\n   * @returns a promise that resolves to the hash of the VerifiableCredential\n   */\n  dataStoreSaveVerifiableCredential(args: IDataStoreSaveVerifiableCredentialArgs): Promise<string>\n\n  /**\n   * Deletes verifiable credential from the data store\n   * @param args - verifiable credential\n   * @returns a promise that resolves to a boolean\n   */\n  dataStoreDeleteVerifiableCredential(args: IDataStoreDeleteVerifiableCredentialArgs): Promise<boolean>\n\n  /**\n   * Gets verifiable credential from the data store\n   * @param args - arguments for getting verifiable credential\n   * @returns a promise that resolves to the verifiable credential\n   */\n  dataStoreGetVerifiableCredential(args: IDataStoreGetVerifiableCredentialArgs): Promise<VerifiableCredential>\n\n  /**\n   * Saves verifiable presentation to the data store\n   * @param args - verifiable presentation\n   * @returns a promise that resolves to the hash of the VerifiablePresentation\n   */\n  dataStoreSaveVerifiablePresentation(args: IDataStoreSaveVerifiablePresentationArgs): Promise<string>\n\n  /**\n   * Gets verifiable presentation from the data store\n   * @param args - arguments for getting Verifiable Presentation\n   * @returns a promise that resolves to the Verifiable Presentation\n   */\n  dataStoreGetVerifiablePresentation(\n    args: IDataStoreGetVerifiablePresentationArgs,\n  ): Promise<VerifiablePresentation>\n}\n"
  },
  {
    "path": "packages/core-types/src/types/IDataStoreORM.ts",
    "content": "import { VerifiableCredential, VerifiablePresentation } from './vc-data-model.js'\nimport { IIdentifier } from './IIdentifier.js'\nimport { IAgentContext, IPluginMethodMap } from './IAgent.js'\nimport { IMessage } from './IMessage.js'\n\n/**\n *  The allowed columns for querying different data types in the {@link IDataStoreORM} interface.\n *  @internal\n */\nexport const ALLOWED_COLUMNS = {\n  message: ['from', 'to', 'id', 'createdAt', 'expiresAt', 'threadId', 'type', 'raw', 'replyTo', 'replyUrl'],\n  claim: [\n    'context',\n    'credentialType',\n    'type',\n    'value',\n    'isObj',\n    'id',\n    'issuer',\n    'subject',\n    'expirationDate',\n    'issuanceDate',\n  ],\n  credential: ['context', 'type', 'id', 'issuer', 'subject', 'expirationDate', 'issuanceDate', 'hash'],\n  presentation: ['context', 'type', 'id', 'holder', 'verifier', 'expirationDate', 'issuanceDate'],\n  identifier: ['did', 'alias', 'provider'],\n} as const\n\n/**\n * Represents the sort order of results from a {@link FindArgs} query.\n *\n * @beta This API may change without a BREAKING CHANGE notice.\n */\nexport interface Order<TColumns> {\n  column: TColumns\n  direction: 'ASC' | 'DESC'\n}\n\n/**\n * Represents a WHERE predicate for a {@link FindArgs} query.\n * In situations where multiple WHERE predicates are present, they are combined with AND.\n *\n * @beta This API may change without a BREAKING CHANGE notice.\n */\nexport interface Where<TColumns> {\n  column: TColumns\n  value?: string[]\n  not?: boolean\n  op?:\n    | 'LessThan'\n    | 'LessThanOrEqual'\n    | 'MoreThan'\n    | 'MoreThanOrEqual'\n    | 'Equal'\n    | 'Like'\n    | 'Between'\n    | 'In'\n    | 'Any'\n    | 'IsNull'\n}\n\n/**\n * Represents an {@link IDataStoreORM} Query.\n *\n * @beta This API may change without a BREAKING CHANGE notice.\n */\nexport interface FindArgs<TColumns> {\n  /**\n   * Imposes constraints on the values of the given columns.\n   * WHERE clauses are combined using AND.\n   */\n  where?: Where<TColumns>[]\n\n  /**\n   * Sorts the results according to the given array of column priorities.\n   */\n  order?: Order<TColumns>[]\n\n  /**\n   * Ignores the first number of entries in a {@link IDataStoreORM} query result.\n   */\n  skip?: number\n\n  /**\n   * Returns at most this number of results from a {@link IDataStoreORM} query.\n   */\n  take?: number\n}\n\n/**\n * The columns that can be queried for an {@link IIdentifier}\n *\n * @deprecated This type will be removed in future versions of this plugin interface.\n * @beta This API may change without a BREAKING CHANGE notice.\n */\nexport type TIdentifiersColumns = (typeof ALLOWED_COLUMNS.identifier)[number]\n\n/**\n * The columns that can be queried for an {@link IMessage}\n *\n * See {@link IDataStoreORM.dataStoreORMGetMessagesCount}\n * @beta This API may change without a BREAKING CHANGE notice.\n */\nexport type TMessageColumns = (typeof ALLOWED_COLUMNS.message)[number]\n\n/**\n * The columns that can be searched for a {@link VerifiableCredential}\n *\n * See {@link IDataStoreORM.dataStoreORMGetVerifiableCredentials}\n * See {@link IDataStoreORM.dataStoreORMGetVerifiableCredentialsCount}\n *\n * @beta This API may change without a BREAKING CHANGE notice.\n */\nexport type TCredentialColumns = (typeof ALLOWED_COLUMNS.credential)[number]\n\n/**\n * The columns that can be searched for the claims of a {@link VerifiableCredential}\n *\n * See {@link IDataStoreORM.dataStoreORMGetVerifiableCredentialsByClaims}\n * See {@link IDataStoreORM.dataStoreORMGetVerifiableCredentialsByClaimsCount}\n *\n * @beta This API may change without a BREAKING CHANGE notice.\n */\nexport type TClaimsColumns = (typeof ALLOWED_COLUMNS.claim)[number]\n\n/**\n * The columns that can be searched for a {@link VerifiablePresentation}\n *\n * See {@link IDataStoreORM.dataStoreORMGetVerifiablePresentations}\n * See {@link IDataStoreORM.dataStoreORMGetVerifiablePresentationsCount}\n *\n * @beta This API may change without a BREAKING CHANGE notice.\n */\nexport type TPresentationColumns = (typeof ALLOWED_COLUMNS.presentation)[number]\n\n/**\n * This context can be used for Veramo Agents that are created behind an authorization mechanism, that attaches a DID\n * as the authorized executor of certain actions. This authorized DID is used to further filter the data that is\n * available for querying.\n *\n * This does not constitute an authorization mechanism, but relies on an authorization mechanism existing before the\n * Veramo Agent is created.\n *\n * @beta This API may change without a BREAKING CHANGE notice.\n */\nexport interface AuthorizedDIDContext extends IAgentContext<{}> {\n  authorizedDID?: string\n}\n\n/**\n * Represents the result of a Query for {@link VerifiableCredential}s\n *\n * See {@link IDataStoreORM.dataStoreORMGetVerifiableCredentials}\n * See {@link IDataStoreORM.dataStoreORMGetVerifiableCredentialsByClaims}\n *\n * @beta This API may change without a BREAKING CHANGE notice.\n */\nexport interface UniqueVerifiableCredential {\n  hash: string\n  verifiableCredential: VerifiableCredential\n}\n\n/**\n * Represents the result of a Query for {@link VerifiablePresentation}s\n *\n * See {@link IDataStoreORM.dataStoreORMGetVerifiablePresentations}\n *\n * @beta This API may change without a BREAKING CHANGE notice.\n */\nexport interface UniqueVerifiablePresentation {\n  hash: string\n  verifiablePresentation: VerifiablePresentation\n}\n\n/**\n * The filter that can be used to find {@link IIdentifier}s in the data store.\n *\n * @beta This API may change without a BREAKING CHANGE notice.\n */\nexport type FindIdentifiersArgs = FindArgs<TIdentifiersColumns>\n\n/**\n * The filter that can be used to find {@link IMessage}s in the data store.\n * See {@link IDataStoreORM.dataStoreORMGetMessages}\n *\n * @beta This API may change without a BREAKING CHANGE notice.\n */\nexport type FindMessagesArgs = FindArgs<TMessageColumns>\n\n/**\n * The filter that can be used to find {@link VerifiableCredential}s in the data store, based on the types and values\n * of their claims.\n *\n * See {@link IDataStoreORM.dataStoreORMGetVerifiableCredentialsByClaims}\n * @beta This API may change without a BREAKING CHANGE notice.\n */\nexport type FindClaimsArgs = FindArgs<TClaimsColumns>\n\n/**\n * The filter that can be used to find {@link VerifiableCredential}s in the data store.\n * See {@link IDataStoreORM.dataStoreORMGetVerifiableCredentials}\n *\n * @beta This API may change without a BREAKING CHANGE notice.\n */\nexport type FindCredentialsArgs = FindArgs<TCredentialColumns>\n\n/**\n * The filter that can be used to find {@link VerifiablePresentation}s in the data store.\n * See {@link IDataStoreORM.dataStoreORMGetVerifiablePresentations}\n *\n * @beta This API may change without a BREAKING CHANGE notice.\n */\nexport type FindPresentationsArgs = FindArgs<TPresentationColumns>\n\n/**\n * The result of a {@link IDataStoreORM.dataStoreORMGetIdentifiers} query.\n *\n * @beta This API may change without a BREAKING CHANGE notice.\n */\nexport type PartialIdentifier = Partial<IIdentifier>\n\n/**\n * This is the default query interface for the credential data stored by a Veramo agent.\n *\n * Plugins implementing this interface are expected to implement this simple query functionality to filter the data\n * that was saved using {@link IDataStore}.\n *\n * If this interface is implemented by a different plugin than {@link IDataStore}, then both plugins MUST use the same\n * media for data storage.\n *\n * @see {@link @veramo/data-store#DataStoreORM} for an implementation using a TypeORM backend\n * @see {@link @veramo/data-store-json#DataStoreJson} for an implementation using a JSON object that can also be\n *   persisted.\n *\n * @beta This API may change without a BREAKING CHANGE notice.\n */\nexport interface IDataStoreORM extends IPluginMethodMap {\n  /**\n   * Tries to obtain a list of {@link IIdentifier | IIdentifiers} that match the given filter.\n   * The origin of these identifiers is from any credential / presentation or message that was successfully processed\n   * by this agent.\n   *\n   * If the same database is used for implementations of {@link @veramo/did-manager#AbstractDIDStore |\n   * AbstractDIDStore}, then these identifiers can also come from {@link IDIDManager.didManagerCreate |\n   * didManagerCreate} or {@link IDIDManager.didManagerImport | didManagerImport} operations.\n   *\n   * @param args - The filter to apply when querying\n   * @param context - Can be used to signal that only a particular DID is authorized to perform this operation. This\n   *   will cause the result to only contain data that this DID should be able to access.\n   *\n   * @deprecated This will be removed in future versions of this plugin interface.\n   * @beta This API may change without a BREAKING CHANGE notice.\n   */\n  dataStoreORMGetIdentifiers(\n    args: FindIdentifiersArgs,\n    context: AuthorizedDIDContext,\n  ): Promise<Array<PartialIdentifier>>\n\n  /**\n   * Tries to obtain a count of {@link IIdentifier | IIdentifiers} that match the given filter.\n   * The origin of these identifiers is from any credential / presentation or message that was successfully processed\n   * by this agent.\n   *\n   * If the same database is used for implementations of {@link @veramo/did-manager#AbstractDIDStore |\n   * AbstractDIDStore}, then these identifiers can also come from {@link IDIDManager.didManagerCreate |\n   * didManagerCreate} or {@link IDIDManager.didManagerImport | didManagerImport} operations.\n   *\n   * @param args - The filter to apply when querying\n   * @param context - Can be used to signal that only a particular DID is authorized to perform this operation. This\n   *   will cause the result to only contain data that this DID should be able to access.\n   *\n   * @deprecated This will be removed in future versions of this plugin interface.\n   * @beta This API may change without a BREAKING CHANGE notice.\n   */\n  dataStoreORMGetIdentifiersCount(args: FindIdentifiersArgs, context: AuthorizedDIDContext): Promise<number>\n\n  /**\n   * Returns a list of {@link IMessage}s that match the given filter.\n   * These are messages that were stored using {@link IDataStore.dataStoreSaveMessage | dataStoreSaveMessage}.\n   *\n   * @param args - The filter to apply when querying\n   * @param context - Can be used to signal that only a particular DID is authorized to perform this operation. This\n   *   will cause the result to only contain data that this DID should be able to access.\n   *\n   * @beta This API may change without a BREAKING CHANGE notice.\n   */\n  dataStoreORMGetMessages(args: FindMessagesArgs, context: AuthorizedDIDContext): Promise<Array<IMessage>>\n\n  /**\n   * Returns a count of {@link IMessage}s that match the given filter.\n   * These are messages that were stored using {@link IDataStore.dataStoreSaveMessage | dataStoreSaveMessage}.\n   *\n   * @param args - The filter to apply when querying.\n   * @param context - Can be used to signal that only a particular DID is authorized to perform this operation. This\n   *   will cause the result to only contain data that this DID should be able to access.\n   *\n   * @beta This API may change without a BREAKING CHANGE notice.\n   */\n  dataStoreORMGetMessagesCount(args: FindMessagesArgs, context: AuthorizedDIDContext): Promise<number>\n\n  /**\n   * Returns a list of {@link UniqueVerifiableCredential}s that match the given filter based on the claims they\n   * contain.\n   *\n   * These are VerifiableCredentials that were stored using\n   * {@link IDataStore.dataStoreSaveVerifiableCredential | dataStoreSaveVerifiableCredential}.\n   *\n   * @param args - The filter to apply when querying\n   * @param context - Can be used to signal that only a particular DID is authorized to perform this operation. This\n   *   will cause the result to only contain data that this DID should be able to access.\n   *\n   * @beta This API may change without a BREAKING CHANGE notice.\n   */\n  dataStoreORMGetVerifiableCredentialsByClaims(\n    args: FindClaimsArgs,\n    context: AuthorizedDIDContext,\n  ): Promise<Array<UniqueVerifiableCredential>>\n\n  /**\n   * Returns a count of {@link UniqueVerifiableCredential}s that match the given filter based on the claims they\n   * contain.\n   *\n   * These are VerifiableCredentials that were stored using\n   * {@link IDataStore.dataStoreSaveVerifiableCredential | dataStoreSaveVerifiableCredential}.\n   *\n   * @param args - The filter to apply when querying\n   * @param context - Can be used to signal that only a particular DID is authorized to perform this operation. This\n   *   will cause the result to only contain data that this DID should be able to access.\n   *\n   * @beta This API may change without a BREAKING CHANGE notice.\n   */\n  dataStoreORMGetVerifiableCredentialsByClaimsCount(\n    args: FindClaimsArgs,\n    context: AuthorizedDIDContext,\n  ): Promise<number>\n\n  /**\n   * Returns a list of {@link UniqueVerifiableCredential}s that match the given filter based on the top level\n   * properties of a credential.\n   *\n   * These are VerifiableCredentials that were stored using\n   * {@link IDataStore.dataStoreSaveVerifiableCredential | dataStoreSaveVerifiableCredential}.\n   *\n   * @param args - The filter to apply when querying\n   * @param context - Can be used to signal that only a particular DID is authorized to perform this operation. This\n   *   will cause the result to only contain data that this DID should be able to access.\n   *\n   * @beta This API may change without a BREAKING CHANGE notice.\n   */\n  dataStoreORMGetVerifiableCredentials(\n    args: FindCredentialsArgs,\n    context: AuthorizedDIDContext,\n  ): Promise<Array<UniqueVerifiableCredential>>\n\n  /**\n   * Returns a count of {@link UniqueVerifiableCredential}s that match the given filter based on the top level\n   * properties of a credential.\n   *\n   * These are VerifiableCredentials that were stored using\n   * {@link IDataStore.dataStoreSaveVerifiableCredential | dataStoreSaveVerifiableCredential}.\n   *\n   * @param args - The filter to apply when querying\n   * @param context - Can be used to signal that only a particular DID is authorized to perform this operation. This\n   *   will cause the result to only contain data that this DID should be able to access.\n   *\n   * @beta This API may change without a BREAKING CHANGE notice.\n   */\n  dataStoreORMGetVerifiableCredentialsCount(\n    args: FindCredentialsArgs,\n    context: AuthorizedDIDContext,\n  ): Promise<number>\n\n  /**\n   * Returns a list of {@link UniqueVerifiablePresentation}s that match the given filter based on the top level\n   * properties of a presentation.\n   *\n   * These are {@link VerifiablePresentation}s that were stored using\n   * {@link IDataStore.dataStoreSaveVerifiablePresentation | dataStoreSaveVerifiablePresentation}.\n   *\n   * @param args - The filter to apply when querying\n   * @param context - Can be used to signal that only a particular DID is authorized to perform this operation. This\n   *   will cause the result to only contain data that this DID should be able to access.\n   *\n   * @beta This API may change without a BREAKING CHANGE notice.\n   */\n  dataStoreORMGetVerifiablePresentations(\n    args: FindPresentationsArgs,\n    context: AuthorizedDIDContext,\n  ): Promise<Array<UniqueVerifiablePresentation>>\n\n  /**\n   * Returns a count of {@link UniqueVerifiablePresentation}s that match the given filter based on the top level\n   * properties of a presentation.\n   *\n   * These are {@link VerifiablePresentation}s that were stored using\n   * {@link IDataStore.dataStoreSaveVerifiablePresentation | dataStoreSaveVerifiablePresentation}.\n   *\n   * @param args - The filter to apply when querying\n   * @param context - Can be used to signal that only a particular DID is authorized to perform this operation. This\n   *   will cause the result to only contain data that this DID should be able to access.\n   *\n   * @beta This API may change without a BREAKING CHANGE notice.\n   */\n  dataStoreORMGetVerifiablePresentationsCount(\n    args: FindPresentationsArgs,\n    context: AuthorizedDIDContext,\n  ): Promise<number>\n}\n"
  },
  {
    "path": "packages/core-types/src/types/IError.ts",
    "content": "/**\n * An error object, which can contain a code.\n * @beta\n */\nexport interface IError {\n\n  /**\n   * The details of the error being throw or forwarded\n   */\n  message?: string\n\n  /**\n   * The code for the error being throw\n   */\n  errorCode?: string\n}"
  },
  {
    "path": "packages/core-types/src/types/IIdentifier.ts",
    "content": "import { MinimalImportableKey } from './IKeyManager.js'\n\n/**\n * Identifier interface\n * @public\n */\nexport interface IIdentifier {\n  /**\n   * Decentralized identifier\n   */\n  did: string\n\n  /**\n   * Optional. Identifier alias. Can be used to reference an object in an external system\n   */\n  alias?: string\n\n  /**\n   * Identifier provider name\n   */\n  provider: string\n\n  /**\n   * Controller key id\n   */\n  controllerKeyId?: string\n\n  /**\n   * Array of managed keys\n   */\n  keys: IKey[]\n\n  /**\n   * Array of services\n   */\n  services: IService[]\n}\n\n/**\n * Represents the minimum amount of information needed to import an {@link IIdentifier}.\n *\n * @public\n */\nexport type MinimalImportableIdentifier = {\n  keys: Array<MinimalImportableKey>\n  services?: Array<IService>\n} & Omit<IIdentifier, 'keys' | 'services'>\n\n/**\n * Cryptographic key type.\n *\n * @public\n */\nexport type TKeyType = 'Ed25519' | 'Secp256k1' | 'Secp256r1' | 'X25519' | 'Bls12381G1' | 'Bls12381G2' | (string & {})\n\n/**\n * Known algorithms supported by some of the above key types defined by {@link TKeyType}.\n *\n * Actual implementations of {@link @veramo/key-manager#AbstractKeyManagementSystem | Key Management Systems} can\n * support more. One should check the {@link IKey.meta | IKey.meta.algorithms} property to see what is possible for a\n * particular managed key.\n *\n * @public\n */\nexport type TAlg = 'ES256K' | 'ES256K-R' | 'ES256' | 'EdDSA' | 'ECDH' | 'ECDH-ES' | 'ECDH-1PU' | (string & {})\n\n/**\n * Mapping of known key types({@link TKeyType}) to the known algorithms({@link TAlg}) they should support.\n *\n * @public\n */\nexport const KEY_ALG_MAPPING: Record<TKeyType, ReadonlyArray<TAlg>> = {\n  Secp256k1: ['ES256K', 'ES256K-R'],\n  Secp256r1: ['ES256', 'ECDH', 'ECDH-ES', 'ECDH-1PU'],\n  Ed25519: ['EdDSA'],\n  X25519: ['ECDH', 'ECDH-ES', 'ECDH-1PU'],\n  Bls12381G1: [],\n  Bls12381G2: [],\n} as const\n\n/**\n * Cryptographic key, usually managed by the current Veramo instance.\n *\n * @public\n */\nexport interface IKey {\n  /**\n   * Key ID\n   */\n  kid: string\n\n  /**\n   * Key Management System\n   */\n  kms: string\n\n  /**\n   * Key type\n   */\n  type: TKeyType\n\n  /**\n   * Public key\n   */\n  publicKeyHex: string\n\n  /**\n   * Optional. Private key\n   */\n  privateKeyHex?: string\n\n  /**\n   * Optional. Key metadata. This should be used to determine which algorithms are supported.\n   */\n  meta?: KeyMetadata | null\n}\n\n/**\n * This encapsulates data about a key.\n *\n * Implementations of {@link @veramo/key-manager#AbstractKeyManagementSystem | AbstractKeyManagementSystem} should\n * populate this object, for each key, with the algorithms that can be performed using it.\n *\n * This can also be used to add various tags to the keys under management.\n *\n * @public\n */\nexport interface KeyMetadata {\n  algorithms?: TAlg[]\n\n  [x: string]: any\n}\n\n/**\n * Identifier service\n * @public\n */\nexport interface IService {\n  /**\n   * ID\n   */\n  id: string\n\n  /**\n   * Service type\n   */\n  type: string\n\n  /**\n   * Endpoint URL\n   */\n  serviceEndpoint: IServiceEndpoint | IServiceEndpoint[]\n\n  /**\n   * Optional. Description\n   */\n  description?: string\n}\n\n/**\n * Represents a service endpoint URL or a map of URLs\n * @see {@link https://www.w3.org/TR/did-core/#dfn-serviceendpoint | serviceEndpoint data model}\n *\n * @public\n */\nexport type IServiceEndpoint = string | Record<string, any>\n"
  },
  {
    "path": "packages/core-types/src/types/IKeyManager.ts",
    "content": "import { IPluginMethodMap } from './IAgent.js'\nimport { TKeyType, IKey, KeyMetadata } from './IIdentifier.js'\n\n/**\n * Represents an object type where a subset of keys is required and everything else is optional.\n *\n * @public\n */\nexport type RequireOnly<T, K extends keyof T> = Required<Pick<T, K>> & Partial<T>\n\n/**\n * Represents the properties required to import a key.\n *\n * @public\n */\nexport type MinimalImportableKey = RequireOnly<IKey, 'privateKeyHex' | 'type' | 'kms'>\n\n/**\n * Represents information about a managed key.\n * Private or secret key material is NOT present.\n *\n * @public\n */\nexport type ManagedKeyInfo = Omit<IKey, 'privateKeyHex'>\n\n/**\n * Input arguments for {@link IKeyManager.keyManagerCreate | keyManagerCreate}\n * @public\n */\nexport interface IKeyManagerCreateArgs {\n  /**\n   * Key type\n   */\n  type: TKeyType\n\n  /**\n   * Key Management System\n   */\n  kms: string\n\n  /**\n   * Optional. Key meta data\n   */\n  meta?: KeyMetadata\n\n  /**\n   * Optional. Key ID\n   */\n  kid?: string;\n}\n\n/**\n * Input arguments for {@link IKeyManager.keyManagerGet | keyManagerGet}\n * @public\n */\nexport interface IKeyManagerGetArgs {\n  /**\n   * Key ID\n   */\n  kid: string\n}\n\n/**\n * Input arguments for {@link IKeyManager.keyManagerDelete | keyManagerDelete}\n * @public\n */\nexport interface IKeyManagerDeleteArgs {\n  /**\n   * Key ID\n   */\n  kid: string\n}\n\n/**\n * Input arguments for {@link IKeyManager.keyManagerEncryptJWE | keyManagerEncryptJWE}\n * @beta This API may change without a BREAKING CHANGE notice.\n */\nexport interface IKeyManagerEncryptJWEArgs {\n  /**\n   * Key ID to use for encryption\n   */\n  kid: string\n\n  /**\n   * Recipient key object\n   */\n  to: Omit<IKey, 'kms'>\n\n  /**\n   * Data to encrypt\n   */\n  data: string\n}\n\n/**\n * Input arguments for {@link IKeyManager.keyManagerDecryptJWE | keyManagerDecryptJWE}\n * @beta This API may change without a BREAKING CHANGE notice.\n */\nexport interface IKeyManagerDecryptJWEArgs {\n  /**\n   * Key ID\n   */\n  kid: string\n\n  /**\n   * Encrypted data\n   */\n  data: string\n}\n\n/**\n * Input arguments for {@link IKeyManager.keyManagerSign | keyManagerSign}\n * @public\n */\nexport interface IKeyManagerSignArgs {\n  /**\n   * The key handle, as returned during `keyManagerCreateKey`\n   */\n  keyRef: string\n\n  /**\n   * The algorithm to use for signing.\n   * This must be one of the algorithms supported by the KMS for this key type.\n   *\n   * The algorithm used here should match one of the names listed in `IKey.meta.algorithms`\n   */\n  algorithm?: string\n\n  /**\n   * Data to sign\n   */\n  data: string\n\n  /**\n   * If the data is a \"string\" then you can specify which encoding is used. Default is \"utf-8\"\n   */\n  encoding?: 'utf-8' | 'base16' | 'base64' | 'hex'\n\n  [x: string]: any\n}\n\n/**\n * Input arguments for {@link IKeyManager.keyManagerSharedSecret | keyManagerSharedSecret}\n * @public\n */\nexport interface IKeyManagerSharedSecretArgs {\n  /**\n   * The secret key handle (`kid`)\n   * as returned by {@link IKeyManager.keyManagerCreate | keyManagerCreate}\n   */\n  secretKeyRef: string\n\n  /**\n   * The public key of the other party.\n   * The `type` of key MUST be compatible with the type referenced by `secretKeyRef`\n   */\n  publicKey: Pick<IKey, 'publicKeyHex' | 'type'>\n}\n\n/**\n * Input arguments for {@link IKeyManager.keyManagerSignJWT | keyManagerSignJWT}\n * @public\n */\nexport interface IKeyManagerSignJWTArgs {\n  /**\n   * Key ID\n   */\n  kid: string\n\n  /**\n   * Data to sign\n   */\n  data: string | Uint8Array\n}\n\n/**\n * Input arguments for {@link IKeyManager.keyManagerSignEthTX | keyManagerSignEthTX}\n * @public\n */\nexport interface IKeyManagerSignEthTXArgs {\n  /**\n   * Key ID\n   */\n  kid: string\n\n  /**\n   * Ethereum transaction object\n   */\n  transaction: object\n}\n\n/**\n * Key manager interface.\n *\n * This defines an interface for a plugin that orchestrates various implementations of\n * {@link @veramo/key-manager#AbstractKeyManagementSystem | AbstractKeyManagementSystem}.\n *\n * See {@link @veramo/key-manager#KeyManager | KeyManager} for a reference implementation.\n *\n * The methods of this plugin are used automatically by other plugins, such as\n * {@link @veramo/did-manager#DIDManager | DIDManager},\n * {@link @veramo/credential-w3c#CredentialPlugin | CredentialPlugin}, or {@link @veramo/did-comm#DIDComm | DIDComm} to\n * perform their required cryptographic operations using the managed keys.\n *\n * @public\n */\nexport interface IKeyManager extends IPluginMethodMap {\n  /**\n   * Lists available key management systems\n   */\n  keyManagerGetKeyManagementSystems(): Promise<Array<string>>\n\n  /**\n   * Creates and returns a new key\n   */\n  keyManagerCreate(args: IKeyManagerCreateArgs): Promise<ManagedKeyInfo>\n\n  /**\n   * Returns an existing key\n   */\n  keyManagerGet(args: IKeyManagerGetArgs): Promise<IKey>\n\n  /**\n   * Deletes a key\n   */\n  keyManagerDelete(args: IKeyManagerDeleteArgs): Promise<boolean>\n\n  /**\n   * Imports a created key\n   */\n  keyManagerImport(args: MinimalImportableKey): Promise<ManagedKeyInfo>\n\n  /**\n   * Generates a signature according to the algorithm specified.\n   * @throws `Error(\"not_supported\")` if the KMS does not support the operation or if the key does not match the\n   *   algorithm.\n   * @param args - The input to the signing method, including data to be signed, key reference and algorithm to use.\n   */\n  keyManagerSign(args: IKeyManagerSignArgs): Promise<string>\n\n  /**\n   * Compute a shared secret with the public key of another party.\n   *\n   * This computes the raw shared secret (the result of a Diffie-Hellman computation)\n   * To use this for symmetric encryption you MUST apply a KDF on the result.\n   *\n   * @param args - The input to compute the shared secret, including the local key reference and remote key details.\n   * @returns a `Promise` that resolves to a hex encoded shared secret\n   */\n  keyManagerSharedSecret(args: IKeyManagerSharedSecretArgs): Promise<string>\n\n  /**\n   * Encrypts data\n   * @beta This API may change without a BREAKING CHANGE notice.\n   */\n  keyManagerEncryptJWE(args: IKeyManagerEncryptJWEArgs): Promise<string>\n\n  /**\n   * Decrypts data\n   * @beta This API may change without a BREAKING CHANGE notice.\n   */\n  keyManagerDecryptJWE(args: IKeyManagerDecryptJWEArgs): Promise<string>\n\n  /**\n   * Signs JWT\n   */\n  keyManagerSignJWT(args: IKeyManagerSignJWTArgs): Promise<string>\n\n  /** Signs Ethereum transaction */\n  keyManagerSignEthTX(args: IKeyManagerSignEthTXArgs): Promise<string>\n}\n"
  },
  {
    "path": "packages/core-types/src/types/IMessage.ts",
    "content": "import { VerifiableCredential, VerifiablePresentation } from './vc-data-model.js'\n\n/**\n * Message meta data\n * @public\n */\nexport interface IMetaData {\n  /**\n   * Type\n   */\n  type: string\n\n  /**\n   * Optional. Value\n   */\n  value?: string\n}\n\n/**\n * Message attachment\n * @public\n */\nexport interface IMessageAttachment {\n  id?: string\n  description?: string\n  filename?: string\n  media_type?: string\n  format?: string\n  lastmod_time?: string\n  byte_count?: number\n  data: IMessageAttachmentData\n}\n\n/**\n * The DIDComm message structure for data in an attachment.\n * See https://identity.foundation/didcomm-messaging/spec/#attachments\n *\n * @beta This API may change without a BREAKING CHANGE notice.\n */\nexport interface IMessageAttachmentData {\n  jws?: any\n  hash?: string\n  links?: string[]\n  base64?: string\n  json?: any\n}\n\n/**\n * Represents a DIDComm v1 message payload, with optionally decoded credentials and presentations.\n * @public\n */\nexport interface IMessage {\n  /**\n   * Unique message ID\n   */\n  id: string\n\n  /**\n   * Message type\n   */\n  type: string\n\n  /**\n   * Optional. Creation date (ISO 8601)\n   */\n  createdAt?: string\n\n  /**\n   * Optional. Expiration date (ISO 8601)\n   */\n  expiresAt?: string\n\n  /**\n   * Optional. Thread ID\n   */\n  threadId?: string\n\n  /**\n   * Optional. Original message raw data\n   */\n  raw?: string\n\n  /**\n   * Optional. Parsed data\n   */\n  data?: object | null\n\n  /**\n   * Optional. List of DIDs to reply to\n   */\n  replyTo?: string[]\n\n  /**\n   * Optional. URL to post a reply message to\n   */\n  replyUrl?: string\n\n  /**\n   * Optional. Sender DID\n   */\n  from?: string\n\n  /**\n   * Optional. Recipient DID\n   */\n  to?: string\n\n  /**\n   * Optional. Array of message metadata\n   */\n  metaData?: IMetaData[] | null\n\n  /**\n   * Optional. Array of attached verifiable credentials\n   */\n  credentials?: VerifiableCredential[]\n\n  /**\n   * Optional. Array of attached verifiable presentations\n   */\n  presentations?: VerifiablePresentation[]\n\n  /**\n   * Optional. Array of generic attachments\n   */\n  attachments?: IMessageAttachment[]\n\n  /**\n   * Optional. Signal how to reuse transport for return messages\n   */\n  returnRoute?: string\n}\n"
  },
  {
    "path": "packages/core-types/src/types/IMessageHandler.ts",
    "content": "import { IAgentContext, IPluginMethodMap } from './IAgent.js'\nimport { IMessage, IMetaData } from './IMessage.js'\nimport { IDataStore } from './IDataStore.js'\n\n/**\n * Input arguments for {@link IMessageHandler.handleMessage | handleMessage}\n * @public\n */\nexport interface IHandleMessageArgs {\n  /**\n   * Raw message data\n   */\n  raw: string\n\n  /**\n   * Optional. Message meta data\n   */\n  metaData?: IMetaData[]\n\n  /**\n   * Optional. If set to `true`, the message will be saved using\n   * {@link @veramo/core-types#IDataStore.dataStoreSaveMessage | dataStoreSaveMessage}\n   * <p/><p/>\n   * @deprecated Please call {@link @veramo/core-types#IDataStore.dataStoreSaveMessage | dataStoreSaveMessage()} after\n   *   handling the message and determining that it must be saved.\n   */\n  save?: boolean\n}\n\n/**\n * Message handler plugin interface.\n * @public\n */\nexport interface IMessageHandler extends IPluginMethodMap {\n  /**\n   * Parses a raw message.\n   *\n   * After the message is parsed, you can decide if it should be saved, and pass the result to\n   * {@link @veramo/core-types#IDataStore.dataStoreSaveMessage | dataStoreSaveMessage()} to save it.\n   *\n   * @param args - The `raw` message to be handled along with optional `metadata` about the origin.\n   * @param context - Execution context. Requires agent with {@link @veramo/core-types#IDataStore} methods\n   */\n  handleMessage(args: IHandleMessageArgs, context: IAgentContext<IDataStore>): Promise<IMessage>\n}\n"
  },
  {
    "path": "packages/core-types/src/types/IResolver.ts",
    "content": "import {\n  DIDDocument,\n  DIDResolutionOptions,\n  DIDResolutionResult,\n  KeyCapabilitySection,\n  ServiceEndpoint,\n  VerificationMethod,\n} from 'did-resolver'\nimport { IPluginMethodMap } from './IAgent.js'\n\nexport { DIDDocument, DIDResolutionOptions, DIDResolutionResult } from 'did-resolver'\n\n/**\n * Input arguments for {@link IResolver.resolveDid | resolveDid}\n * @public\n */\nexport interface ResolveDidArgs {\n  /**\n   * DID URL\n   *\n   * @example\n   * `did:web:uport.me`\n   */\n  didUrl: string\n\n  /**\n   * DID resolution options that will be passed to the method specific resolver.\n   * See: https://w3c.github.io/did-spec-registries/#did-resolution-input-metadata\n   * See: https://www.w3.org/TR/did-core/#did-resolution-options\n   */\n  options?: DIDResolutionOptions\n}\n\n/**\n * Input arguments for {@link IResolver.getDIDComponentById | getDIDComponentById}\n * @beta This API may change without a BREAKING CHANGE notice.\n */\nexport interface GetDIDComponentArgs {\n  /**\n   * the DID document from which to extract the fragment. This MUST be the document resolved by\n   * {@link IResolver.resolveDid}\n   */\n  didDocument: DIDDocument\n\n  /**\n   * The DID URI that needs to be dereferenced.\n   * This should refer to the subsection by #fragment.\n   *\n   * Example: did:example:identifier#controller\n   */\n  didUrl: string\n\n  /**\n   * Optional.\n   * The section of the DID document where to search for the fragment. Example 'keyAgreement', or 'assertionMethod',\n   * or 'authentication', etc\n   */\n  section?: DIDDocumentSection\n}\n\n/**\n * Return type of {@link IResolver.getDIDComponentById | getDIDComponentById}\n * represents a `VerificationMethod` or a `ServiceEndpoint` entry from a {@link did-resolver#DIDDocument | DIDDocument}\n * @beta This API may change without a BREAKING CHANGE notice.\n */\nexport type DIDDocComponent = VerificationMethod | ServiceEndpoint\n\n/**\n * DID Resolver interface\n * @public\n */\nexport interface IResolver extends IPluginMethodMap {\n  /**\n   * Resolves DID and returns DID Resolution Result\n   *\n   * @example\n   * ```typescript\n   * const doc = await agent.resolveDid({\n   *   didUrl: 'did:ethr:ganache:0xb09b66026ba5909a7cfe99b76875431d2b8d5190'\n   * })\n   * expect(doc.didDocument).toEqual({\n   *   '@context': expect.anything(),\n   *   id: 'did:ethr:ganache:0xb09b66026ba5909a7cfe99b76875431d2b8d5190',\n   *   verificationMethod: [\n   *     {\n   *       id: 'did:ethr:ganache:0xb09b66026ba5909a7cfe99b76875431d2b8d5190#controller',\n   *       type: 'EcdsaSecp256k1RecoveryMethod2020',\n   *       controller: 'did:ethr:ganache:0xb09b66026ba5909a7cfe99b76875431d2b8d5190',\n   *       blockchainAccountId: 'eip155:1337:0xb09B66026bA5909A7CFE99b76875431D2b8D5190',\n   *     },\n   *   ],\n   *   authentication: ['did:ethr:ganache:0xb09b66026ba5909a7cfe99b76875431d2b8d5190#controller'],\n   *   assertionMethod: ['did:ethr:ganache:0xb09b66026ba5909a7cfe99b76875431d2b8d5190#controller'],\n   * })\n   * ```\n   *\n   * @param args - Input arguments for resolving a DID\n   * @public\n   */\n  resolveDid(args: ResolveDidArgs): Promise<DIDResolutionResult>\n\n  /**\n   * Dereferences a DID URL fragment and returns the corresponding DID document entry.\n   *\n   * @example\n   * ```typescript\n   * const did = 'did:ethr:ganache:0xb09b66026ba5909a7cfe99b76875431d2b8d5190'\n   * const didFragment = `${did}#controller`\n   * const fragment = await agent.getDIDComponentById({\n   *   didDocument: (await agent.resolveDid({didUrl: did}))?.didDocument,\n   *   didUrl: didFragment,\n   *   section: 'authentication'\n   * })\n   * expect(fragment).toEqual({\n   *   id: 'did:ethr:ganache:0xb09b66026ba5909a7cfe99b76875431d2b8d5190#controller',\n   *   type: 'EcdsaSecp256k1RecoveryMethod2020',\n   *   controller: 'did:ethr:ganache:0xb09b66026ba5909a7cfe99b76875431d2b8d5190',\n   *   blockchainAccountId: 'eip155:1337:0xb09B66026bA5909A7CFE99b76875431D2b8D5190',\n   * })\n   * ```\n   *\n   * @param args - The description of the component you want.\n   *\n   * @returns a `Promise` containing the {@link did-resolver#VerificationMethod | VerificationMethod} or\n   *   {@link did-resolver#ServiceEndpoint | ServiceEndpoint}\n   *\n   * @throws `not_found:...` in case the fragment is not displayed in the DID document\n   *\n   * @beta This API may change without a BREAKING CHANGE notice.\n   */\n  getDIDComponentById(args: GetDIDComponentArgs): Promise<DIDDocComponent>\n}\n\n/**\n * Refers to a section of a DID document.\n * Either the list of verification methods or services or one of the verification relationships.\n *\n * See {@link https://www.w3.org/TR/did-core/#verification-relationships | verification relationships}\n *\n * @public\n */\nexport type DIDDocumentSection =\n  | KeyCapabilitySection\n  | 'verificationMethod'\n  | 'publicKey' //used for backward compatibility\n  | 'service'\n"
  },
  {
    "path": "packages/core-types/src/types/IVerifyResult.ts",
    "content": "import { IError } from \"./IError.js\"\n/**\n * Encapsulates the response object to verifyPresentation method after verifying a\n * {@link https://www.w3.org/TR/vc-data-model/#presentations | W3C Verifiable Presentation}\n *\n * @beta\n */\n export interface IVerifyResult {\n  /**\n   * This value is used to transmit the result of verification.\n   */\n  verified: boolean\n\n  /**\n   * Optional Error object for the\n   * but currently the machine readable errors are not expored from DID-JWT package to be imported here\n   */\n  error?: IError\n\n  /**\n   * Other options can be specified for verification.\n   * They will be forwarded to the lower level modules. that performt the checks\n   */\n  [x: string]: any\n}"
  },
  {
    "path": "packages/core-types/src/types/vc-data-model.ts",
    "content": "/**\n * Represents a Json Web Token in compact form.\n * \"header.payload.signature\"\n *\n * @beta This API may change without a BREAKING CHANGE notice.\n */\nexport type CompactJWT = string\n\n/**\n * The issuer of a {@link VerifiableCredential} or the holder of a {@link VerifiablePresentation }.\n *\n * The value of the issuer property MUST be either a URI or an object containing an id property.\n * It is RECOMMENDED that the URI in the issuer or its id be one which, if de-referenced, results in a document\n * containing machine-readable information about the issuer that can be used to verify the information expressed in the\n * credential.\n *\n * See {@link https://www.w3.org/TR/vc-data-model/#issuer | Issuer data model}\n *\n * @beta This API may change without a BREAKING CHANGE notice.\n */\nexport type IssuerType = { id: string;[x: string]: any } | string\n\n/**\n * The value of the credentialSubject property is defined as a set of objects that contain one or more properties that\n * are each related to a subject of the verifiable credential.\n * Each object MAY contain an id.\n *\n * See {@link https://www.w3.org/TR/vc-data-model/#credential-subject | Credential Subject}\n *\n * @beta This API may change without a BREAKING CHANGE notice.\n */\nexport type CredentialSubject = {\n  id?: string\n  [x: string]: any\n}\n\n/**\n * Used for the discovery of information about the current status of a verifiable credential, such as whether it is\n * suspended or revoked.\n * The precise contents of the credential status information are determined by the specific `credentialStatus` type\n *  definition and vary depending on factors such as whether it is simple to implement or if it is privacy-enhancing.\n *\n * See {@link https://www.w3.org/TR/vc-data-model/#status | Credential Status}\n *\n * @beta This API may change without a BREAKING CHANGE notice.\n */\nexport type CredentialStatusReference = {\n  id: string\n  type: string\n  [x: string]: any\n}\n\n/**\n * Represents the result of a status check.\n *\n * Implementations MUST populate the `revoked` boolean property, but they can return additional metadata that is\n * method-specific.\n *\n * @see {@link credential-status#CredentialStatus | CredentialStatus}\n *\n * @beta This API may change without a BREAKING CHANGE notice.\n */\nexport type CredentialStatus = {\n  revoked: boolean\n  [x: string]: any\n}\n\n/**\n * A proof property of a {@link VerifiableCredential} or {@link VerifiablePresentation}\n *\n * @beta This API may change without a BREAKING CHANGE notice.\n */\nexport interface ProofType {\n  type?: string\n\n  proofValue?: string\n\n  [x: string]: any\n}\n\n/**\n * The data type for `@context` properties of credentials, presentations, etc.\n *\n * @beta This API may change without a BREAKING CHANGE notice.\n */\nexport type ContextType = string | Record<string, any> | (string | Record<string, any>)[]\n\n/**\n * Represents an unsigned W3C Credential payload.\n * See {@link https://www.w3.org/TR/vc-data-model/#credentials | VC data model}\n *\n * @beta This API may change without a BREAKING CHANGE notice.\n */\nexport interface UnsignedCredential {\n  issuer: IssuerType\n  credentialSubject: CredentialSubject\n  type?: string[] | string\n  '@context': ContextType\n  issuanceDate: string\n  expirationDate?: string\n  credentialStatus?: CredentialStatusReference\n  id?: string\n\n  [x: string]: any\n}\n\n/**\n * Represents a signed Verifiable Credential payload (includes proof), using a JSON representation.\n * See {@link https://www.w3.org/TR/vc-data-model/#credentials | VC data model}\n *\n * @beta This API may change without a BREAKING CHANGE notice.\n */\nexport type VerifiableCredential = UnsignedCredential & { proof: ProofType }\n\n/**\n * Represents a signed Verifiable Credential (includes proof), in either JSON or compact JWT format.\n * See {@link https://www.w3.org/TR/vc-data-model/#credentials | VC data model}\n * See {@link https://www.w3.org/TR/vc-data-model-1.1/#proof-formats | proof formats}\n *\n * @beta This API may change without a BREAKING CHANGE notice.\n */\nexport type W3CVerifiableCredential = VerifiableCredential | CompactJWT\n\n/**\n * Represents an unsigned W3C Presentation payload.\n * See {@link https://www.w3.org/TR/vc-data-model/#presentations | VP data model}\n * @public\n */\nexport interface UnsignedPresentation {\n  holder: string\n  verifiableCredential?: W3CVerifiableCredential[]\n  type?: string[] | string\n  '@context': ContextType\n  verifier?: string[]\n  issuanceDate?: string\n  expirationDate?: string\n  id?: string\n\n  [x: string]: any\n}\n\n/**\n * Represents a signed Verifiable Presentation (includes proof), using a JSON representation.\n * See {@link https://www.w3.org/TR/vc-data-model/#presentations | VP data model}\n * @public\n */\nexport type VerifiablePresentation = UnsignedPresentation & { proof: ProofType }\n\n/**\n * Represents a signed Verifiable Presentation (includes proof) in either JSON or compact JWT format.\n * See {@link https://www.w3.org/TR/vc-data-model/#credentials | VC data model}\n *\n * @public\n */\nexport type W3CVerifiablePresentation = VerifiablePresentation | CompactJWT\n\n/**\n * Represents an issuance or expiration date for Credentials / Presentations.\n * This is used as input when creating them.\n *\n * @beta This API may change without prior notice.\n */\nexport type DateType = string | Date\n\n/**\n * Used as input when creating Verifiable Credentials\n *\n * @beta This API may change without prior notice.\n */\nexport interface CredentialPayload {\n  issuer: IssuerType\n  credentialSubject?: CredentialSubject\n  type?: string[]\n  '@context'?: ContextType\n  issuanceDate?: DateType\n  expirationDate?: DateType\n  credentialStatus?: CredentialStatusReference\n  id?: string\n\n  [x: string]: any\n}\n\n/**\n * Used as input when creating Verifiable Presentations\n *\n * @beta This API may change without prior notice.\n */\nexport interface PresentationPayload {\n  holder: string\n  verifiableCredential?: W3CVerifiableCredential[]\n  type?: string[]\n  '@context'?: ContextType\n  verifier?: string[]\n  issuanceDate?: DateType\n  expirationDate?: DateType\n  id?: string\n\n  [x: string]: any\n}\n"
  },
  {
    "path": "packages/core-types/tsconfig.json",
    "content": "{\n  \"extends\": \"../tsconfig.settings.json\",\n  \"compilerOptions\": {\n    \"rootDir\": \"src\",\n    \"outDir\": \"build\"\n  },\n  \"include\": [\"./**/*.ts\"]\n}\n"
  },
  {
    "path": "packages/credential-eip712/CHANGELOG.md",
    "content": "# Change Log\n\nAll notable changes to this project will be documented in this file.\nSee [Conventional Commits](https://conventionalcommits.org) for commit guidelines.\n\n# [7.0.0](https://github.com/decentralized-identity/veramo/compare/v6.0.2...v7.0.0) (2026-02-11)\n\n\n### Bug Fixes\n\n* **deps:** update devdeps and bump typeorm to 0.3.20 ([#1272](https://github.com/decentralized-identity/veramo/issues/1272)) ([7d17f37](https://github.com/decentralized-identity/veramo/commit/7d17f37ea7cc4e73a8cdae028681ae1be5c4d11c))\n\n\n### Features\n\n* **credential-w3c:** refactor the ICredentialProvider API ([#1488](https://github.com/decentralized-identity/veramo/issues/1488)) ([cbd848d](https://github.com/decentralized-identity/veramo/commit/cbd848d4ce2b52497d99d335f1c93bd8b005cdb2))\n* **credential-w3c:** remove hardcoded proof formats ([#1395](https://github.com/decentralized-identity/veramo/issues/1395)) ([5b7d3fa](https://github.com/decentralized-identity/veramo/commit/5b7d3fad7d2ada4954f8020a6474df13d9fe51dc))\n\n\n### BREAKING CHANGES\n\n* **credential-w3c:** This changeset, along with the previous changes in #1395 modify the CredentialPlugin to support extensibility without modifications to the veramo repository. This plugin now acts as an orchestrator for other ICredentialProvider implementations that provide the actual support for various verifiable data formats. ICredentialProvider implementations can be implemented externally and used with this plugin.\n* **credential-w3c:** The credential plugins specializing in JSON-LD / EIP712 are no longer top level veramo plugins but are now managed by the `@veramo/credential-w3c` plugin which will be able to use multiple proof formats and multiplex accordingly. The constructor for the `CredentialPlugin` has changed to accept different implementations of proof formats.\n\n\n\n\n\n## [6.0.2](https://github.com/decentralized-identity/veramo/compare/v6.0.1...v6.0.2) (2026-01-16)\n\n**Note:** Version bump only for package @veramo/credential-eip712\n\n\n\n\n\n## [6.0.1](https://github.com/decentralized-identity/veramo/compare/v6.0.0...v6.0.1) (2026-01-16)\n\n**Note:** Version bump only for package @veramo/credential-eip712\n\n\n\n\n\n# [6.0.0](https://github.com/decentralized-identity/veramo/compare/v5.6.0...v6.0.0) (2024-04-02)\n\n\n### Bug Fixes\n\n* **credential-w3c:** forward DID resolution options to the resolver ([#1344](https://github.com/decentralized-identity/veramo/issues/1344)) ([0c22cc6](https://github.com/decentralized-identity/veramo/commit/0c22cc6a79e974214500e4440b0ea2977012377d)), closes [#1343](https://github.com/decentralized-identity/veramo/issues/1343)\n* **did-provider-key:** align did:key resolver to spec ([#1332](https://github.com/decentralized-identity/veramo/issues/1332)) ([8e3b94c](https://github.com/decentralized-identity/veramo/commit/8e3b94cf997619d7adcb5cb8827e0f55ff88cdb5)), closes [#1330](https://github.com/decentralized-identity/veramo/issues/1330)\n* export const plugin schemas instead of defaults ([#1327](https://github.com/decentralized-identity/veramo/issues/1327)) ([7896cea](https://github.com/decentralized-identity/veramo/commit/7896ceaf2c79993eee44e46950814bea74bfe647)), closes [#1318](https://github.com/decentralized-identity/veramo/issues/1318) [#1317](https://github.com/decentralized-identity/veramo/issues/1317) [#1315](https://github.com/decentralized-identity/veramo/issues/1315)\n* **utils:** get chainId for any did method ([#1334](https://github.com/decentralized-identity/veramo/issues/1334)) ([d5375bd](https://github.com/decentralized-identity/veramo/commit/d5375bd03e814a2d3fcd96274607f880db77fbe3))\n\n\n### Code Refactoring\n\n* generate plugin schemas as TS instead of JSON ([#1315](https://github.com/decentralized-identity/veramo/issues/1315)) ([65c2d4b](https://github.com/decentralized-identity/veramo/commit/65c2d4bc814daa9a3a89f4f7b8e8c6973b8ce2f0)), closes [#1254](https://github.com/decentralized-identity/veramo/issues/1254)\n\n\n### BREAKING CHANGES\n\n* **utils:** The `getChainIdForDidEthr` method has been renamed to `getChainId`\n* The `plugin.schema.json` files are now generated as `plugin.schema.ts`.\n\n\n\n\n\n# [5.6.0](https://github.com/decentralized-identity/veramo/compare/v5.5.3...v5.6.0) (2024-01-16)\n\n\n### Features\n\n* **remote-client:** allow dynamic headers param for AgentRestClient constructor ([#1314](https://github.com/decentralized-identity/veramo/issues/1314)) ([1b8a0a2](https://github.com/decentralized-identity/veramo/commit/1b8a0a2718dd63492ad3a312a6ebe5f6e7849935)), closes [#1313](https://github.com/decentralized-identity/veramo/issues/1313)\n\n\n\n\n\n## [5.5.3](https://github.com/decentralized-identity/veramo/compare/v5.5.2...v5.5.3) (2023-10-09)\n\n\n### Bug Fixes\n\n* use DIF URLs in packages ([#1271](https://github.com/decentralized-identity/veramo/issues/1271)) ([3dfc601](https://github.com/decentralized-identity/veramo/commit/3dfc6014cdee7902c59d8db76b4c8507b870f227))\n\n\n\n\n\n# [5.5.0](https://github.com/uport-project/veramo/compare/v5.4.1...v5.5.0) (2023-09-19)\n\n\n### Bug Fixes\n\n* **deps:** update dependency @metamask/eth-sig-util to v6 ([c60252c](https://github.com/uport-project/veramo/commit/c60252ce76318fc201580bc39db8775b71ee6d13))\n* **did-provider-key:** use compressed keys for creating Secp256k1 did:key ([#1217](https://github.com/uport-project/veramo/issues/1217)) ([ba8f6f5](https://github.com/uport-project/veramo/commit/ba8f6f5b9b701e57af86491504ecd209ca0c1c1d)), closes [#1213](https://github.com/uport-project/veramo/issues/1213)\n\n\n\n\n\n## [5.4.1](https://github.com/uport-project/veramo/compare/v5.4.0...v5.4.1) (2023-08-04)\n\n\n### Bug Fixes\n\n* **ci:** benign change meant to tag all packages for another patch release ([#1211](https://github.com/uport-project/veramo/issues/1211)) ([41b5c90](https://github.com/uport-project/veramo/commit/41b5c90277171b7b38c5cf49ca01db5cf75b6300))\n\n\n\n\n\n# [5.4.0](https://github.com/uport-project/veramo/compare/v5.3.0...v5.4.0) (2023-08-01)\n\n\n### Features\n\n* **credential-w3c:** allow issuers with query parameters for credentials and presentations ([#1207](https://github.com/uport-project/veramo/issues/1207)) ([688f59d](https://github.com/uport-project/veramo/commit/688f59d6b492bc25bc51bbe73be969d6c30a958d)), closes [#1201](https://github.com/uport-project/veramo/issues/1201)\n\n\n\n\n\n# [5.3.0](https://github.com/uport-project/veramo/compare/v5.2.0...v5.3.0) (2023-07-27)\n\n\n### Bug Fixes\n\n* **credential-eip712:** remove JSON.stringify for string credential ([#1176](https://github.com/uport-project/veramo/issues/1176)) ([469dcd9](https://github.com/uport-project/veramo/commit/469dcd9ba008dc73934335f55e9da80152c40371))\n\n\n\n\n\n# [5.2.0](https://github.com/uport-project/veramo/compare/v5.1.4...v5.2.0) (2023-05-02)\n\n**Note:** Version bump only for package @veramo/credential-eip712\n\n\n\n\n\n## [5.1.2](https://github.com/uport-project/veramo/compare/v5.1.1...v5.1.2) (2023-02-25)\n\n**Note:** Version bump only for package @veramo/credential-eip712\n\n\n\n\n\n# [5.1.0](https://github.com/uport-project/veramo/compare/v5.0.0...v5.1.0) (2023-02-24)\n\n\n### Bug Fixes\n\n* **credential-eip712:** compatibility improvements for EthereumEIP712Signature2021 ([#1131](https://github.com/uport-project/veramo/issues/1131)) ([672f92b](https://github.com/uport-project/veramo/commit/672f92b1bd3850c369cbef646c8ece8a58fafc16))\n\n\n### Features\n\n* **core-types:** allow inline [@context](https://github.com/context) for Credentials and Presentations ([#1119](https://github.com/uport-project/veramo/issues/1119)) ([44bb365](https://github.com/uport-project/veramo/commit/44bb36503b635ee1f5431cb4bf28c7a9ba111156)), closes [#1073](https://github.com/uport-project/veramo/issues/1073)\n\n\n\n\n\n# [5.0.0](https://github.com/uport-project/veramo/compare/v4.3.0...v5.0.0) (2023-02-09)\n\n\n### Build System\n\n* convert veramo modules to ESM instead of CommonJS ([#1103](https://github.com/uport-project/veramo/issues/1103)) ([b5cea3c](https://github.com/uport-project/veramo/commit/b5cea3c0d80d900a47bd1d9eea68f84b70a35e7b)), closes [#1099](https://github.com/uport-project/veramo/issues/1099)\n\n\n### Features\n\n* isolate `core-types` package from `core` ([#1116](https://github.com/uport-project/veramo/issues/1116)) ([ba7a303](https://github.com/uport-project/veramo/commit/ba7a303de91cf4cc568a3af1ddf8ca98ed022e9f))\n\n\n### BREAKING CHANGES\n\n* this is a breaking change as modules will have to be imported differently: \n* https://www.typescriptlang.org/docs/handbook/esm-node.html\n* https://nodejs.org/api/esm.html\n* https://caniuse.com/?search=modules\n\ntest(did-provider-ion): skip a couple of tests that fail with unreasonable errors\nchore: use ubuntu-latest on CI\nfix: temporarily remove puppeteer tests\nfix: use craco for test-react-app to enable babel config\ntest: fix unit and integration tests (browser tests still broken)\nfix: fix some build issues that prevented tests from working\nfix: missing deps flagged by pnpm\n\n\n\n\n\n# [4.3.0](https://github.com/uport-project/veramo/compare/v4.2.0...v4.3.0) (2023-01-27)\n\n**Note:** Version bump only for package @veramo/credential-eip712\n\n\n\n\n\n# [4.2.0](https://github.com/uport-project/veramo/compare/v4.1.2...v4.2.0) (2022-12-05)\n\n\n### Bug Fixes\n\n* **deps:** bump dependencies ([701b8ed](https://github.com/uport-project/veramo/commit/701b8edf981ea11c7ddb6a81d2817dbbdbb022f3))\n\n\n\n\n\n## [4.1.1](https://github.com/uport-project/veramo/compare/v4.1.0...v4.1.1) (2022-11-01)\n\n**Note:** Version bump only for package @veramo/credential-eip712\n\n\n\n\n\n# [4.1.0](https://github.com/uport-project/veramo/compare/v4.0.2...v4.1.0) (2022-10-31)\n\n**Note:** Version bump only for package @veramo/credential-eip712\n\n\n\n\n\n## [4.0.2](https://github.com/uport-project/veramo/compare/v4.0.1...v4.0.2) (2022-10-04)\n\n\n### Bug Fixes\n\n* **credential-eip712:** add support for all did methods that use secp256k ([#1011](https://github.com/uport-project/veramo/issues/1011)) ([9940068](https://github.com/uport-project/veramo/commit/99400689dec9ea00131cf914d1999357b716612c)), closes [#991](https://github.com/uport-project/veramo/issues/991)\n* **deps:** update dependency @metamask/eth-sig-util to v5 ([bf3a406](https://github.com/uport-project/veramo/commit/bf3a406a19f1ab6d57819c1ff3df2b2f3b2f4d03))\n\n\n\n\n\n# [4.0.0](https://github.com/uport-project/veramo/compare/v3.1.5...v4.0.0) (2022-09-22)\n\n\n### Bug Fixes\n\n* **credential-eip712:** update plugin schema ([#915](https://github.com/uport-project/veramo/issues/915)) ([3a0765e](https://github.com/uport-project/veramo/commit/3a0765ef632aae29701004cbfbeb38a2de7bc847))\n* **credential-status:** check credential status for all credential types ([#949](https://github.com/uport-project/veramo/issues/949)) ([877c513](https://github.com/uport-project/veramo/commit/877c513a5bc253ed30c74ace00ce988197d12a2d)), closes [#934](https://github.com/uport-project/veramo/issues/934)\n* update and fix inline documentation of all exported types ([#921](https://github.com/uport-project/veramo/issues/921)) ([63e64e0](https://github.com/uport-project/veramo/commit/63e64e0e2693808c4704dca8cc511dc0bab3f3b1))\n\n\n### Features\n\n* **credential-ld:** add support for browser environments ([#916](https://github.com/uport-project/veramo/issues/916)) ([435e4d2](https://github.com/uport-project/veramo/commit/435e4d260b1774f96b182c1a75ab2f1c993f2291))\n* **credential-status:** expect revoked boolean property from StatusMethods ([e00daa4](https://github.com/uport-project/veramo/commit/e00daa47865ea42d7bd8667f37c6e12fc21fd4b9))\n* **credential-w3c:** align verification API between formats ([#996](https://github.com/uport-project/veramo/issues/996)) ([b987fc0](https://github.com/uport-project/veramo/commit/b987fc0903a31d3bbffb43fef872be4d6c62c2ad)), closes [#935](https://github.com/uport-project/veramo/issues/935) [#954](https://github.com/uport-project/veramo/issues/954) [#375](https://github.com/uport-project/veramo/issues/375) [#989](https://github.com/uport-project/veramo/issues/989)\n* CredentialIssuerEIP712 ([#899](https://github.com/uport-project/veramo/issues/899)) ([5d62c52](https://github.com/uport-project/veramo/commit/5d62c52e28a504470f8ba2c2cbd3c38eed7f435f))\n* **kms-web3:** add a KMS implementation backed by a web3 provider ([#924](https://github.com/uport-project/veramo/issues/924)) ([14f71af](https://github.com/uport-project/veramo/commit/14f71afbb72dca8274790d3b20b518ddfe4f2585)), closes [#688](https://github.com/uport-project/veramo/issues/688)\n"
  },
  {
    "path": "packages/credential-eip712/LICENSE",
    "content": "                                 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 2022 Consensys AG\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"
  },
  {
    "path": "packages/credential-eip712/api-extractor.json",
    "content": "{\n  \"$schema\": \"https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json\",\n  \"apiReport\": {\n    \"enabled\": true,\n    \"reportFolder\": \"./api\",\n    \"reportTempFolder\": \"./api\"\n  },\n\n  \"docModel\": {\n    \"enabled\": true,\n    \"apiJsonFilePath\": \"./api/<unscopedPackageName>.api.json\"\n  },\n\n  \"dtsRollup\": {\n    \"enabled\": false\n  },\n  \"mainEntryPointFilePath\": \"<projectFolder>/build/index.d.ts\"\n}\n"
  },
  {
    "path": "packages/credential-eip712/package.json",
    "content": "{\n  \"name\": \"@veramo/credential-eip712\",\n  \"description\": \"Veramo plugin for working with EIP712 Verifiable Credentials & Presentations.\",\n  \"version\": \"7.0.0\",\n  \"main\": \"build/index.js\",\n  \"exports\": {\n    \".\": \"./build/index.js\"\n  },\n  \"types\": \"build/index.d.ts\",\n  \"scripts\": {\n    \"build\": \"tsc\",\n    \"extract-api\": \"node ../cli/bin/veramo.js dev extract-api\"\n  },\n  \"dependencies\": {\n    \"@metamask/eth-sig-util\": \"^7.0.0\",\n    \"@veramo/core-types\": \"workspace:^\",\n    \"@veramo/credential-w3c\": \"workspace:^\",\n    \"@veramo/utils\": \"workspace:^\",\n    \"debug\": \"^4.3.3\",\n    \"eip-712-types-generation\": \"^0.1.6\"\n  },\n  \"devDependencies\": {\n    \"@types/debug\": \"4.1.8\",\n    \"typescript\": \"5.7.3\"\n  },\n  \"files\": [\n    \"build/**/*\",\n    \"src/**/*\",\n    \"README.md\",\n    \"LICENSE\"\n  ],\n  \"publishConfig\": {\n    \"access\": \"public\"\n  },\n  \"repository\": {\n    \"type\": \"git\",\n    \"url\": \"https://github.com/decentralized-identity/veramo.git\",\n    \"directory\": \"packages/credential-eip712\"\n  },\n  \"author\": \"Consensys Mesh R&D <hello@veramo.io>\",\n  \"contributors\": [\n    \"Nick Reynolds <nick.reynolds@mesh.xyz>\",\n    \"Italo Borssatto\",\n    \"Mircea Nistor <mircea.nistor@mesh.xyz>\",\n    \"Simonas Karuzas <simonas.karuzas@mesh.xyz>\"\n  ],\n  \"keywords\": [\n    \"Veramo\",\n    \"DID\",\n    \"Verifiable Credential\",\n    \"EIP712\",\n    \"EthereumEIP712Signature2021\",\n    \"veramo-plugin\"\n  ],\n  \"license\": \"Apache-2.0\",\n  \"type\": \"module\",\n  \"moduleDirectories\": [\n    \"node_modules\",\n    \"src\"\n  ]\n}\n"
  },
  {
    "path": "packages/credential-eip712/src/__tests__/issue-verify-flow-eip712.test.ts",
    "content": "import {\n  CredentialPayload,\n  ICredentialPlugin,\n  IDIDManager,\n  IIdentifier,\n  IKeyManager,\n  IResolver,\n  TAgent,\n} from '../../../core-types/src/index.js'\nimport { createAgent } from '../../../core/src/index.js'\nimport { CredentialPlugin } from '../../../credential-w3c/src/index.js'\nimport { DIDManager, MemoryDIDStore } from '../../../did-manager/src/index.js'\nimport { KeyManager, MemoryKeyStore, MemoryPrivateKeyStore } from '../../../key-manager/src/index.js'\nimport { KeyManagementSystem } from '../../../kms-local/src/index.js'\nimport { getDidKeyResolver, KeyDIDProvider } from '../../../did-provider-key/src/index.js'\nimport { DIDResolverPlugin } from '../../../did-resolver/src/index.js'\nimport { CredentialProviderEIP712 } from '../agent/CredentialProviderEIP712.js'\n\ndescribe('Issue and Verify Flow EIP712', () => {\n  let didKeyIdentifier: IIdentifier\n  let agent: TAgent<IResolver & IKeyManager & IDIDManager & ICredentialPlugin>\n\n  beforeAll(async () => {\n    agent = createAgent<IResolver & IKeyManager & IDIDManager & ICredentialPlugin>({\n      plugins: [\n        new KeyManager({\n          store: new MemoryKeyStore(),\n          kms: {\n            local: new KeyManagementSystem(new MemoryPrivateKeyStore()),\n          },\n        }),\n        new DIDManager({\n          providers: {\n            'did:key': new KeyDIDProvider({ defaultKms: 'local' }),\n          },\n          store: new MemoryDIDStore(),\n          defaultProvider: 'did:key',\n        }),\n        new DIDResolverPlugin({\n          ...getDidKeyResolver(),\n        }),\n        new CredentialPlugin([new CredentialProviderEIP712()]),\n      ],\n    })\n    didKeyIdentifier = await agent.didManagerCreate({ options: { key: { type: 'Secp256k1' } } })\n  })\n\n  it('issues and verifies EIP712 credential', async () => {\n    const credential: CredentialPayload = {\n      issuer: { id: didKeyIdentifier.did },\n      type: ['VerifiableCredential'],\n      credentialSubject: {\n        id: 'hello',\n      },\n    }\n    const verifiableCredential = await agent.createVerifiableCredential({\n      credential,\n      proofFormat: 'EthereumEip712Signature2021',\n    })\n\n    expect(verifiableCredential).toBeDefined()\n\n    const result = await agent.verifyCredential({\n      credential: verifiableCredential,\n    })\n\n    expect(result.verified).toBe(true)\n  })\n\n  it('fails to verify a tampered EIP712 credential', async () => {\n    const credential: CredentialPayload = {\n      issuer: { id: didKeyIdentifier.did },\n      type: ['VerifiableCredential'],\n      credentialSubject: {\n        id: 'hello',\n      },\n    }\n    const verifiableCredential = await agent.createVerifiableCredential({\n      credential,\n      proofFormat: 'EthereumEip712Signature2021',\n    })\n\n    expect(verifiableCredential).toBeDefined()\n\n    // Tamper with the credential\n    if (typeof verifiableCredential === 'object' && 'credentialSubject' in verifiableCredential) {\n      verifiableCredential.credentialSubject['id'] = 'tampered'\n    }\n\n    const result = await agent.verifyCredential({\n      credential: verifiableCredential,\n    })\n\n    expect(result.verified).toBe(false)\n    expect(result.error).toEqual({\n      errorCode: 'invalid_signature',\n      message: 'invalid_signature: The signature does not match any of the issuer signing keys',\n    })\n  })\n\n  it('issues and verifies EIP712 presentation', async () => {\n    const credential: CredentialPayload = {\n      issuer: { id: didKeyIdentifier.did },\n      type: ['VerifiableCredential'],\n      credentialSubject: {\n        id: 'hello',\n      },\n    }\n    const verifiableCredential1 = await agent.createVerifiableCredential({\n      credential,\n      proofFormat: 'EthereumEip712Signature2021',\n    })\n    const verifiablePresentation = await agent.createVerifiablePresentation({\n      presentation: {\n        verifiableCredential: [verifiableCredential1],\n        holder: didKeyIdentifier.did,\n      },\n      challenge: 'VERAMO',\n      proofFormat: 'EthereumEip712Signature2021',\n    })\n    expect(verifiablePresentation).toBeDefined()\n\n    const result = await agent.verifyPresentation({\n      presentation: verifiablePresentation,\n      challenge: 'VERAMO',\n    })\n    expect(result.verified).toBe(true)\n  })\n})\n"
  },
  {
    "path": "packages/credential-eip712/src/agent/CredentialProviderEIP712.ts",
    "content": "import {\n  CredentialPayload,\n  ICreateVerifiableCredentialArgs,\n  ICreateVerifiablePresentationArgs,\n  IIdentifier,\n  IKey,\n  IssuerAgentContext,\n  IVerifyCredentialArgs,\n  IVerifyPresentationArgs,\n  IVerifyResult,\n  PresentationPayload,\n  PROOF_FORMAT,\n  ProofFormat,\n  VerifiableCredential,\n  VerifiablePresentation,\n  VerifierAgentContext,\n} from '@veramo/core-types'\nimport {\n  extractIssuer,\n  getChainId,\n  getEthereumAddress,\n  intersect,\n  isDefined,\n  MANDATORY_CREDENTIAL_CONTEXT,\n  mapIdentifierKeysToDoc,\n  processEntryToArray,\n  removeDIDParameters,\n  resolveDidOrThrow,\n} from '@veramo/utils'\nimport { ICredentialProvider, ProofFormatQuery, TentativeVerificationQuery } from '@veramo/credential-w3c'\n\nimport { recoverTypedSignature, SignTypedDataVersion } from '@metamask/eth-sig-util'\n\nimport { getEthTypesFromInputDoc } from 'eip-712-types-generation'\n\n/**\n * A Veramo Credential sub-plugin that implements\n * a {@link @veramo/credential-w3c#ICredentialProvider | ICredentialProvider} with support for\n * EthereumEIP712Signature2021 proofs.\n *\n * @beta This API may change without a BREAKING CHANGE notice.\n * @see {@link https://w3c-ccg.github.io/ethereum-eip712-signature-2021-spec/ | EthereumEIP712Signature2021 spec }\n * @see {@link https://www.w3.org/TR/vc-data-model-1.1/ | VC 1.1 data model}.\n */\nexport class CredentialProviderEIP712 implements ICredentialProvider {\n  /** {@inheritdoc @veramo/credential-w3c#ICredentialProvider.getProofFormatsSupportedForKey} */\n  getProofFormatsSupportedForKey(key: IKey): ProofFormat[] {\n    if (this.matchKeyForEIP712(key)) {\n      return [PROOF_FORMAT.ETHEREUM_EIP712_SIGNATURE_2021]\n    }\n    return []\n  }\n\n  /** {@inheritdoc @veramo/credential-w3c#ICredentialProvider.canIssueCredentialType} */\n  canIssueProofFormat(query: ProofFormatQuery): boolean {\n    return query.proofFormat === PROOF_FORMAT.ETHEREUM_EIP712_SIGNATURE_2021\n  }\n\n  /** {@inheritdoc @veramo/credential-w3c#ICredentialProvider.canVerifyDocumentType} */\n  canVerifyDocumentType(query: TentativeVerificationQuery): boolean {\n    const { document } = query\n    return (<VerifiableCredential>document)?.proof?.type === PROOF_FORMAT.ETHEREUM_EIP712_SIGNATURE_2021\n  }\n\n  /** {@inheritdoc @veramo/credential-w3c#ICredentialProvider.createVerifiableCredential} */\n  async createVerifiableCredential(\n    args: ICreateVerifiableCredentialArgs,\n    context: IssuerAgentContext,\n  ): Promise<VerifiableCredential> {\n    const credentialContext = processEntryToArray(\n      args?.credential?.['@context'],\n      MANDATORY_CREDENTIAL_CONTEXT,\n    )\n    const credentialType = processEntryToArray(args?.credential?.type, 'VerifiableCredential')\n    let issuanceDate = args?.credential?.issuanceDate || new Date().toISOString()\n    if (issuanceDate instanceof Date) {\n      issuanceDate = issuanceDate.toISOString()\n    }\n\n    const issuer = extractIssuer(args.credential, { removeParameters: true })\n    if (!issuer || typeof issuer === 'undefined') {\n      throw new Error('invalid_argument: credential.issuer must not be empty')\n    }\n\n    let keyRef = args.keyRef\n\n    const identifier = await context.agent.didManagerGet({ did: issuer })\n\n    if (!keyRef) {\n      const key = identifier.keys.find(\n        (k) => k.type === 'Secp256k1' && k.meta?.algorithms?.includes('eth_signTypedData'),\n      )\n      if (!key) throw Error('key_not_found: No suitable signing key is known for ' + identifier.did)\n      keyRef = key.kid\n    }\n\n    const extendedKeys = await mapIdentifierKeysToDoc(\n      identifier,\n      'verificationMethod',\n      context,\n      args.resolutionOptions,\n    )\n    const extendedKey = extendedKeys.find((key) => key.kid === keyRef)\n    if (!extendedKey)\n      throw Error('key_not_found: The signing key is not available in the issuer DID document')\n\n    let chainId\n    try {\n      chainId = getChainId(extendedKey.meta.verificationMethod)\n    } catch (e) {\n      chainId = 1\n    }\n    const credential: CredentialPayload = {\n      ...args?.credential,\n      '@context': credentialContext,\n      type: credentialType,\n      issuanceDate,\n      proof: {\n        verificationMethod: extendedKey.meta.verificationMethod.id,\n        created: issuanceDate,\n        proofPurpose: 'assertionMethod',\n        type: PROOF_FORMAT.ETHEREUM_EIP712_SIGNATURE_2021,\n      },\n    }\n\n    const message = credential\n    const domain = {\n      chainId,\n      name: 'VerifiableCredential',\n      version: '1',\n    }\n\n    const primaryType = 'VerifiableCredential'\n    const allTypes = getEthTypesFromInputDoc(credential, primaryType)\n    const types = { ...allTypes }\n\n    const data = JSON.stringify({ domain, types, message, primaryType })\n\n    credential['proof']['proofValue'] = await context.agent.keyManagerSign({\n      keyRef,\n      data,\n      algorithm: 'eth_signTypedData',\n    })\n    credential['proof']['eip712'] = {\n      domain,\n      types: allTypes,\n      primaryType,\n    }\n\n    return credential as VerifiableCredential\n  }\n\n  /** {@inheritdoc @veramo/credential-w3c#ICredentialProvider.verifyCredential} */\n  async verifyCredential(args: IVerifyCredentialArgs, context: VerifierAgentContext): Promise<IVerifyResult> {\n    const credential = args.credential as VerifiableCredential\n    if (!credential.proof || !credential.proof.proofValue)\n      throw new Error('invalid_argument: proof is undefined')\n\n    const { proof, ...signingInput } = credential\n    const { proofValue, eip712, eip712Domain, ...verifyInputProof } = proof\n    const verificationMessage = {\n      ...signingInput,\n      proof: verifyInputProof,\n    }\n\n    const compat = {\n      ...eip712Domain,\n      ...eip712,\n    }\n\n    compat.types = compat.types || compat.messageSchema\n\n    if (!compat.primaryType || !compat.types || !compat.domain)\n      throw new Error('invalid_argument: proof is missing expected properties')\n\n    const objectToVerify = {\n      message: verificationMessage,\n      domain: compat.domain,\n      types: compat.types,\n      primaryType: compat.primaryType,\n    }\n\n    const recovered = recoverTypedSignature({\n      data: objectToVerify,\n      signature: proofValue!,\n      version: SignTypedDataVersion.V4,\n    })\n\n    const issuer = extractIssuer(credential)\n    if (!issuer || typeof issuer === 'undefined') {\n      throw new Error('invalid_argument: credential.issuer must not be empty')\n    }\n\n    const didDocument = await resolveDidOrThrow(issuer, context, args.resolutionOptions)\n\n    if (didDocument.verificationMethod) {\n      for (const verificationMethod of didDocument.verificationMethod) {\n        if (getEthereumAddress(verificationMethod)?.toLowerCase() === recovered.toLowerCase()) {\n          return {\n            verified: true,\n          }\n        }\n      }\n    } else {\n      throw new Error('resolver_error: issuer DIDDocument does not contain any verificationMethods')\n    }\n\n    return {\n      verified: false,\n      error: {\n        message: 'invalid_signature: The signature does not match any of the issuer signing keys',\n        errorCode: 'invalid_signature',\n      },\n    }\n  }\n\n  /** {@inheritdoc @veramo/credential-w3c#ICredentialProvider.createVerifiablePresentation} */\n  async createVerifiablePresentation(\n    args: ICreateVerifiablePresentationArgs,\n    context: IssuerAgentContext,\n  ): Promise<VerifiablePresentation> {\n    const presentationContext = processEntryToArray(\n      args?.presentation?.['@context'],\n      MANDATORY_CREDENTIAL_CONTEXT,\n    )\n    const presentationType = processEntryToArray(args?.presentation?.type, 'VerifiablePresentation')\n    let issuanceDate = args?.presentation?.issuanceDate || new Date().toISOString()\n    if (issuanceDate instanceof Date) {\n      issuanceDate = issuanceDate.toISOString()\n    }\n\n    const presentation: PresentationPayload = {\n      ...args?.presentation,\n      '@context': presentationContext,\n      type: presentationType,\n      issuanceDate,\n    }\n\n    if (!isDefined(args.presentation.holder)) {\n      throw new Error('invalid_argument: presentation.holder must not be empty')\n    }\n\n    if (args.presentation.verifiableCredential) {\n      // EIP712 arrays must use a single data type, so we map all credentials to strings.\n      presentation.verifiableCredential = args.presentation.verifiableCredential.map((cred) => {\n        // map JWT credentials to their canonical form\n        if (typeof cred === 'string') {\n          return cred\n        } else if (cred.proof.jwt) {\n          return cred.proof.jwt\n        } else {\n          return JSON.stringify(cred)\n        }\n      })\n    }\n\n    const holder = removeDIDParameters(presentation.holder)\n\n    let identifier: IIdentifier\n    try {\n      identifier = await context.agent.didManagerGet({ did: holder })\n    } catch (e) {\n      throw new Error('invalid_argument: presentation.holder must be a DID managed by this agent')\n    }\n\n    let keyRef = args.keyRef\n\n    if (!keyRef) {\n      const key = identifier.keys.find(\n        (k) => k.type === 'Secp256k1' && k.meta?.algorithms?.includes('eth_signTypedData'),\n      )\n      if (!key) throw Error('key_not_found: No suitable signing key is known for ' + identifier.did)\n      keyRef = key.kid\n    }\n\n    const extendedKeys = await mapIdentifierKeysToDoc(\n      identifier,\n      'verificationMethod',\n      context,\n      args.resolutionOptions,\n    )\n    const extendedKey = extendedKeys.find((key) => key.kid === keyRef)\n    if (!extendedKey)\n      throw Error('key_not_found: The signing key is not available in the issuer DID document')\n\n    let chainId\n    try {\n      chainId = getChainId(extendedKey.meta.verificationMethod)\n    } catch (e) {\n      chainId = 1\n    }\n\n    presentation['proof'] = {\n      verificationMethod: extendedKey.meta.verificationMethod.id,\n      created: issuanceDate,\n      proofPurpose: 'assertionMethod',\n      type: PROOF_FORMAT.ETHEREUM_EIP712_SIGNATURE_2021,\n    }\n\n    const message = presentation\n    const domain = {\n      chainId,\n      name: 'VerifiablePresentation',\n      version: '1',\n    }\n\n    const primaryType = 'VerifiablePresentation'\n    const allTypes = getEthTypesFromInputDoc(presentation, primaryType)\n    const types = { ...allTypes }\n\n    const data = JSON.stringify({ domain, types, message })\n\n    presentation.proof.proofValue = await context.agent.keyManagerSign({\n      keyRef,\n      data,\n      algorithm: 'eth_signTypedData',\n    })\n\n    presentation.proof.eip712 = {\n      domain,\n      types: allTypes,\n      primaryType,\n    }\n\n    return presentation as VerifiablePresentation\n  }\n\n  /** {@inheritdoc @veramo/credential-w3c#ICredentialProvider.verifyPresentation} */\n  async verifyPresentation(\n    args: IVerifyPresentationArgs,\n    context: VerifierAgentContext,\n  ): Promise<IVerifyResult> {\n    const presentation = args.presentation as VerifiablePresentation\n    if (!presentation.proof || !presentation.proof.proofValue) throw new Error('Proof is undefined')\n\n    const { proof, ...signingInput } = presentation\n    const { proofValue, eip712, eip712Domain, ...verifyInputProof } = proof\n    const verificationMessage = {\n      ...signingInput,\n      proof: verifyInputProof,\n    }\n\n    const compat = {\n      ...eip712Domain,\n      ...eip712,\n    }\n\n    compat.types = compat.types || compat.messageSchema\n\n    if (!compat.primaryType || !compat.types || !compat.domain)\n      throw new Error('invalid_argument: presentation proof is missing expected properties')\n\n    const objectToVerify = {\n      message: verificationMessage,\n      domain: compat.domain,\n      types: compat.types,\n      primaryType: compat.primaryType,\n    }\n\n    const recovered = recoverTypedSignature({\n      data: objectToVerify,\n      signature: proofValue!,\n      version: SignTypedDataVersion.V4,\n    })\n\n    const issuer = extractIssuer(presentation)\n    if (!issuer || typeof issuer === 'undefined') {\n      throw new Error('invalid_argument: args.presentation.issuer must not be empty')\n    }\n\n    const didDocument = await resolveDidOrThrow(issuer, context, args.resolutionOptions)\n\n    if (didDocument.verificationMethod) {\n      for (const verificationMethod of didDocument.verificationMethod) {\n        if (getEthereumAddress(verificationMethod)?.toLowerCase() === recovered.toLowerCase()) {\n          return {\n            verified: true,\n          }\n        }\n      }\n    } else {\n      throw new Error('resolver_error: holder DIDDocument does not contain any verificationMethods')\n    }\n\n    return {\n      verified: false,\n      error: {\n        message: 'invalid_signature: The signature does not match any of the holder signing keys',\n        errorCode: 'invalid_signature',\n      },\n    }\n  }\n\n  /**\n   * Checks if a key is suitable for signing EIP712 payloads.\n   * This relies on the metadata set by the key management system to determine if this key can sign EIP712 payloads.\n   *\n   * @param k - the key to check\n   *\n   * @internal\n   */\n  matchKeyForEIP712(k: IKey): boolean {\n    return (\n      intersect(k.meta?.algorithms ?? [], ['eth_signTypedData', PROOF_FORMAT.ETHEREUM_EIP712_SIGNATURE_2021])\n        .length > 0\n    )\n  }\n}\n"
  },
  {
    "path": "packages/credential-eip712/src/index.ts",
    "content": "export { CredentialProviderEIP712 } from './agent/CredentialProviderEIP712.js'\n"
  },
  {
    "path": "packages/credential-eip712/tsconfig.json",
    "content": "{\n  \"extends\": \"../tsconfig.settings.json\",\n  \"compilerOptions\": {\n    \"rootDir\": \"src\",\n    \"outDir\": \"build\",\n    \"declarationDir\": \"build\",\n    // https://github.com/transmute-industries/vc.js/issues/60\n    \"skipLibCheck\": true\n  },\n  \"references\": [\n    { \"path\": \"../core-types\" },\n    { \"path\": \"../credential-w3c\" },\n    { \"path\": \"../utils\" }\n  ],\n  \"include\": [\"./**/*.ts\"]\n}\n"
  },
  {
    "path": "packages/credential-jwt/CHANGELOG.md",
    "content": "# Change Log\n\nAll notable changes to this project will be documented in this file.\nSee [Conventional Commits](https://conventionalcommits.org) for commit guidelines.\n\n# [7.0.0](https://github.com/decentralized-identity/veramo/compare/v6.0.2...v7.0.0) (2026-02-11)\n\n\n### Bug Fixes\n\n* **deps:** update devdeps and bump typeorm to 0.3.20 ([#1272](https://github.com/decentralized-identity/veramo/issues/1272)) ([7d17f37](https://github.com/decentralized-identity/veramo/commit/7d17f37ea7cc4e73a8cdae028681ae1be5c4d11c))\n\n\n### Features\n\n* **credential-w3c:** refactor the ICredentialProvider API ([#1488](https://github.com/decentralized-identity/veramo/issues/1488)) ([cbd848d](https://github.com/decentralized-identity/veramo/commit/cbd848d4ce2b52497d99d335f1c93bd8b005cdb2))\n* **credential-w3c:** remove hardcoded proof formats ([#1395](https://github.com/decentralized-identity/veramo/issues/1395)) ([5b7d3fa](https://github.com/decentralized-identity/veramo/commit/5b7d3fad7d2ada4954f8020a6474df13d9fe51dc))\n\n\n### BREAKING CHANGES\n\n* **credential-w3c:** This changeset, along with the previous changes in #1395 modify the CredentialPlugin to support extensibility without modifications to the veramo repository. This plugin now acts as an orchestrator for other ICredentialProvider implementations that provide the actual support for various verifiable data formats. ICredentialProvider implementations can be implemented externally and used with this plugin.\n* **credential-w3c:** The credential plugins specializing in JSON-LD / EIP712 are no longer top level veramo plugins but are now managed by the `@veramo/credential-w3c` plugin which will be able to use multiple proof formats and multiplex accordingly. The constructor for the `CredentialPlugin` has changed to accept different implementations of proof formats.\n"
  },
  {
    "path": "packages/credential-jwt/LICENSE",
    "content": "                                 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 2022 Consensys AG\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"
  },
  {
    "path": "packages/credential-jwt/api-extractor.json",
    "content": "{\n  \"$schema\": \"https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json\",\n  \"apiReport\": {\n    \"enabled\": true,\n    \"reportFolder\": \"./api\",\n    \"reportTempFolder\": \"./api\"\n  },\n\n  \"docModel\": {\n    \"enabled\": true,\n    \"apiJsonFilePath\": \"./api/<unscopedPackageName>.api.json\"\n  },\n\n  \"dtsRollup\": {\n    \"enabled\": false\n  },\n  \"mainEntryPointFilePath\": \"<projectFolder>/build/index.d.ts\"\n}\n"
  },
  {
    "path": "packages/credential-jwt/package.json",
    "content": "{\n  \"name\": \"@veramo/credential-jwt\",\n  \"description\": \"Veramo plugin for working with JWT Verifiable Credentials & Presentations.\",\n  \"version\": \"7.0.0\",\n  \"main\": \"build/index.js\",\n  \"exports\": {\n    \".\": \"./build/index.js\"\n  },\n  \"types\": \"build/index.d.ts\",\n  \"scripts\": {\n    \"build\": \"tsc\",\n    \"extract-api\": \"node ../cli/bin/veramo.js dev extract-api\"\n  },\n  \"dependencies\": {\n    \"@veramo/core-types\": \"workspace:^\",\n    \"@veramo/credential-w3c\": \"workspace:^\",\n    \"@veramo/utils\": \"workspace:^\",\n    \"canonicalize\": \"^2.0.0\",\n    \"debug\": \"^4.3.3\",\n    \"did-jwt-vc\": \"^4.0.0\"\n  },\n  \"devDependencies\": {\n    \"@types/debug\": \"4.1.8\",\n    \"typescript\": \"5.7.3\"\n  },\n  \"files\": [\n    \"build/**/*\",\n    \"src/**/*\",\n    \"README.md\",\n    \"LICENSE\"\n  ],\n  \"publishConfig\": {\n    \"access\": \"public\"\n  },\n  \"repository\": {\n    \"type\": \"git\",\n    \"url\": \"https://github.com/decentralized-identity/veramo.git\",\n    \"directory\": \"packages/credential-jwt\"\n  },\n  \"author\": \"Nick Reynolds <nicholas.s.reynolds@gmail.com>\",\n  \"keywords\": [\n    \"Veramo\",\n    \"DID\",\n    \"Verifiable Credential\",\n    \"JWT\",\n    \"veramo-plugin\"\n  ],\n  \"license\": \"Apache-2.0\",\n  \"type\": \"module\",\n  \"moduleDirectories\": [\n    \"node_modules\",\n    \"src\"\n  ]\n}\n"
  },
  {
    "path": "packages/credential-jwt/src/__tests__/issue-verify-flow-jwt.test.ts",
    "content": "import {\n  CredentialPayload,\n  ICredentialPlugin,\n  IDIDManager,\n  IIdentifier,\n  IKeyManager,\n  IResolver,\n  TAgent,\n} from '../../../core-types/src/index.js'\nimport { createAgent } from '../../../core/src/index.js'\nimport { CredentialPlugin } from '../../../credential-w3c/src/index.js'\nimport { DIDManager, MemoryDIDStore } from '../../../did-manager/src/index.js'\nimport { KeyManager, MemoryKeyStore, MemoryPrivateKeyStore } from '../../../key-manager/src/index.js'\nimport { KeyManagementSystem } from '../../../kms-local/src/index.js'\nimport { getDidKeyResolver, KeyDIDProvider } from '../../../did-provider-key/src/index.js'\nimport { DIDResolverPlugin } from '../../../did-resolver/src/index.js'\nimport { Resolver } from 'did-resolver'\n\nimport { CredentialProviderJWT } from '../agent/CredentialProviderJWT.js'\n\ndescribe('credential-jwt full flow', () => {\n  let didKeyIdentifier: IIdentifier\n  let agent: TAgent<IResolver & IKeyManager & IDIDManager & ICredentialPlugin>\n\n  beforeAll(async () => {\n    agent = createAgent<IResolver & IKeyManager & IDIDManager & ICredentialPlugin>({\n      plugins: [\n        new KeyManager({\n          store: new MemoryKeyStore(),\n          kms: {\n            local: new KeyManagementSystem(new MemoryPrivateKeyStore()),\n          },\n        }),\n        new DIDManager({\n          providers: {\n            'did:key': new KeyDIDProvider({ defaultKms: 'local' }),\n          },\n          store: new MemoryDIDStore(),\n          defaultProvider: 'did:key',\n        }),\n        new DIDResolverPlugin({\n          resolver: new Resolver({\n            ...getDidKeyResolver(),\n          }),\n        }),\n        new CredentialPlugin([new CredentialProviderJWT()]),\n      ],\n    })\n    didKeyIdentifier = await agent.didManagerCreate()\n  })\n\n  it('issues and verifies JWT credential', async () => {\n    const credential: CredentialPayload = {\n      issuer: { id: didKeyIdentifier.did },\n      '@context': ['https://www.w3.org/2018/credentials/v1', 'https://example.com/1/2/3'],\n      type: ['VerifiableCredential', 'Custom'],\n      issuanceDate: new Date().toISOString(),\n      credentialSubject: {\n        id: 'did:web:example.com',\n        you: 'Rock',\n      },\n    }\n    const verifiableCredential = await agent.createVerifiableCredential({\n      credential,\n      proofFormat: 'jwt',\n    })\n\n    expect(verifiableCredential).toBeDefined()\n\n    const result = await agent.verifyCredential({\n      credential: verifiableCredential,\n    })\n\n    expect(result.verified).toBe(true)\n  })\n\n  it('issues credential and verifies presentation', async () => {\n    const credential: CredentialPayload = {\n      issuer: { id: didKeyIdentifier.did },\n      '@context': ['https://www.w3.org/2018/credentials/v1', 'https://veramo.io/contexts/profile/v1'],\n      type: ['VerifiableCredential', 'Profile'],\n      issuanceDate: new Date().toISOString(),\n      credentialSubject: {\n        id: didKeyIdentifier.did,\n        name: 'Martin, the great',\n      },\n    }\n    const verifiableCredential1 = await agent.createVerifiableCredential({\n      credential,\n      proofFormat: 'jwt',\n    })\n\n    const verifiablePresentation = await agent.createVerifiablePresentation({\n      presentation: {\n        verifiableCredential: [verifiableCredential1],\n        holder: didKeyIdentifier.did,\n      },\n      challenge: 'VERAMO',\n      proofFormat: 'jwt',\n    })\n\n    expect(verifiablePresentation).toBeDefined()\n\n    const result = await agent.verifyPresentation({\n      presentation: verifiablePresentation,\n      challenge: 'VERAMO',\n    })\n\n    expect(result.verified).toBe(true)\n  })\n})\n"
  },
  {
    "path": "packages/credential-jwt/src/agent/CredentialProviderJWT.ts",
    "content": "import {\n  CredentialPayload,\n  IAgentContext,\n  ICreateVerifiableCredentialArgs,\n  ICreateVerifiablePresentationArgs,\n  IIdentifier,\n  IKey,\n  IKeyManager,\n  IssuerAgentContext,\n  IVerifyCredentialArgs,\n  IVerifyPresentationArgs,\n  IVerifyResult,\n  PROOF_FORMAT,\n  ProofFormat,\n  VerifiableCredential,\n  VerifiablePresentation,\n  VerifierAgentContext,\n} from '@veramo/core-types'\nimport {\n  asArray,\n  extractIssuer,\n  intersect,\n  isDefined,\n  MANDATORY_CREDENTIAL_CONTEXT,\n  pickSigningKey,\n  processEntryToArray,\n  removeDIDParameters,\n} from '@veramo/utils'\nimport { ICredentialProvider, ProofFormatQuery, TentativeVerificationQuery } from '@veramo/credential-w3c'\n\nimport canonicalize from 'canonicalize'\n\nimport {\n  createVerifiableCredentialJwt,\n  createVerifiablePresentationJwt,\n  normalizeCredential,\n  normalizePresentation,\n  verifyCredential as verifyCredentialJWT,\n  verifyPresentation as verifyPresentationJWT,\n} from 'did-jwt-vc'\nimport { Resolvable } from 'did-resolver'\n\nimport { decodeJWT } from 'did-jwt'\n\nimport Debug from 'debug'\n\nconst debug = Debug('veramo:credential-jwt:agent')\n\n/**\n * A Veramo Credential sub-plugin that implements\n * a {@link @veramo/credential-w3c#ICredentialProvider | ICredentialProvider} with support for\n * Verifiable Credentials and Presentations with the JWT format.\n *\n * @beta This API may change without a BREAKING CHANGE notice.\n * @see {@link https://www.w3.org/TR/vc-data-model-1.1/ | VC 1.1 data model}.\n */\nexport class CredentialProviderJWT implements ICredentialProvider {\n  /** {@inheritdoc @veramo/credential-w3c#AbstractCredentialProvider.getProofFormatsSupportedForKey} */\n  getProofFormatsSupportedForKey(key: IKey): ProofFormat[] {\n    if (this.matchKeyForJWT(key)) {\n      return [PROOF_FORMAT.JWT]\n    }\n    return []\n  }\n\n  /** {@inheritdoc @veramo/credential-w3c#ICredentialProvider.canIssueCredentialType} */\n  canIssueProofFormat(query: ProofFormatQuery): boolean {\n    return query.proofFormat === PROOF_FORMAT.JWT\n  }\n\n  /** {@inheritdoc @veramo/credential-w3c#ICredentialProvider.canVerifyDocumentType} */\n  canVerifyDocumentType(query: TentativeVerificationQuery): boolean {\n    const { document } = query\n    return (\n      typeof document === 'string' ||\n      (typeof document === 'object' && (<VerifiableCredential>document)?.proof?.jwt)\n    )\n  }\n\n  /** {@inheritdoc @veramo/credential-w3c#ICredentialProvider.createVerifiableCredential} */\n  async createVerifiableCredential(\n    args: ICreateVerifiableCredentialArgs,\n    context: IssuerAgentContext,\n  ): Promise<VerifiableCredential> {\n    let { proofFormat, keyRef, removeOriginalFields, save, now, ...otherOptions } = args\n\n    const credentialContext = processEntryToArray(\n      args?.credential?.['@context'],\n      MANDATORY_CREDENTIAL_CONTEXT,\n    )\n    const credentialType = processEntryToArray(args?.credential?.type, 'VerifiableCredential')\n    const credential: CredentialPayload = {\n      ...args?.credential,\n      '@context': credentialContext,\n      type: credentialType,\n    }\n\n    const issuer = extractIssuer(credential, { removeParameters: true })\n    if (!issuer || typeof issuer === 'undefined') {\n      throw new Error('invalid_argument: args.credential.issuer must not be empty')\n    }\n\n    let identifier: IIdentifier\n    try {\n      identifier = await context.agent.didManagerGet({ did: issuer })\n    } catch (e) {\n      throw new Error(`invalid_argument: args.credential.issuer must be a DID managed by this agent. ${e}`)\n    }\n\n    const key = pickSigningKey(identifier, keyRef)\n\n    debug('Signing VC with', identifier.did)\n    let alg = 'ES256K'\n    if (key.type === 'Ed25519') {\n      alg = 'EdDSA'\n    } else if (key.type === 'Secp256r1') {\n      alg = 'ES256'\n    }\n\n    const signer = this.wrapSigner(context, key, alg)\n    const jwt = await createVerifiableCredentialJwt(\n      credential as any,\n      { did: identifier.did, signer, alg },\n      { removeOriginalFields, ...otherOptions },\n    )\n    //FIXME: flagging this as a potential privacy leak.\n    debug(jwt)\n    return normalizeCredential(jwt)\n  }\n\n  /** {@inheritdoc @veramo/credential-w3c#ICredentialProvider.verifyCredential} */\n  async verifyCredential(args: IVerifyCredentialArgs, context: VerifierAgentContext): Promise<IVerifyResult> {\n    let { credential, policies, ...otherOptions } = args\n    let verifiedCredential: VerifiableCredential\n    let verificationResult: IVerifyResult | undefined = { verified: false }\n    let jwt: string = typeof credential === 'string' ? credential : credential.proof.jwt\n    let errorCode, message\n    const resolver = {\n      resolve: (didUrl: string) =>\n        context.agent.resolveDid({\n          didUrl,\n          options: otherOptions?.resolutionOptions,\n        }),\n    } as Resolvable\n    try {\n      // needs broader credential as well to check equivalence with jwt\n      verificationResult = await verifyCredentialJWT(jwt, resolver, {\n        ...otherOptions,\n        policies: {\n          ...policies,\n          nbf: policies?.nbf ?? policies?.issuanceDate,\n          iat: policies?.iat ?? policies?.issuanceDate,\n          exp: policies?.exp ?? policies?.expirationDate,\n          aud: policies?.aud ?? policies?.audience,\n        },\n      })\n      verifiedCredential = verificationResult.verifiableCredential\n\n      // if credential was presented with other fields, make sure those fields match what's in the JWT\n      if (typeof credential !== 'string' && credential.proof.type === 'JwtProof2020') {\n        const credentialCopy = JSON.parse(JSON.stringify(credential))\n        delete credentialCopy.proof.jwt\n\n        const verifiedCopy = JSON.parse(JSON.stringify(verifiedCredential))\n        delete verifiedCopy.proof.jwt\n\n        if (canonicalize(credentialCopy) !== canonicalize(verifiedCopy)) {\n          verificationResult.verified = false\n          verificationResult.error = new Error(\n            'invalid_credential: Credential JSON does not match JWT payload',\n          )\n        }\n      }\n    } catch (e: any) {\n      errorCode = e.errorCode\n      message = e.message\n    }\n    if (verificationResult.verified) {\n      return verificationResult\n    }\n    return {\n      verified: false,\n      error: {\n        message,\n        errorCode: errorCode ? errorCode : message?.split(':')[0],\n      },\n    }\n  }\n\n  /** {@inheritdoc @veramo/credential-w3c#ICredentialProvider.createVerifiablePresentation} */\n  async createVerifiablePresentation(\n    args: ICreateVerifiablePresentationArgs,\n    context: IssuerAgentContext,\n  ): Promise<VerifiablePresentation> {\n    let {\n      presentation,\n      proofFormat,\n      domain,\n      challenge,\n      removeOriginalFields,\n      keyRef,\n      save,\n      now,\n      ...otherOptions\n    } = args\n    const presentationContext: string[] = processEntryToArray(\n      args?.presentation?.['@context'],\n      MANDATORY_CREDENTIAL_CONTEXT,\n    )\n    const presentationType = processEntryToArray(args?.presentation?.type, 'VerifiablePresentation')\n    presentation = {\n      ...presentation,\n      '@context': presentationContext,\n      type: presentationType,\n    }\n\n    if (!isDefined(presentation.holder)) {\n      throw new Error('invalid_argument: presentation.holder must not be empty')\n    }\n\n    if (presentation.verifiableCredential) {\n      presentation.verifiableCredential = presentation.verifiableCredential.map((cred) => {\n        // map JWT credentials to their canonical form\n        if (typeof cred !== 'string' && cred.proof.jwt) {\n          return cred.proof.jwt\n        } else {\n          return cred\n        }\n      })\n    }\n\n    const holder = removeDIDParameters(presentation.holder)\n\n    let identifier: IIdentifier\n    try {\n      identifier = await context.agent.didManagerGet({ did: holder })\n    } catch (e) {\n      throw new Error('invalid_argument: presentation.holder must be a DID managed by this agent')\n    }\n    const key = pickSigningKey(identifier, keyRef)\n    // only add issuanceDate for JWT\n    now = typeof now === 'number' ? new Date(now * 1000) : now\n    if (!Object.getOwnPropertyNames(presentation).includes('issuanceDate')) {\n      presentation.issuanceDate = (now instanceof Date ? now : new Date()).toISOString()\n    }\n\n    debug('Signing VP with', identifier.did)\n    let alg = 'ES256K'\n    if (key.type === 'Ed25519') {\n      alg = 'EdDSA'\n    } else if (key.type === 'Secp256r1') {\n      alg = 'ES256'\n    }\n\n    const signer = this.wrapSigner(context, key, alg)\n    const jwt = await createVerifiablePresentationJwt(\n      presentation as any,\n      { did: identifier.did, signer, alg },\n      { removeOriginalFields, challenge, domain, ...otherOptions },\n    )\n    //FIXME: flagging this as a potential privacy leak.\n    debug(jwt)\n    return normalizePresentation(jwt)\n  }\n\n  /** {@inheritdoc @veramo/credential-w3c#ICredentialProvider.verifyPresentation} */\n  async verifyPresentation(\n    args: IVerifyPresentationArgs,\n    context: VerifierAgentContext,\n  ): Promise<IVerifyResult> {\n    let { presentation, domain, challenge, fetchRemoteContexts, policies, ...otherOptions } = args\n    let jwt: string\n    if (typeof presentation === 'string') {\n      jwt = presentation\n    } else {\n      jwt = presentation.proof.jwt\n    }\n    const resolver = {\n      resolve: (didUrl: string) =>\n        context.agent.resolveDid({\n          didUrl,\n          options: otherOptions?.resolutionOptions,\n        }),\n    } as Resolvable\n\n    let audience = domain\n    if (!audience) {\n      const { payload } = await decodeJWT(jwt)\n      if (payload.aud) {\n        // automatically add a managed DID as audience if one is found\n        const intendedAudience = asArray(payload.aud)\n        const managedDids = await context.agent.didManagerFind()\n        const filtered = managedDids.filter((identifier) => intendedAudience.includes(identifier.did))\n        if (filtered.length > 0) {\n          audience = filtered[0].did\n        }\n      }\n    }\n\n    let message, errorCode\n    try {\n      const result = await verifyPresentationJWT(jwt, resolver, {\n        challenge,\n        domain,\n        audience,\n        policies: {\n          ...policies,\n          nbf: policies?.nbf ?? policies?.issuanceDate,\n          iat: policies?.iat ?? policies?.issuanceDate,\n          exp: policies?.exp ?? policies?.expirationDate,\n          aud: policies?.aud ?? policies?.audience,\n        },\n        ...otherOptions,\n      })\n      if (result) {\n        return {\n          verified: true,\n          verifiablePresentation: result,\n        }\n      }\n    } catch (e: any) {\n      message = e.message\n      errorCode = e.errorCode\n    }\n    return {\n      verified: false,\n      error: {\n        message,\n        errorCode: errorCode ? errorCode : message?.split(':')[0],\n      },\n    }\n  }\n\n  /**\n   * Checks if a key is suitable for signing JWT payloads.\n   * @param key - the key to check\n   *\n   * @internal\n   */\n  matchKeyForJWT(key: IKey): boolean {\n    switch (key.type) {\n      case 'Ed25519':\n      case 'Secp256r1':\n        return true\n      case 'Secp256k1':\n        return intersect(key.meta?.algorithms ?? [], ['ES256K', 'ES256K-R']).length > 0\n      default:\n        return false\n    }\n  }\n\n  wrapSigner(context: IAgentContext<Pick<IKeyManager, 'keyManagerSign'>>, key: IKey, algorithm?: string) {\n    return async (data: string | Uint8Array): Promise<string> => {\n      return context.agent.keyManagerSign({ keyRef: key.kid, data: <string>data, algorithm })\n    }\n  }\n}\n"
  },
  {
    "path": "packages/credential-jwt/src/index.ts",
    "content": "export { CredentialProviderJWT } from './agent/CredentialProviderJWT.js'\n"
  },
  {
    "path": "packages/credential-jwt/tsconfig.json",
    "content": "{\n  \"extends\": \"../tsconfig.settings.json\",\n  \"compilerOptions\": {\n    \"rootDir\": \"src\",\n    \"outDir\": \"build\",\n    \"declarationDir\": \"build\",\n    // https://github.com/transmute-industries/vc.js/issues/60\n    \"skipLibCheck\": true\n  },\n  \"references\": [\n    { \"path\": \"../core-types\" },\n    { \"path\": \"../credential-w3c\" },\n    { \"path\": \"../utils\" }\n  ],\n  \"include\": [\"./**/*.ts\"]\n}\n"
  },
  {
    "path": "packages/credential-ld/CHANGELOG.md",
    "content": "# Change Log\n\nAll notable changes to this project will be documented in this file.\nSee [Conventional Commits](https://conventionalcommits.org) for commit guidelines.\n\n# [7.0.0](https://github.com/decentralized-identity/veramo/compare/v6.0.2...v7.0.0) (2026-02-11)\n\n\n### Bug Fixes\n\n* **deps:** update devdeps and bump typeorm to 0.3.20 ([#1272](https://github.com/decentralized-identity/veramo/issues/1272)) ([7d17f37](https://github.com/decentralized-identity/veramo/commit/7d17f37ea7cc4e73a8cdae028681ae1be5c4d11c))\n* **deps:** update react monorepo to v19 ([#1443](https://github.com/decentralized-identity/veramo/issues/1443)) ([3fab85f](https://github.com/decentralized-identity/veramo/commit/3fab85f5189301d29b24feea5772ec022a9a8329))\n\n\n### Features\n\n* **credential-w3c:** refactor the ICredentialProvider API ([#1488](https://github.com/decentralized-identity/veramo/issues/1488)) ([cbd848d](https://github.com/decentralized-identity/veramo/commit/cbd848d4ce2b52497d99d335f1c93bd8b005cdb2))\n* **credential-w3c:** remove hardcoded proof formats ([#1395](https://github.com/decentralized-identity/veramo/issues/1395)) ([5b7d3fa](https://github.com/decentralized-identity/veramo/commit/5b7d3fad7d2ada4954f8020a6474df13d9fe51dc))\n\n\n### BREAKING CHANGES\n\n* **credential-w3c:** This changeset, along with the previous changes in #1395 modify the CredentialPlugin to support extensibility without modifications to the veramo repository. This plugin now acts as an orchestrator for other ICredentialProvider implementations that provide the actual support for various verifiable data formats. ICredentialProvider implementations can be implemented externally and used with this plugin.\n* **credential-w3c:** The credential plugins specializing in JSON-LD / EIP712 are no longer top level veramo plugins but are now managed by the `@veramo/credential-w3c` plugin which will be able to use multiple proof formats and multiplex accordingly. The constructor for the `CredentialPlugin` has changed to accept different implementations of proof formats.\n\n\n\n\n\n## [6.0.2](https://github.com/decentralized-identity/veramo/compare/v6.0.1...v6.0.2) (2026-01-16)\n\n**Note:** Version bump only for package @veramo/credential-ld\n\n\n\n\n\n## [6.0.1](https://github.com/decentralized-identity/veramo/compare/v6.0.0...v6.0.1) (2026-01-16)\n\n**Note:** Version bump only for package @veramo/credential-ld\n\n\n\n\n\n# [6.0.0](https://github.com/decentralized-identity/veramo/compare/v5.6.0...v6.0.0) (2024-04-02)\n\n\n### Bug Fixes\n\n* **credential-ld:** let verifiers use all supported verification methods ([#1331](https://github.com/decentralized-identity/veramo/issues/1331)) ([aa95af0](https://github.com/decentralized-identity/veramo/commit/aa95af00ce755ae0022b4b17ae8c996e0b970842)), closes [#1329](https://github.com/decentralized-identity/veramo/issues/1329)\n* **credential-w3c:** forward DID resolution options to the resolver ([#1344](https://github.com/decentralized-identity/veramo/issues/1344)) ([0c22cc6](https://github.com/decentralized-identity/veramo/commit/0c22cc6a79e974214500e4440b0ea2977012377d)), closes [#1343](https://github.com/decentralized-identity/veramo/issues/1343)\n* **deps:** Update did-vc-libraries ([ba966d5](https://github.com/decentralized-identity/veramo/commit/ba966d5fe450145f51e9c9b46f8aa53f74b117d2))\n* export const plugin schemas instead of defaults ([#1327](https://github.com/decentralized-identity/veramo/issues/1327)) ([7896cea](https://github.com/decentralized-identity/veramo/commit/7896ceaf2c79993eee44e46950814bea74bfe647)), closes [#1318](https://github.com/decentralized-identity/veramo/issues/1318) [#1317](https://github.com/decentralized-identity/veramo/issues/1317) [#1315](https://github.com/decentralized-identity/veramo/issues/1315)\n\n\n### Code Refactoring\n\n* generate plugin schemas as TS instead of JSON ([#1315](https://github.com/decentralized-identity/veramo/issues/1315)) ([65c2d4b](https://github.com/decentralized-identity/veramo/commit/65c2d4bc814daa9a3a89f4f7b8e8c6973b8ce2f0)), closes [#1254](https://github.com/decentralized-identity/veramo/issues/1254)\n\n\n### Features\n\n* add Multikey support ([#1316](https://github.com/decentralized-identity/veramo/issues/1316)) ([165de35](https://github.com/decentralized-identity/veramo/commit/165de3549ccfd3d7c84514608ac3ea9e56a7b807))\n\n\n### BREAKING CHANGES\n\n* The `plugin.schema.json` files are now generated as `plugin.schema.ts`.\n\n\n\n\n\n# [5.6.0](https://github.com/decentralized-identity/veramo/compare/v5.5.3...v5.6.0) (2024-01-16)\n\n\n### Features\n\n* **remote-client:** allow dynamic headers param for AgentRestClient constructor ([#1314](https://github.com/decentralized-identity/veramo/issues/1314)) ([1b8a0a2](https://github.com/decentralized-identity/veramo/commit/1b8a0a2718dd63492ad3a312a6ebe5f6e7849935)), closes [#1313](https://github.com/decentralized-identity/veramo/issues/1313)\n\n\n\n\n\n## [5.5.3](https://github.com/decentralized-identity/veramo/compare/v5.5.2...v5.5.3) (2023-10-09)\n\n\n### Bug Fixes\n\n* use DIF URLs in packages ([#1271](https://github.com/decentralized-identity/veramo/issues/1271)) ([3dfc601](https://github.com/decentralized-identity/veramo/commit/3dfc6014cdee7902c59d8db76b4c8507b870f227))\n\n\n\n\n\n# [5.5.0](https://github.com/uport-project/veramo/compare/v5.4.1...v5.5.0) (2023-09-19)\n\n\n### Bug Fixes\n\n* **deps:** update dependency cross-fetch to v4 ([1c14d34](https://github.com/uport-project/veramo/commit/1c14d34f48a51bef373541e84ed89f2f44711406))\n* **did-provider-key:** use compressed keys for creating Secp256k1 did:key ([#1217](https://github.com/uport-project/veramo/issues/1217)) ([ba8f6f5](https://github.com/uport-project/veramo/commit/ba8f6f5b9b701e57af86491504ecd209ca0c1c1d)), closes [#1213](https://github.com/uport-project/veramo/issues/1213)\n\n\n\n\n\n## [5.4.1](https://github.com/uport-project/veramo/compare/v5.4.0...v5.4.1) (2023-08-04)\n\n\n### Bug Fixes\n\n* **ci:** benign change meant to tag all packages for another patch release ([#1211](https://github.com/uport-project/veramo/issues/1211)) ([41b5c90](https://github.com/uport-project/veramo/commit/41b5c90277171b7b38c5cf49ca01db5cf75b6300))\n* **deps:** Update did-vc-libraries to v6 ([3cadd56](https://github.com/uport-project/veramo/commit/3cadd56356a23463acc04f9a8a58239a9475b1c1))\n\n\n\n\n\n# [5.4.0](https://github.com/uport-project/veramo/compare/v5.3.0...v5.4.0) (2023-08-01)\n\n\n### Features\n\n* **credential-w3c:** allow issuers with query parameters for credentials and presentations ([#1207](https://github.com/uport-project/veramo/issues/1207)) ([688f59d](https://github.com/uport-project/veramo/commit/688f59d6b492bc25bc51bbe73be969d6c30a958d)), closes [#1201](https://github.com/uport-project/veramo/issues/1201)\n* **did-comm:** add support for the AES based content and key encryption algorithms ([#1180](https://github.com/uport-project/veramo/issues/1180)) ([5294a81](https://github.com/uport-project/veramo/commit/5294a812ee578c0712b54f216416c3ef78c848da))\n\n\n\n\n\n# [5.3.0](https://github.com/uport-project/veramo/compare/v5.2.0...v5.3.0) (2023-07-27)\n\n**Note:** Version bump only for package @veramo/credential-ld\n\n\n\n\n\n# [5.2.0](https://github.com/uport-project/veramo/compare/v5.1.4...v5.2.0) (2023-05-02)\n\n\n### Bug Fixes\n\n* **credential-ld:** external context handling with the `fetchRemoteContexts` option ([#1149](https://github.com/uport-project/veramo/issues/1149)) ([4a63f40](https://github.com/uport-project/veramo/commit/4a63f4009bea31c9111de8b5298b34b70e53fa37))\n* **credential-ld:** fix Ed25519Signature2020 verification ([#1166](https://github.com/uport-project/veramo/issues/1166)) ([c965fd5](https://github.com/uport-project/veramo/commit/c965fd502f652c9929ae4753c56ebbe351447733))\n\n\n\n\n\n## [5.1.2](https://github.com/uport-project/veramo/compare/v5.1.1...v5.1.2) (2023-02-25)\n\n**Note:** Version bump only for package @veramo/credential-ld\n\n\n\n\n\n# [5.1.0](https://github.com/uport-project/veramo/compare/v5.0.0...v5.1.0) (2023-02-24)\n\n\n### Bug Fixes\n\n* **credential-eip712:** compatibility improvements for EthereumEIP712Signature2021 ([#1131](https://github.com/uport-project/veramo/issues/1131)) ([672f92b](https://github.com/uport-project/veramo/commit/672f92b1bd3850c369cbef646c8ece8a58fafc16))\n\n\n### Features\n\n* **core-types:** allow inline [@context](https://github.com/context) for Credentials and Presentations ([#1119](https://github.com/uport-project/veramo/issues/1119)) ([44bb365](https://github.com/uport-project/veramo/commit/44bb36503b635ee1f5431cb4bf28c7a9ba111156)), closes [#1073](https://github.com/uport-project/veramo/issues/1073)\n\n\n\n\n\n# [5.0.0](https://github.com/uport-project/veramo/compare/v4.3.0...v5.0.0) (2023-02-09)\n\n\n### Build System\n\n* convert veramo modules to ESM instead of CommonJS ([#1103](https://github.com/uport-project/veramo/issues/1103)) ([b5cea3c](https://github.com/uport-project/veramo/commit/b5cea3c0d80d900a47bd1d9eea68f84b70a35e7b)), closes [#1099](https://github.com/uport-project/veramo/issues/1099)\n\n\n### Features\n\n* isolate `core-types` package from `core` ([#1116](https://github.com/uport-project/veramo/issues/1116)) ([ba7a303](https://github.com/uport-project/veramo/commit/ba7a303de91cf4cc568a3af1ddf8ca98ed022e9f))\n\n\n### BREAKING CHANGES\n\n* this is a breaking change as modules will have to be imported differently: \n* https://www.typescriptlang.org/docs/handbook/esm-node.html\n* https://nodejs.org/api/esm.html\n* https://caniuse.com/?search=modules\n\ntest(did-provider-ion): skip a couple of tests that fail with unreasonable errors\nchore: use ubuntu-latest on CI\nfix: temporarily remove puppeteer tests\nfix: use craco for test-react-app to enable babel config\ntest: fix unit and integration tests (browser tests still broken)\nfix: fix some build issues that prevented tests from working\nfix: missing deps flagged by pnpm\n\n\n\n\n\n# [4.3.0](https://github.com/uport-project/veramo/compare/v4.2.0...v4.3.0) (2023-01-27)\n\n\n### Bug Fixes\n\n* **credential-ld:** fix defaultContexts file extensions ([#1086](https://github.com/uport-project/veramo/issues/1086)) ([2f57cb1](https://github.com/uport-project/veramo/commit/2f57cb1bef265a5930ceaeff6a8e9af987c3958e))\n\n\n\n\n\n# [4.2.0](https://github.com/uport-project/veramo/compare/v4.1.2...v4.2.0) (2022-12-05)\n\n\n### Bug Fixes\n\n* **credential-ld:** simplify signature suite use of Uint8Array ([49a10ec](https://github.com/uport-project/veramo/commit/49a10ecc29d56118ac09c5df73fed885fe6988c1))\n* **deps:** bump dependencies ([701b8ed](https://github.com/uport-project/veramo/commit/701b8edf981ea11c7ddb6a81d2817dbbdbb022f3))\n* **deps:** Update dependency @digitalcredentials/vc to v5 ([1bdc802](https://github.com/uport-project/veramo/commit/1bdc80240578aff13240dfe45b9a12b0720d1d4d))\n\n\n### Features\n\n* **credential-ld:** add `Ed25519Signature2020` & `JsonWebSignature2020` experimental support ([#1030](https://github.com/uport-project/veramo/issues/1030)) ([fbf7d48](https://github.com/uport-project/veramo/commit/fbf7d483c3549ec45df84472824395903128d66e)), closes [#1003](https://github.com/uport-project/veramo/issues/1003)\n* **did-provider-pkh:** implement did:pkh support. ([#1052](https://github.com/uport-project/veramo/issues/1052)) ([5ad0bfb](https://github.com/uport-project/veramo/commit/5ad0bfb713dca8fd24b99ddf053335340a39e7b3)), closes [#1024](https://github.com/uport-project/veramo/issues/1024)\n\n\n\n\n\n## [4.1.1](https://github.com/uport-project/veramo/compare/v4.1.0...v4.1.1) (2022-11-01)\n\n**Note:** Version bump only for package @veramo/credential-ld\n\n\n\n\n\n# [4.1.0](https://github.com/uport-project/veramo/compare/v4.0.2...v4.1.0) (2022-10-31)\n\n\n### Bug Fixes\n\n* **deps:** Update dependency ethr-did-resolver to v7 ([#1038](https://github.com/uport-project/veramo/issues/1038)) ([d421c0f](https://github.com/uport-project/veramo/commit/d421c0f9f5934829df2930e58e98bcfce813ce84))\n\n\n\n\n\n## [4.0.2](https://github.com/uport-project/veramo/compare/v4.0.1...v4.0.2) (2022-10-04)\n\n**Note:** Version bump only for package @veramo/credential-ld\n\n\n\n\n\n# [4.0.0](https://github.com/uport-project/veramo/compare/v3.1.5...v4.0.0) (2022-09-22)\n\n\n### Bug Fixes\n\n* **credential-ld:** fix EcdsaSecp256k1RecoverySignature2020 suite context ([#909](https://github.com/uport-project/veramo/issues/909)) ([48fbee3](https://github.com/uport-project/veramo/commit/48fbee3e62eab3df4225ae0bdb3a92f5665eb171))\n* **credential-ld:** include credential context and fix context loader Map ([ef7797d](https://github.com/uport-project/veramo/commit/ef7797d4c5f20b22e4e39a5ad60a851fa1c4f2ed))\n* **credential-ld:** include LDDefaultContexts in npm bundle ([3e2cf29](https://github.com/uport-project/veramo/commit/3e2cf29ecc7aecf0a3750beec7490306ceb79dab))\n* **credential-ld:** remove fs dependency for JSON LD default contexts ([#868](https://github.com/uport-project/veramo/issues/868)) ([2f75935](https://github.com/uport-project/veramo/commit/2f75935f049e4545ba77b0038c74668147e5e6de)), closes [#837](https://github.com/uport-project/veramo/issues/837)\n* **credential-status:** check credential status for all credential types ([#949](https://github.com/uport-project/veramo/issues/949)) ([877c513](https://github.com/uport-project/veramo/commit/877c513a5bc253ed30c74ace00ce988197d12a2d)), closes [#934](https://github.com/uport-project/veramo/issues/934)\n* **deps:** replace @transmute/lds-ecdsa-secp256k1-recovery2020 with fork ([#953](https://github.com/uport-project/veramo/issues/953)) ([573a0ef](https://github.com/uport-project/veramo/commit/573a0efe8d28653bd0389e401c25a2dd9c361a96)), closes [#952](https://github.com/uport-project/veramo/issues/952)\n* **deps:** Update dependency @digitalcredentials/vc to v4 ([9ea90d3](https://github.com/uport-project/veramo/commit/9ea90d38137631d186c042de1fcf855be50f2144))\n* **deps:** update did-libraries ([219cde2](https://github.com/uport-project/veramo/commit/219cde250e8d4f06d7978afcc38a04471342fd21))\n* **deps:** use did-jwt v6 and ethr-did-resolver v6 ([#925](https://github.com/uport-project/veramo/issues/925)) ([0c77d03](https://github.com/uport-project/veramo/commit/0c77d03ec5ec9e2091de3f74f67ab86a22cde197)), closes [#923](https://github.com/uport-project/veramo/issues/923) [#848](https://github.com/uport-project/veramo/issues/848)\n* **did-resolver:** use interface `Resolvable` instead of the `Resolver` class ([9c2e59f](https://github.com/uport-project/veramo/commit/9c2e59f3f23f808511c6c0e8e440b4d53ba5cb00))\n* **docs:** fix relevant errors and warnings in TSDoc to enable proper docs generation on `[@next](https://github.com/next)` branch ([79c3872](https://github.com/uport-project/veramo/commit/79c387230219c92c1951d19b8ddf716308a46c5b))\n* update and fix inline documentation of all exported types ([#921](https://github.com/uport-project/veramo/issues/921)) ([63e64e0](https://github.com/uport-project/veramo/commit/63e64e0e2693808c4704dca8cc511dc0bab3f3b1))\n\n\n### Features\n\n* add support for serviceEndpoint property as defined in latest DID Spec ([#988](https://github.com/uport-project/veramo/issues/988)) ([9bed70b](https://github.com/uport-project/veramo/commit/9bed70ba658aed34a97944e0dee27bca6c81d700))\n* **credential-ld:** add option to fetch remote contexts ([60226a1](https://github.com/uport-project/veramo/commit/60226a1a64d7f06e3869ff0087f4773376b4160e))\n* **credential-ld:** add support for browser environments ([#916](https://github.com/uport-project/veramo/issues/916)) ([435e4d2](https://github.com/uport-project/veramo/commit/435e4d260b1774f96b182c1a75ab2f1c993f2291))\n* **credential-status:** add credential status check plugin for Veramo ([#874](https://github.com/uport-project/veramo/issues/874)) ([cf62dfe](https://github.com/uport-project/veramo/commit/cf62dfe21ebc76bc95e98fc55bfe1113e80c138b))\n* **credential-status:** expect revoked boolean property from StatusMethods ([e00daa4](https://github.com/uport-project/veramo/commit/e00daa47865ea42d7bd8667f37c6e12fc21fd4b9))\n* **credential-w3c:** add ICredentialPlugin interface in core package ([#1001](https://github.com/uport-project/veramo/issues/1001)) ([7b6d195](https://github.com/uport-project/veramo/commit/7b6d1950364c8b741dd958d29e506b95fa5b1cec)), closes [#941](https://github.com/uport-project/veramo/issues/941)\n* **credential-w3c:** align verification API between formats ([#996](https://github.com/uport-project/veramo/issues/996)) ([b987fc0](https://github.com/uport-project/veramo/commit/b987fc0903a31d3bbffb43fef872be4d6c62c2ad)), closes [#935](https://github.com/uport-project/veramo/issues/935) [#954](https://github.com/uport-project/veramo/issues/954) [#375](https://github.com/uport-project/veramo/issues/375) [#989](https://github.com/uport-project/veramo/issues/989)\n* **date-store-json:** add JSON object storage implementation ([#819](https://github.com/uport-project/veramo/issues/819)) ([934b34a](https://github.com/uport-project/veramo/commit/934b34a18b194928f90e7797289cc6f2243789ec))\n* **did-provider-ethr:** use multiple networks per EthrDIDProvider ([#969](https://github.com/uport-project/veramo/issues/969)) ([0a88058](https://github.com/uport-project/veramo/commit/0a88058a5efddfe09f9f35510cc1bbc21149bf18)), closes [#968](https://github.com/uport-project/veramo/issues/968) [#893](https://github.com/uport-project/veramo/issues/893)\n\n\n### BREAKING CHANGES\n\n* the `did-resolver` and connected libraries change the data-type for `ServiceEndpoint` to `Service` and the previous semantic has changed. Services can have multiple endpoints, not just a single string.\n\n\n\n\n\n# [3.1.0](https://github.com/uport-project/veramo/compare/v3.0.0...v3.1.0) (2021-11-12)\n\n\n### Bug Fixes\n\n* **deps:** update did-libraries ([0ea73fc](https://github.com/uport-project/veramo/commit/0ea73fc1dba02c3d4c4df5befef265f7f573b2d1))\n* **deps:** update did-libraries ([417dc5d](https://github.com/uport-project/veramo/commit/417dc5dd157ee259b6f89f4987f1ecca444fb1d4))\n\n\n\n\n\n# [3.0.0](https://github.com/uport-project/veramo/compare/v2.1.3...v3.0.0) (2021-09-20)\n\n\n### Bug Fixes\n\n* **deps:** update all non-major dependencies ([8fc5312](https://github.com/uport-project/veramo/commit/8fc53120498ce2982e8ec640e00bbb03f6f4204e))\n\n\n\n\n\n# [2.1.0](https://github.com/uport-project/veramo/compare/v2.0.1...v2.1.0) (2021-08-11)\n\n\n### Bug Fixes\n\n* **credentials-w3c:** accept Presentations without Credentials ([#616](https://github.com/uport-project/veramo/issues/616)) ([2389cd0](https://github.com/uport-project/veramo/commit/2389cd0df080e968ee320d66fabf2e8a7b51ba47))\n\n\n\n\n\n# [2.0.0](https://github.com/uport-project/veramo/compare/v1.2.2...v2.0.0) (2021-07-14)\n\n\n### Bug Fixes\n\n* **credential-w3c:** fixed handling of Ed25519 keys when creating VPs ([#534](https://github.com/uport-project/veramo/issues/534))([#516](https://github.com/uport-project/veramo/issues/516)) ([988c76c](https://github.com/uport-project/veramo/commit/988c76c46d391f3b76499ff141bdefe21e729c4a))\n* **deps:** bump did-jwt to 5.4.0 ([#528](https://github.com/uport-project/veramo/issues/528)) ([65f22cf](https://github.com/uport-project/veramo/commit/65f22cf6dcca48b5bb35331894536a2a567a1189))\n\n\n### Features\n\n* implement didcomm v2 packing/unpacking ([#575](https://github.com/uport-project/veramo/issues/575)) ([249b07e](https://github.com/uport-project/veramo/commit/249b07eca8d2de9eb5252d71683d5f1fba319d60)), closes [#559](https://github.com/uport-project/veramo/issues/559) [#558](https://github.com/uport-project/veramo/issues/558)\n* **key-manager:** add generic signing capabilities ([#529](https://github.com/uport-project/veramo/issues/529)) ([5f10a1b](https://github.com/uport-project/veramo/commit/5f10a1bcea214cb593de12fa6ec3a91b3cb712bb)), closes [#522](https://github.com/uport-project/veramo/issues/522)\n\n\n\n\n\n# [1.2.0](https://github.com/uport-project/veramo/compare/v1.1.2...v1.2.0) (2021-04-27)\n\n\n### Features\n\n* adapt to did core spec ([#430](https://github.com/uport-project/veramo/issues/430)) ([9712db0](https://github.com/uport-project/veramo/commit/9712db0eea1a3f48cf0665d66ae715ea0c23cd4a)), closes [#418](https://github.com/uport-project/veramo/issues/418) [#428](https://github.com/uport-project/veramo/issues/428) [#417](https://github.com/uport-project/veramo/issues/417) [#416](https://github.com/uport-project/veramo/issues/416) [#412](https://github.com/uport-project/veramo/issues/412) [#397](https://github.com/uport-project/veramo/issues/397) [#384](https://github.com/uport-project/veramo/issues/384) [#394](https://github.com/uport-project/veramo/issues/394)\n* add option to keep payload fields when creating JWT VC/VP ([#431](https://github.com/uport-project/veramo/issues/431)) ([43923e1](https://github.com/uport-project/veramo/commit/43923e18b8e0b68c4552489d568ab16748156970)), closes [#394](https://github.com/uport-project/veramo/issues/394)\n* **did-provider-key:** add did:key provider; fixes [#335](https://github.com/uport-project/veramo/issues/335) ([#351](https://github.com/uport-project/veramo/issues/351)) ([42cd2b0](https://github.com/uport-project/veramo/commit/42cd2b08a2fd21b5b5d7bdfa57dd00ccc7184dc7)), closes [decentralized-identity/did-jwt#78](https://github.com/decentralized-identity/did-jwt/issues/78)\n\n\n\n\n\n# [1.1.0](https://github.com/uport-project/veramo/compare/v1.0.1...v1.1.0) (2021-01-26)\n\n**Note:** Version bump only for package @veramo/credential-w3c\n\n\n\n\n\n## 1.0.1 (2020-12-18)\n\n**Note:** Version bump only for package @veramo/credential-w3c\n"
  },
  {
    "path": "packages/credential-ld/LICENSE",
    "content": "                                 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 2019 Consensys AG\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"
  },
  {
    "path": "packages/credential-ld/README.md",
    "content": "# Veramo JSON-LD credentials plugin \n\nVeramo package for working with W3C JSON-LD Verifiable Credentials & Presentations.\n\nThis package contains a plugin and a message handler for issuing and verifying Credentials\nand Presentations that adhere to W3C standards.\n"
  },
  {
    "path": "packages/credential-ld/api-extractor.json",
    "content": "{\n  \"$schema\": \"https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json\",\n  \"apiReport\": {\n    \"enabled\": true,\n    \"reportFolder\": \"./api\",\n    \"reportTempFolder\": \"./api\"\n  },\n\n  \"docModel\": {\n    \"enabled\": true,\n    \"apiJsonFilePath\": \"./api/<unscopedPackageName>.api.json\"\n  },\n\n  \"dtsRollup\": {\n    \"enabled\": false\n  },\n  \"mainEntryPointFilePath\": \"<projectFolder>/build/index.d.ts\"\n}\n"
  },
  {
    "path": "packages/credential-ld/package.json",
    "content": "{\n  \"name\": \"@veramo/credential-ld\",\n  \"description\": \"Veramo plugin for working with W3C JSON-LD Verifiable Credentials & Presentations.\",\n  \"version\": \"7.0.0\",\n  \"main\": \"build/index.js\",\n  \"exports\": {\n    \".\": \"./build/index.js\"\n  },\n  \"types\": \"build/index.d.ts\",\n  \"scripts\": {\n    \"build\": \"tsc\",\n    \"extract-api\": \"node ../cli/bin/veramo.js dev extract-api\"\n  },\n  \"dependencies\": {\n    \"@digitalcredentials/ed25519-signature-2020\": \"^4.0.0\",\n    \"@digitalcredentials/ed25519-verification-key-2020\": \"^4.0.0\",\n    \"@digitalcredentials/jsonld\": \"^6.0.0\",\n    \"@digitalcredentials/jsonld-signatures\": \"^10.0.0\",\n    \"@digitalcredentials/vc\": \"^7.0.0\",\n    \"@transmute/credentials-context\": \"^0.7.0-unstable.81\",\n    \"@transmute/ed25519-signature-2018\": \"^0.7.0-unstable.81\",\n    \"@transmute/json-web-signature\": \"^0.7.0-unstable.81\",\n    \"@veramo-community/lds-ecdsa-secp256k1-recovery2020\": \"uport-project/EcdsaSecp256k1RecoverySignature2020\",\n    \"@veramo/core-types\": \"workspace:^\",\n    \"@veramo/credential-w3c\": \"workspace:^\",\n    \"@veramo/utils\": \"workspace:^\",\n    \"cross-fetch\": \"^4.0.0\",\n    \"debug\": \"^4.3.3\",\n    \"did-resolver\": \"^4.1.0\"\n  },\n  \"resolutions\": {\n    \"@types/react\": \"19.0.8\",\n    \"jsonld\": \"npm:@digitalcredentials/jsonld@^6.0.0\"\n  },\n  \"devDependencies\": {\n    \"@types/debug\": \"4.1.8\",\n    \"borc\": \"3.0.0\",\n    \"typescript\": \"5.7.3\"\n  },\n  \"files\": [\n    \"build/**/*\",\n    \"src/**/*\",\n    \"contexts/**/*.json\",\n    \"README.md\",\n    \"LICENSE\"\n  ],\n  \"publishConfig\": {\n    \"access\": \"public\"\n  },\n  \"repository\": {\n    \"type\": \"git\",\n    \"url\": \"https://github.com/decentralized-identity/veramo.git\",\n    \"directory\": \"packages/credential-ld\"\n  },\n  \"author\": \"Consensys Mesh R&D <hello@veramo.io>\",\n  \"contributors\": [\n    \"Mircea Nistor <mircea.nistor@mesh.xyz>\",\n    \"Simonas Karuzas <simonas.karuzas@mesh.xyz>\",\n    \"Nick Reynolds <nick.reynolds@mesh.xyz>\"\n  ],\n  \"keywords\": [\n    \"Veramo\",\n    \"DID\",\n    \"Verifiable Credential\",\n    \"JSON-LD\",\n    \"Data Integrity\",\n    \"EcdsaSecp256k1RecoverySignature2020\",\n    \"Ed25519Signature2018\",\n    \"Ed25519Signature2020\",\n    \"JsonWebSignature2020\",\n    \"vc-ld-json\",\n    \"veramo-plugin\"\n  ],\n  \"license\": \"Apache-2.0\",\n  \"type\": \"module\",\n  \"moduleDirectories\": [\n    \"node_modules\",\n    \"src\"\n  ]\n}\n"
  },
  {
    "path": "packages/credential-ld/src/CredentialProviderLD.ts",
    "content": "import {\n  CredentialPayload,\n  IAgentContext,\n  ICreateVerifiableCredentialArgs,\n  ICreateVerifiablePresentationArgs,\n  IIdentifier,\n  IKey,\n  IResolver,\n  IssuerAgentContext,\n  IVerifyCredentialArgs,\n  IVerifyPresentationArgs,\n  IVerifyResult,\n  PresentationPayload,\n  PROOF_FORMAT,\n  ProofFormat,\n  VerifiableCredential,\n  VerifiablePresentation,\n  VerifierAgentContext,\n} from '@veramo/core-types'\nimport { VeramoLdSignature } from './index.js'\nimport Debug from 'debug'\nimport { LdContextLoader } from './ld-context-loader.js'\nimport {\n  _ExtendedIKey,\n  extractIssuer,\n  intersect,\n  isDefined,\n  MANDATORY_CREDENTIAL_CONTEXT,\n  mapIdentifierKeysToDoc,\n  OrPromise,\n  processEntryToArray,\n  RecordLike,\n  removeDIDParameters,\n} from '@veramo/utils'\n\nimport { LdCredentialModule } from './ld-credential-module.js'\nimport { LdSuiteLoader } from './ld-suite-loader.js'\nimport { ContextDoc } from './types.js'\nimport { DIDResolutionOptions } from 'did-resolver'\n\nimport { ICredentialProvider, ProofFormatQuery, TentativeVerificationQuery } from '@veramo/credential-w3c'\n\nconst debug = Debug('veramo:credential-ld:action-handler')\n\n/**\n * A Veramo Credential sub-plugin that implements\n * a {@link @veramo/credential-w3c#ICredentialProvider | ICredentialProvider} with support for\n * Verifiable Credentials and Presentations using JSON-LD proofs.\n *\n * @beta This API may change without a BREAKING CHANGE notice.\n * @see {@link https://www.w3.org/TR/vc-data-model-1.1/ | VC 1.1 data model}.\n */\nexport class CredentialProviderLD implements ICredentialProvider {\n  private ldCredentialModule: LdCredentialModule\n\n  constructor(options: { contextMaps: RecordLike<OrPromise<ContextDoc>>[]; suites: VeramoLdSignature[] }) {\n    this.ldCredentialModule = new LdCredentialModule({\n      ldContextLoader: new LdContextLoader({ contextsPaths: options.contextMaps }),\n      ldSuiteLoader: new LdSuiteLoader({ veramoLdSignatures: options.suites }),\n    })\n  }\n\n  /** {@inheritdoc @veramo/credential-w3c#ICredentialProvider.getProofFormatsSupportedForKey} */\n  getProofFormatsSupportedForKey(key: IKey): ProofFormat[] {\n    if (this.matchKeyForLDSuite(key)) {\n      return [PROOF_FORMAT.LD_SIGNATURE]\n    }\n    return []\n  }\n\n  /** {@inheritdoc @veramo/credential-w3c#ICredentialProvider.canIssueCredentialType} */\n  canIssueProofFormat(query: ProofFormatQuery): boolean {\n    return query.proofFormat === PROOF_FORMAT.LD_SIGNATURE\n  }\n\n  /** {@inheritdoc @veramo/credential-w3c#ICredentialProvider.canVerifyDocumentType} */\n  canVerifyDocumentType(query: TentativeVerificationQuery): boolean {\n    const { document } = query\n\n    for (const suite of this.ldCredentialModule.ldSuiteLoader.getAllSignatureSuites()) {\n      if (suite.getSupportedProofType() === (<VerifiableCredential>document)?.proof?.type || '') {\n        return true\n      }\n    }\n\n    return false\n  }\n\n  /** {@inheritdoc @veramo/credential-w3c#ICredentialProvider.createVerifiablePresentation} */\n  async createVerifiablePresentation(\n    args: ICreateVerifiablePresentationArgs,\n    context: IssuerAgentContext,\n  ): Promise<VerifiablePresentation> {\n    const presentationContext = processEntryToArray(\n      args?.presentation?.['@context'],\n      MANDATORY_CREDENTIAL_CONTEXT,\n    )\n    const presentationType = processEntryToArray(args?.presentation?.type, 'VerifiablePresentation')\n\n    const presentation: PresentationPayload = {\n      ...args?.presentation,\n      '@context': presentationContext,\n      type: presentationType,\n    }\n\n    if (!isDefined(presentation.holder)) {\n      throw new Error('invalid_argument: args.presentation.holder must not be empty')\n    }\n\n    if (args.presentation.verifiableCredential) {\n      presentation.verifiableCredential = args.presentation.verifiableCredential.map((cred) => {\n        if (typeof cred !== 'string' && cred.proof.jwt) {\n          return cred.proof.jwt\n        } else {\n          return cred\n        }\n      })\n    }\n\n    //issuanceDate must not be present for presentations because it is not defined in a @context\n    delete presentation.issuanceDate\n\n    const holder = removeDIDParameters(presentation.holder)\n\n    let identifier: IIdentifier\n    try {\n      identifier = await context.agent.didManagerGet({ did: holder })\n    } catch (e) {\n      throw new Error('invalid_argument: args.presentation.holder must be a DID managed by this agent')\n    }\n    try {\n      const { signingKey, verificationMethodId } = await this.findSigningKeyWithId(\n        context,\n        identifier,\n        args.keyRef,\n        args.resolutionOptions,\n      )\n\n      let { now } = args\n      if (typeof now === 'number') {\n        now = new Date(now * 1000)\n      }\n\n      return await this.ldCredentialModule.signLDVerifiablePresentation(\n        presentation,\n        identifier.did,\n        signingKey,\n        verificationMethodId,\n        args.challenge || '',\n        args.domain || '',\n        { ...args, now },\n        context,\n      )\n    } catch (error) {\n      debug(error)\n      return Promise.reject(error)\n    }\n  }\n\n  /** {@inheritdoc @veramo/credential-w3c#ICredentialProvider.createVerifiableCredential} */\n  async createVerifiableCredential(\n    args: ICreateVerifiableCredentialArgs,\n    context: IssuerAgentContext,\n  ): Promise<VerifiableCredential> {\n    const credentialContext = processEntryToArray(\n      args?.credential?.['@context'],\n      MANDATORY_CREDENTIAL_CONTEXT,\n    )\n    const credentialType = processEntryToArray(args?.credential?.type, 'VerifiableCredential')\n    const credential: CredentialPayload = {\n      ...args?.credential,\n      '@context': credentialContext,\n      type: credentialType,\n    }\n\n    const issuer = extractIssuer(credential, { removeParameters: true })\n    if (!issuer || typeof issuer === 'undefined') {\n      throw new Error('invalid_argument: args.credential.issuer must not be empty')\n    }\n\n    let identifier: IIdentifier\n    try {\n      identifier = await context.agent.didManagerGet({ did: issuer })\n    } catch (e) {\n      throw new Error(`invalid_argument: args.credential.issuer must be a DID managed by this agent. ${e}`)\n    }\n    try {\n      const { signingKey, verificationMethodId } = await this.findSigningKeyWithId(\n        context,\n        identifier,\n        args.keyRef,\n        args.resolutionOptions,\n      )\n\n      let { now } = args\n      if (typeof now === 'number') {\n        now = new Date(now * 1000)\n      }\n\n      return await this.ldCredentialModule.issueLDVerifiableCredential(\n        credential,\n        identifier.did,\n        signingKey,\n        verificationMethodId,\n        { ...args, now },\n        context,\n      )\n    } catch (error) {\n      debug(error)\n      return Promise.reject(error)\n    }\n  }\n\n  /** {@inheritdoc @veramo/credential-w3c#ICredentialProvider.verifyCredential} */\n  async verifyCredential(args: IVerifyCredentialArgs, context: VerifierAgentContext): Promise<IVerifyResult> {\n    args.credential = args.credential as VerifiableCredential\n    const credential = args.credential\n\n    let now = new Date()\n\n    if (args.policies?.now && typeof args.policies?.now === 'number') {\n      now = new Date(args.policies?.now * 1000)\n    }\n\n    return this.ldCredentialModule.verifyCredential(credential, { ...args, now }, context)\n  }\n\n  /** {@inheritdoc @veramo/credential-w3c#ICredentialProvider.verifyPresentation} */\n  async verifyPresentation(\n    args: IVerifyPresentationArgs,\n    context: VerifierAgentContext,\n  ): Promise<IVerifyResult> {\n    const presentation = args.presentation as VerifiablePresentation\n    let { now } = args\n    if (typeof now === 'number') {\n      now = new Date(now * 1000)\n    }\n    return this.ldCredentialModule.verifyPresentation(\n      presentation,\n      args.challenge,\n      args.domain,\n      { ...args, now },\n      context,\n    )\n  }\n\n  /**\n   * Returns true if the key is supported by any of the installed LD Signature suites\n   * @param k - the key to match\n   *\n   * @internal\n   */\n  private matchKeyForLDSuite(k: IKey): boolean {\n    // prefilter based on key algorithms\n    switch (k.type) {\n      case 'Ed25519':\n        if (!k.meta?.algorithms?.includes('EdDSA')) return false\n        break\n      case 'Secp256k1':\n        if (intersect(k.meta?.algorithms ?? [], ['ES256K-R', 'ES256K']).length == 0) return false\n        break\n    }\n\n    // TODO: this should return a list of supported suites, not just a boolean\n    const suites = this.ldCredentialModule.ldSuiteLoader.getAllSignatureSuites()\n    return suites\n      .map((suite: VeramoLdSignature) => suite.getSupportedVeramoKeyType().includes(k.type))\n      .some((supportsThisKey: boolean) => supportsThisKey)\n  }\n\n  private async findSigningKeyWithId(\n    context: IAgentContext<IResolver>,\n    identifier: IIdentifier,\n    keyRef?: string,\n    resolutionOptions?: DIDResolutionOptions,\n  ): Promise<{ signingKey: _ExtendedIKey; verificationMethodId: string }> {\n    const extendedKeys: _ExtendedIKey[] = await mapIdentifierKeysToDoc(\n      identifier,\n      'assertionMethod',\n      context,\n      resolutionOptions,\n    )\n    let supportedTypes = this.ldCredentialModule.ldSuiteLoader.getAllSignatureSuiteTypes()\n    let signingKey: _ExtendedIKey | undefined\n    let verificationMethodId: string\n    if (keyRef) {\n      signingKey = extendedKeys.find((k) => k.kid === keyRef)\n    }\n    if (signingKey && !supportedTypes.includes(signingKey.meta.verificationMethod.type)) {\n      debug(\n        'WARNING: requested signing key DOES NOT correspond to a supported Signature suite type. Looking for the next best key.',\n      )\n      signingKey = undefined\n    }\n    if (!signingKey) {\n      if (keyRef) {\n        debug(\n          'WARNING: no signing key was found that matches the reference provided. Searching for the first available signing key.',\n        )\n      }\n      signingKey = extendedKeys.find((k) => supportedTypes.includes(k.meta.verificationMethod.type))\n    }\n\n    if (!signingKey) throw Error(`key_not_found: No suitable signing key found for ${identifier.did}`)\n    verificationMethodId = signingKey.meta.verificationMethod.id\n    return { signingKey, verificationMethodId }\n  }\n}\n"
  },
  {
    "path": "packages/credential-ld/src/__tests__/context.loader.test.ts",
    "content": "import { ContextDoc } from '../types.js'\nimport { LdContextLoader } from '../ld-context-loader.js'\nimport { LdDefaultContexts } from '../ld-default-contexts.js'\n\ndescribe('credential-ld context loader', () => {\n  const customContext: Record<string, ContextDoc> = {\n    'https://example.com/custom/context': {\n      '@context': {\n        '@version': 1.1,\n        id: '@id',\n        type: '@type',\n        nothing: 'https://example.com/nothing',\n      },\n    },\n  }\n\n  it('loads custom context from record', async () => {\n    expect.assertions(2)\n    const loader = new LdContextLoader({ contextsPaths: [customContext] })\n    expect(loader.has('https://example.com/custom/context')).toBe(true)\n    await expect(loader.get('https://example.com/custom/context')).resolves.toEqual({\n      '@context': {\n        '@version': 1.1,\n        id: '@id',\n        type: '@type',\n        nothing: 'https://example.com/nothing',\n      },\n    })\n  })\n\n  it('loads context from default map', async () => {\n    expect.assertions(2)\n    const loader = new LdContextLoader({ contextsPaths: [LdDefaultContexts] })\n    expect(loader.has('https://www.w3.org/2018/credentials/v1')).toBe(true)\n\n    const credsContext = await loader.get('https://www.w3.org/2018/credentials/v1')\n    expect(credsContext['@context']).toBeDefined()\n  })\n})\n"
  },
  {
    "path": "packages/credential-ld/src/__tests__/issue-verify-ed25519-2020.test.ts",
    "content": "import {\n  createAgent,\n  CredentialPayload,\n  ICredentialPlugin,\n  IDIDManager,\n  IIdentifier,\n  IKeyManager,\n  IResolver,\n  TAgent,\n} from '../../../core/src'\nimport { CredentialPlugin } from '../../../credential-w3c/src'\nimport { DIDManager, MemoryDIDStore } from '../../../did-manager/src'\nimport { KeyManager, MemoryKeyStore, MemoryPrivateKeyStore } from '../../../key-manager/src'\nimport { KeyManagementSystem } from '../../../kms-local/src'\nimport { DIDResolverPlugin } from '../../../did-resolver/src'\nimport { ContextDoc } from '../types'\nimport { CredentialProviderLD } from '../CredentialProviderLD'\nimport { LdDefaultContexts } from '../ld-default-contexts'\nimport { VeramoEd25519Signature2020 } from '../suites/Ed25519Signature2020'\nimport { Resolver } from 'did-resolver'\nimport { FakeDidProvider, FakeDidResolver } from '../../../test-utils/src/fake-did'\nimport { jest } from '@jest/globals'\n\njest.setTimeout(300000)\n\nconst customContext: Record<string, ContextDoc> = {\n  'custom:example.context': {\n    '@context': {\n      nothing: 'custom:example.context#blank',\n    },\n  },\n}\n\ndescribe('credential-LD full flow', () => {\n  let didFakeIdentifier: IIdentifier\n  let agent: TAgent<IResolver & IKeyManager & IDIDManager & ICredentialPlugin>\n\n  beforeAll(async () => {\n    const ld = new CredentialProviderLD({\n      contextMaps: [LdDefaultContexts, customContext],\n      suites: [new VeramoEd25519Signature2020()],\n    })\n    agent = createAgent<IResolver & IKeyManager & IDIDManager & ICredentialPlugin>({\n      plugins: [\n        new KeyManager({\n          store: new MemoryKeyStore(),\n          kms: {\n            local: new KeyManagementSystem(new MemoryPrivateKeyStore()),\n          },\n        }),\n        new DIDManager({\n          providers: {\n            'did:fake': new FakeDidProvider(),\n          },\n          store: new MemoryDIDStore(),\n          defaultProvider: 'did:fake',\n        }),\n        new DIDResolverPlugin({\n          resolver: new Resolver({\n            ...new FakeDidResolver(() => agent, true).getDidFakeResolver(),\n          }),\n        }),\n        new CredentialPlugin([ld]),\n      ],\n    })\n    didFakeIdentifier = await agent.didManagerImport({\n      did: 'did:fake:z6MkgbqNU4uF9NKSz5BqJQ4XKVHuQZYcUZP8pXGsJC8nTHwo',\n      keys: [\n        {\n          type: 'Ed25519',\n          kid: 'didcomm-senderKey-1',\n          publicKeyHex: '1fe9b397c196ab33549041b29cf93be29b9f2bdd27322f05844112fad97ff92a',\n          privateKeyHex:\n            'b57103882f7c66512dc96777cbafbeb2d48eca1e7a867f5a17a84e9a6740f7dc1fe9b397c196ab33549041b29cf93be29b9f2bdd27322f05844112fad97ff92a',\n          kms: 'local',\n        },\n      ],\n      services: [\n        {\n          id: 'msg1',\n          type: 'DIDCommMessaging',\n          serviceEndpoint: 'http://localhost:3002/messaging',\n        },\n      ],\n      provider: 'did:fake',\n      alias: 'sender',\n    })\n  })\n\n  it('works with Ed25519Signature2020 credential', async () => {\n    const credential: CredentialPayload = {\n      issuer: didFakeIdentifier.did,\n      '@context': ['custom:example.context'],\n      credentialSubject: {\n        nothing: 'else matters',\n      },\n    }\n    const verifiableCredential = await agent.createVerifiableCredential({\n      credential,\n      proofFormat: 'lds',\n    })\n\n    expect(verifiableCredential).toBeDefined()\n\n    const result = await agent.verifyCredential({\n      credential: verifiableCredential,\n    })\n\n    expect(result.verified).toBe(true)\n  })\n\n  it('works with Ed25519Signature2020 credential and presentation', async () => {\n    const credential: CredentialPayload = {\n      issuer: didFakeIdentifier.did,\n      '@context': ['custom:example.context'],\n      credentialSubject: {\n        nothing: 'else matters',\n      },\n    }\n    const verifiableCredential1 = await agent.createVerifiableCredential({\n      credential,\n      proofFormat: 'lds',\n    })\n\n    const verifiablePresentation = await agent.createVerifiablePresentation({\n      presentation: {\n        verifiableCredential: [verifiableCredential1],\n        holder: didFakeIdentifier.did,\n      },\n      challenge: 'VERAMO',\n      proofFormat: 'lds',\n    })\n\n    expect(verifiablePresentation).toBeDefined()\n\n    const result = await agent.verifyPresentation({\n      presentation: verifiablePresentation,\n      challenge: 'VERAMO',\n    })\n\n    expect(result.verified).toBe(true)\n  })\n})\n"
  },
  {
    "path": "packages/credential-ld/src/__tests__/issue-verify-flow-ld.test.ts",
    "content": "import {\n  CredentialPayload,\n  ICredentialPlugin,\n  IDIDManager,\n  IIdentifier,\n  IKeyManager,\n  IResolver,\n  TAgent,\n} from '../../../core-types/src'\nimport { createAgent } from '../../../core/src'\nimport { CredentialPlugin } from '../../../credential-w3c/src'\nimport { DIDManager, MemoryDIDStore } from '../../../did-manager/src'\nimport { KeyManager, MemoryKeyStore, MemoryPrivateKeyStore } from '../../../key-manager/src'\nimport { KeyManagementSystem } from '../../../kms-local/src'\nimport { getDidKeyResolver, KeyDIDProvider } from '../../../did-provider-key/src'\nimport { DIDResolverPlugin } from '../../../did-resolver/src'\nimport { EthrDIDProvider } from '../../../did-provider-ethr/src'\nimport { ContextDoc } from '../types.js'\nimport { CredentialProviderLD } from '../CredentialProviderLD.js'\nimport { LdDefaultContexts } from '../ld-default-contexts.js'\nimport { VeramoEd25519Signature2018 } from '../suites/Ed25519Signature2018.js'\nimport { Resolver } from 'did-resolver'\nimport { getResolver as ethrDidResolver } from 'ethr-did-resolver'\nimport { VeramoEcdsaSecp256k1RecoverySignature2020 } from '../suites/EcdsaSecp256k1RecoverySignature2020.js'\nimport { jest } from '@jest/globals'\n\nimport 'cross-fetch/polyfill'\nimport { createGanacheProvider } from '../../../test-react-app/src/test-utils/ganache-provider'\n\njest.setTimeout(300000)\n\nconst customContext: Record<string, ContextDoc> = {\n  'custom:example.context': {\n    '@context': {\n      nothing: 'custom:example.context#blank',\n    },\n  },\n}\n\ndescribe('credential-LD full flow', () => {\n  let didKeyIdentifier: IIdentifier\n  let didEthrIdentifier: IIdentifier\n  let agent: TAgent<IResolver & IKeyManager & IDIDManager & ICredentialPlugin>\n\n  const ld = new CredentialProviderLD({\n    contextMaps: [LdDefaultContexts, customContext],\n    suites: [new VeramoEd25519Signature2018(), new VeramoEcdsaSecp256k1RecoverySignature2020()],\n  })\n\n  beforeAll(async () => {\n    const { provider, registry } = await createGanacheProvider()\n    agent = createAgent<IResolver & IKeyManager & IDIDManager & ICredentialPlugin>({\n      plugins: [\n        new KeyManager({\n          store: new MemoryKeyStore(),\n          kms: {\n            local: new KeyManagementSystem(new MemoryPrivateKeyStore()),\n          },\n        }),\n        new DIDManager({\n          providers: {\n            'did:key': new KeyDIDProvider({ defaultKms: 'local' }),\n            'did:ethr': new EthrDIDProvider({\n              defaultKms: 'local',\n              networks: [\n                {\n                  chainId: 1337,\n                  name: 'ganache',\n                  provider,\n                  registry,\n                },\n              ],\n            }),\n          },\n          store: new MemoryDIDStore(),\n          defaultProvider: 'did:key',\n        }),\n        new DIDResolverPlugin({\n          resolver: new Resolver({\n            ...getDidKeyResolver(),\n            ...ethrDidResolver({\n              networks: [\n                {\n                  chainId: 1337,\n                  name: 'ganache',\n                  provider,\n                  registry,\n                },\n              ],\n            }),\n          }),\n        }),\n        new CredentialPlugin([ld]),\n      ],\n    })\n    didKeyIdentifier = await agent.didManagerCreate()\n    didEthrIdentifier = await agent.didManagerCreate({ provider: 'did:ethr:ganache' })\n  })\n\n  it('create credential with inline context', async () => {\n    const credential: CredentialPayload = {\n      issuer: didKeyIdentifier.did,\n      '@context': [\n        {\n          '@context': {\n            nothing: 'custom:example.context#blank',\n          },\n        },\n      ],\n      credentialSubject: {\n        nothing: 'else matters',\n      },\n    }\n    const verifiableCredential = await agent.createVerifiableCredential({\n      credential,\n      proofFormat: 'lds',\n    })\n\n    expect(verifiableCredential).toBeDefined()\n\n    const result = await agent.verifyCredential({\n      credential: verifiableCredential,\n    })\n\n    expect(result.verified).toBe(true)\n  })\n\n  it('works with Ed25519Signature2018 credential', async () => {\n    const credential: CredentialPayload = {\n      issuer: didKeyIdentifier.did,\n      '@context': ['custom:example.context'],\n      credentialSubject: {\n        nothing: 'else matters',\n      },\n    }\n    const verifiableCredential = await agent.createVerifiableCredential({\n      credential,\n      proofFormat: 'lds',\n    })\n\n    expect(verifiableCredential).toBeDefined()\n\n    const result = await agent.verifyCredential({\n      credential: verifiableCredential,\n    })\n\n    expect(result.verified).toBe(true)\n  })\n\n  it('works with EcdsaSecp256k1RecoveryMethod2020 credentials', async () => {\n    const credential: CredentialPayload = {\n      // use did:ethr issuer to have a EcdsaSecp256k1RecoveryMethod2020 as a verification method in the DID document\n      issuer: didEthrIdentifier.did,\n      '@context': ['custom:example.context'],\n      credentialSubject: {\n        nothing: 'else matters',\n      },\n    }\n    const verifiableCredential = await agent.createVerifiableCredential({\n      credential,\n      proofFormat: 'lds',\n    })\n\n    expect(verifiableCredential).toBeDefined()\n    expect((verifiableCredential as any).proof.type).toBe('EcdsaSecp256k1RecoverySignature2020')\n\n    const result = await agent.verifyCredential({\n      credential: verifiableCredential,\n    })\n\n    expect(result.verified).toBe(true)\n  })\n\n  it('works with Ed25519Signature2018 credential and presentation', async () => {\n    const credential: CredentialPayload = {\n      issuer: didKeyIdentifier.did,\n      '@context': ['custom:example.context'],\n      credentialSubject: {\n        nothing: 'else matters',\n      },\n    }\n    const verifiableCredential1 = await agent.createVerifiableCredential({\n      credential,\n      proofFormat: 'lds',\n    })\n\n    const verifiablePresentation = await agent.createVerifiablePresentation({\n      presentation: {\n        verifiableCredential: [verifiableCredential1],\n        holder: didKeyIdentifier.did,\n      },\n      challenge: 'VERAMO',\n      proofFormat: 'lds',\n    })\n\n    expect(verifiablePresentation).toBeDefined()\n\n    const result = await agent.verifyPresentation({\n      presentation: verifiablePresentation,\n      challenge: 'VERAMO',\n    })\n\n    expect(result.verified).toBe(true)\n  })\n\n  it('works with EcdsaSecp256k1RecoveryMethod2020 credential and presentation', async () => {\n    const credential: CredentialPayload = {\n      issuer: { id: didEthrIdentifier.did },\n      '@context': ['https://www.w3.org/2018/credentials/v1', 'https://veramo.io/contexts/profile/v1'],\n      type: ['VerifiableCredential', 'Profile'],\n      issuanceDate: new Date().toISOString(),\n      credentialSubject: {\n        id: didKeyIdentifier.did,\n        name: 'Martin, the great',\n      },\n    }\n    const verifiableCredential1 = await agent.createVerifiableCredential({\n      credential,\n      proofFormat: 'lds',\n    })\n\n    const verifiablePresentation = await agent.createVerifiablePresentation({\n      presentation: {\n        verifiableCredential: [verifiableCredential1],\n        holder: didEthrIdentifier.did,\n      },\n      challenge: 'VERAMO',\n      proofFormat: 'lds',\n    })\n\n    expect(verifiablePresentation).toBeDefined()\n\n    const result = await agent.verifyPresentation({\n      presentation: verifiablePresentation,\n      challenge: 'VERAMO',\n    })\n\n    expect(result.verified).toBe(true)\n  })\n})\n"
  },
  {
    "path": "packages/credential-ld/src/contexts/lds-ecdsa-secp256k1-recovery2020-0.0.json",
    "content": "{\n  \"@context\": {\n    \"@version\": 1.1,\n    \"id\": \"@id\",\n    \"type\": \"@type\",\n    \"esrs2020\": \"https://identity.foundation/EcdsaSecp256k1RecoverySignature2020#\",\n    \"EcdsaSecp256k1RecoverySignature2020\": \"esrs2020:EcdsaSecp256k1RecoverySignature2020\",\n    \"EcdsaSecp256k1RecoveryMethod2020\": \"esrs2020:EcdsaSecp256k1RecoveryMethod2020\",\n    \"publicKeyJwk\": {\n      \"@id\": \"esrs2020:publicKeyJwk\",\n      \"@type\": \"@json\"\n    },\n    \"privateKeyJwk\": {\n      \"@id\": \"esrs2020:privateKeyJwk\",\n      \"@type\": \"@json\"\n    },\n    \"publicKeyHex\": \"esrs2020:publicKeyHex\",\n    \"privateKeyHex\": \"esrs2020:privateKeyHex\",\n    \"ethereumAddress\": \"esrs2020:ethereumAddress\"\n  }\n}\n"
  },
  {
    "path": "packages/credential-ld/src/contexts/schema.org.json",
    "content": "{\n  \"@context\": {\n    \"type\": \"@type\",\n    \"id\": \"@id\",\n    \"HTML\": {\n      \"@id\": \"rdf:HTML\"\n    },\n    \"@vocab\": \"http://schema.org/\",\n    \"csvw\": \"http://www.w3.org/ns/csvw#\",\n    \"dc\": \"http://purl.org/dc/elements/1.1/\",\n    \"dcat\": \"http://www.w3.org/ns/dcat#\",\n    \"dcmitype\": \"http://purl.org/dc/dcmitype/\",\n    \"dcterms\": \"http://purl.org/dc/terms/\",\n    \"dcam\": \"http://purl.org/dc/dcam/\",\n    \"doap\": \"http://usefulinc.com/ns/doap#\",\n    \"foaf\": \"http://xmlns.com/foaf/0.1/\",\n    \"odrl\": \"http://www.w3.org/ns/odrl/2/\",\n    \"geo\": \"http://www.opengis.net/ont/geosparql#\",\n    \"org\": \"http://www.w3.org/ns/org#\",\n    \"owl\": \"http://www.w3.org/2002/07/owl#\",\n    \"prof\": \"http://www.w3.org/ns/dx/prof/\",\n    \"prov\": \"http://www.w3.org/ns/prov#\",\n    \"qb\": \"http://purl.org/linked-data/cube#\",\n    \"rdf\": \"http://www.w3.org/1999/02/22-rdf-syntax-ns#\",\n    \"rdfs\": \"http://www.w3.org/2000/01/rdf-schema#\",\n    \"schema\": \"http://schema.org/\",\n    \"sh\": \"http://www.w3.org/ns/shacl#\",\n    \"skos\": \"http://www.w3.org/2004/02/skos/core#\",\n    \"sosa\": \"http://www.w3.org/ns/sosa/\",\n    \"ssn\": \"http://www.w3.org/ns/ssn/\",\n    \"time\": \"http://www.w3.org/2006/time#\",\n    \"vann\": \"http://purl.org/vocab/vann/\",\n    \"void\": \"http://rdfs.org/ns/void#\",\n    \"wgs\": \"https://www.w3.org/2003/01/geo/wgs84_pos#\",\n    \"xsd\": \"http://www.w3.org/2001/XMLSchema#\",\n    \"xml\": \"http://www.w3.org/XML/1998/namespace\",\n    \"dct\": \"http://purl.org/dc/terms/\",\n    \"dctype\": \"http://purl.org/dc/dcmitype/\",\n    \"3DModel\": {\n      \"@id\": \"schema:3DModel\"\n    },\n    \"AMRadioChannel\": {\n      \"@id\": \"schema:AMRadioChannel\"\n    },\n    \"APIReference\": {\n      \"@id\": \"schema:APIReference\"\n    },\n    \"Abdomen\": {\n      \"@id\": \"schema:Abdomen\"\n    },\n    \"AboutPage\": {\n      \"@id\": \"schema:AboutPage\"\n    },\n    \"AcceptAction\": {\n      \"@id\": \"schema:AcceptAction\"\n    },\n    \"Accommodation\": {\n      \"@id\": \"schema:Accommodation\"\n    },\n    \"AccountingService\": {\n      \"@id\": \"schema:AccountingService\"\n    },\n    \"AchieveAction\": {\n      \"@id\": \"schema:AchieveAction\"\n    },\n    \"Action\": {\n      \"@id\": \"schema:Action\"\n    },\n    \"ActionAccessSpecification\": {\n      \"@id\": \"schema:ActionAccessSpecification\"\n    },\n    \"ActionStatusType\": {\n      \"@id\": \"schema:ActionStatusType\"\n    },\n    \"ActivateAction\": {\n      \"@id\": \"schema:ActivateAction\"\n    },\n    \"ActivationFee\": {\n      \"@id\": \"schema:ActivationFee\"\n    },\n    \"ActiveActionStatus\": {\n      \"@id\": \"schema:ActiveActionStatus\"\n    },\n    \"ActiveNotRecruiting\": {\n      \"@id\": \"schema:ActiveNotRecruiting\"\n    },\n    \"AddAction\": {\n      \"@id\": \"schema:AddAction\"\n    },\n    \"AdministrativeArea\": {\n      \"@id\": \"schema:AdministrativeArea\"\n    },\n    \"AdultEntertainment\": {\n      \"@id\": \"schema:AdultEntertainment\"\n    },\n    \"AdultOrientedEnumeration\": {\n      \"@id\": \"schema:AdultOrientedEnumeration\"\n    },\n    \"AdvertiserContentArticle\": {\n      \"@id\": \"schema:AdvertiserContentArticle\"\n    },\n    \"AerobicActivity\": {\n      \"@id\": \"schema:AerobicActivity\"\n    },\n    \"AggregateOffer\": {\n      \"@id\": \"schema:AggregateOffer\"\n    },\n    \"AggregateRating\": {\n      \"@id\": \"schema:AggregateRating\"\n    },\n    \"AgreeAction\": {\n      \"@id\": \"schema:AgreeAction\"\n    },\n    \"Airline\": {\n      \"@id\": \"schema:Airline\"\n    },\n    \"Airport\": {\n      \"@id\": \"schema:Airport\"\n    },\n    \"AlbumRelease\": {\n      \"@id\": \"schema:AlbumRelease\"\n    },\n    \"AlcoholConsideration\": {\n      \"@id\": \"schema:AlcoholConsideration\"\n    },\n    \"AlignmentObject\": {\n      \"@id\": \"schema:AlignmentObject\"\n    },\n    \"AllWheelDriveConfiguration\": {\n      \"@id\": \"schema:AllWheelDriveConfiguration\"\n    },\n    \"AllergiesHealthAspect\": {\n      \"@id\": \"schema:AllergiesHealthAspect\"\n    },\n    \"AllocateAction\": {\n      \"@id\": \"schema:AllocateAction\"\n    },\n    \"AmpStory\": {\n      \"@id\": \"schema:AmpStory\"\n    },\n    \"AmusementPark\": {\n      \"@id\": \"schema:AmusementPark\"\n    },\n    \"AnaerobicActivity\": {\n      \"@id\": \"schema:AnaerobicActivity\"\n    },\n    \"AnalysisNewsArticle\": {\n      \"@id\": \"schema:AnalysisNewsArticle\"\n    },\n    \"AnatomicalStructure\": {\n      \"@id\": \"schema:AnatomicalStructure\"\n    },\n    \"AnatomicalSystem\": {\n      \"@id\": \"schema:AnatomicalSystem\"\n    },\n    \"AndroidPlatform\": {\n      \"@id\": \"schema:AndroidPlatform\"\n    },\n    \"Anesthesia\": {\n      \"@id\": \"schema:Anesthesia\"\n    },\n    \"AnimalShelter\": {\n      \"@id\": \"schema:AnimalShelter\"\n    },\n    \"Answer\": {\n      \"@id\": \"schema:Answer\"\n    },\n    \"Apartment\": {\n      \"@id\": \"schema:Apartment\"\n    },\n    \"ApartmentComplex\": {\n      \"@id\": \"schema:ApartmentComplex\"\n    },\n    \"Appearance\": {\n      \"@id\": \"schema:Appearance\"\n    },\n    \"AppendAction\": {\n      \"@id\": \"schema:AppendAction\"\n    },\n    \"ApplyAction\": {\n      \"@id\": \"schema:ApplyAction\"\n    },\n    \"ApprovedIndication\": {\n      \"@id\": \"schema:ApprovedIndication\"\n    },\n    \"Aquarium\": {\n      \"@id\": \"schema:Aquarium\"\n    },\n    \"ArchiveComponent\": {\n      \"@id\": \"schema:ArchiveComponent\"\n    },\n    \"ArchiveOrganization\": {\n      \"@id\": \"schema:ArchiveOrganization\"\n    },\n    \"ArriveAction\": {\n      \"@id\": \"schema:ArriveAction\"\n    },\n    \"ArtGallery\": {\n      \"@id\": \"schema:ArtGallery\"\n    },\n    \"Artery\": {\n      \"@id\": \"schema:Artery\"\n    },\n    \"Article\": {\n      \"@id\": \"schema:Article\"\n    },\n    \"AskAction\": {\n      \"@id\": \"schema:AskAction\"\n    },\n    \"AskPublicNewsArticle\": {\n      \"@id\": \"schema:AskPublicNewsArticle\"\n    },\n    \"AssessAction\": {\n      \"@id\": \"schema:AssessAction\"\n    },\n    \"AssignAction\": {\n      \"@id\": \"schema:AssignAction\"\n    },\n    \"Atlas\": {\n      \"@id\": \"schema:Atlas\"\n    },\n    \"Attorney\": {\n      \"@id\": \"schema:Attorney\"\n    },\n    \"Audience\": {\n      \"@id\": \"schema:Audience\"\n    },\n    \"AudioObject\": {\n      \"@id\": \"schema:AudioObject\"\n    },\n    \"AudioObjectSnapshot\": {\n      \"@id\": \"schema:AudioObjectSnapshot\"\n    },\n    \"Audiobook\": {\n      \"@id\": \"schema:Audiobook\"\n    },\n    \"AudiobookFormat\": {\n      \"@id\": \"schema:AudiobookFormat\"\n    },\n    \"AuthoritativeLegalValue\": {\n      \"@id\": \"schema:AuthoritativeLegalValue\"\n    },\n    \"AuthorizeAction\": {\n      \"@id\": \"schema:AuthorizeAction\"\n    },\n    \"AutoBodyShop\": {\n      \"@id\": \"schema:AutoBodyShop\"\n    },\n    \"AutoDealer\": {\n      \"@id\": \"schema:AutoDealer\"\n    },\n    \"AutoPartsStore\": {\n      \"@id\": \"schema:AutoPartsStore\"\n    },\n    \"AutoRental\": {\n      \"@id\": \"schema:AutoRental\"\n    },\n    \"AutoRepair\": {\n      \"@id\": \"schema:AutoRepair\"\n    },\n    \"AutoWash\": {\n      \"@id\": \"schema:AutoWash\"\n    },\n    \"AutomatedTeller\": {\n      \"@id\": \"schema:AutomatedTeller\"\n    },\n    \"AutomotiveBusiness\": {\n      \"@id\": \"schema:AutomotiveBusiness\"\n    },\n    \"Ayurvedic\": {\n      \"@id\": \"schema:Ayurvedic\"\n    },\n    \"BackOrder\": {\n      \"@id\": \"schema:BackOrder\"\n    },\n    \"BackgroundNewsArticle\": {\n      \"@id\": \"schema:BackgroundNewsArticle\"\n    },\n    \"Bacteria\": {\n      \"@id\": \"schema:Bacteria\"\n    },\n    \"Bakery\": {\n      \"@id\": \"schema:Bakery\"\n    },\n    \"Balance\": {\n      \"@id\": \"schema:Balance\"\n    },\n    \"BankAccount\": {\n      \"@id\": \"schema:BankAccount\"\n    },\n    \"BankOrCreditUnion\": {\n      \"@id\": \"schema:BankOrCreditUnion\"\n    },\n    \"BarOrPub\": {\n      \"@id\": \"schema:BarOrPub\"\n    },\n    \"Barcode\": {\n      \"@id\": \"schema:Barcode\"\n    },\n    \"BasicIncome\": {\n      \"@id\": \"schema:BasicIncome\"\n    },\n    \"Beach\": {\n      \"@id\": \"schema:Beach\"\n    },\n    \"BeautySalon\": {\n      \"@id\": \"schema:BeautySalon\"\n    },\n    \"BedAndBreakfast\": {\n      \"@id\": \"schema:BedAndBreakfast\"\n    },\n    \"BedDetails\": {\n      \"@id\": \"schema:BedDetails\"\n    },\n    \"BedType\": {\n      \"@id\": \"schema:BedType\"\n    },\n    \"BefriendAction\": {\n      \"@id\": \"schema:BefriendAction\"\n    },\n    \"BenefitsHealthAspect\": {\n      \"@id\": \"schema:BenefitsHealthAspect\"\n    },\n    \"BikeStore\": {\n      \"@id\": \"schema:BikeStore\"\n    },\n    \"BioChemEntity\": {\n      \"@id\": \"schema:BioChemEntity\"\n    },\n    \"Blog\": {\n      \"@id\": \"schema:Blog\"\n    },\n    \"BlogPosting\": {\n      \"@id\": \"schema:BlogPosting\"\n    },\n    \"BloodTest\": {\n      \"@id\": \"schema:BloodTest\"\n    },\n    \"BoardingPolicyType\": {\n      \"@id\": \"schema:BoardingPolicyType\"\n    },\n    \"BoatReservation\": {\n      \"@id\": \"schema:BoatReservation\"\n    },\n    \"BoatTerminal\": {\n      \"@id\": \"schema:BoatTerminal\"\n    },\n    \"BoatTrip\": {\n      \"@id\": \"schema:BoatTrip\"\n    },\n    \"BodyMeasurementArm\": {\n      \"@id\": \"schema:BodyMeasurementArm\"\n    },\n    \"BodyMeasurementBust\": {\n      \"@id\": \"schema:BodyMeasurementBust\"\n    },\n    \"BodyMeasurementChest\": {\n      \"@id\": \"schema:BodyMeasurementChest\"\n    },\n    \"BodyMeasurementFoot\": {\n      \"@id\": \"schema:BodyMeasurementFoot\"\n    },\n    \"BodyMeasurementHand\": {\n      \"@id\": \"schema:BodyMeasurementHand\"\n    },\n    \"BodyMeasurementHead\": {\n      \"@id\": \"schema:BodyMeasurementHead\"\n    },\n    \"BodyMeasurementHeight\": {\n      \"@id\": \"schema:BodyMeasurementHeight\"\n    },\n    \"BodyMeasurementHips\": {\n      \"@id\": \"schema:BodyMeasurementHips\"\n    },\n    \"BodyMeasurementInsideLeg\": {\n      \"@id\": \"schema:BodyMeasurementInsideLeg\"\n    },\n    \"BodyMeasurementNeck\": {\n      \"@id\": \"schema:BodyMeasurementNeck\"\n    },\n    \"BodyMeasurementTypeEnumeration\": {\n      \"@id\": \"schema:BodyMeasurementTypeEnumeration\"\n    },\n    \"BodyMeasurementUnderbust\": {\n      \"@id\": \"schema:BodyMeasurementUnderbust\"\n    },\n    \"BodyMeasurementWaist\": {\n      \"@id\": \"schema:BodyMeasurementWaist\"\n    },\n    \"BodyMeasurementWeight\": {\n      \"@id\": \"schema:BodyMeasurementWeight\"\n    },\n    \"BodyOfWater\": {\n      \"@id\": \"schema:BodyOfWater\"\n    },\n    \"Bone\": {\n      \"@id\": \"schema:Bone\"\n    },\n    \"Book\": {\n      \"@id\": \"schema:Book\"\n    },\n    \"BookFormatType\": {\n      \"@id\": \"schema:BookFormatType\"\n    },\n    \"BookSeries\": {\n      \"@id\": \"schema:BookSeries\"\n    },\n    \"BookStore\": {\n      \"@id\": \"schema:BookStore\"\n    },\n    \"BookmarkAction\": {\n      \"@id\": \"schema:BookmarkAction\"\n    },\n    \"Boolean\": {\n      \"@id\": \"schema:Boolean\"\n    },\n    \"BorrowAction\": {\n      \"@id\": \"schema:BorrowAction\"\n    },\n    \"BowlingAlley\": {\n      \"@id\": \"schema:BowlingAlley\"\n    },\n    \"BrainStructure\": {\n      \"@id\": \"schema:BrainStructure\"\n    },\n    \"Brand\": {\n      \"@id\": \"schema:Brand\"\n    },\n    \"BreadcrumbList\": {\n      \"@id\": \"schema:BreadcrumbList\"\n    },\n    \"Brewery\": {\n      \"@id\": \"schema:Brewery\"\n    },\n    \"Bridge\": {\n      \"@id\": \"schema:Bridge\"\n    },\n    \"BroadcastChannel\": {\n      \"@id\": \"schema:BroadcastChannel\"\n    },\n    \"BroadcastEvent\": {\n      \"@id\": \"schema:BroadcastEvent\"\n    },\n    \"BroadcastFrequencySpecification\": {\n      \"@id\": \"schema:BroadcastFrequencySpecification\"\n    },\n    \"BroadcastRelease\": {\n      \"@id\": \"schema:BroadcastRelease\"\n    },\n    \"BroadcastService\": {\n      \"@id\": \"schema:BroadcastService\"\n    },\n    \"BrokerageAccount\": {\n      \"@id\": \"schema:BrokerageAccount\"\n    },\n    \"BuddhistTemple\": {\n      \"@id\": \"schema:BuddhistTemple\"\n    },\n    \"BusOrCoach\": {\n      \"@id\": \"schema:BusOrCoach\"\n    },\n    \"BusReservation\": {\n      \"@id\": \"schema:BusReservation\"\n    },\n    \"BusStation\": {\n      \"@id\": \"schema:BusStation\"\n    },\n    \"BusStop\": {\n      \"@id\": \"schema:BusStop\"\n    },\n    \"BusTrip\": {\n      \"@id\": \"schema:BusTrip\"\n    },\n    \"BusinessAudience\": {\n      \"@id\": \"schema:BusinessAudience\"\n    },\n    \"BusinessEntityType\": {\n      \"@id\": \"schema:BusinessEntityType\"\n    },\n    \"BusinessEvent\": {\n      \"@id\": \"schema:BusinessEvent\"\n    },\n    \"BusinessFunction\": {\n      \"@id\": \"schema:BusinessFunction\"\n    },\n    \"BusinessSupport\": {\n      \"@id\": \"schema:BusinessSupport\"\n    },\n    \"BuyAction\": {\n      \"@id\": \"schema:BuyAction\"\n    },\n    \"CDCPMDRecord\": {\n      \"@id\": \"schema:CDCPMDRecord\"\n    },\n    \"CDFormat\": {\n      \"@id\": \"schema:CDFormat\"\n    },\n    \"CT\": {\n      \"@id\": \"schema:CT\"\n    },\n    \"CableOrSatelliteService\": {\n      \"@id\": \"schema:CableOrSatelliteService\"\n    },\n    \"CafeOrCoffeeShop\": {\n      \"@id\": \"schema:CafeOrCoffeeShop\"\n    },\n    \"Campground\": {\n      \"@id\": \"schema:Campground\"\n    },\n    \"CampingPitch\": {\n      \"@id\": \"schema:CampingPitch\"\n    },\n    \"Canal\": {\n      \"@id\": \"schema:Canal\"\n    },\n    \"CancelAction\": {\n      \"@id\": \"schema:CancelAction\"\n    },\n    \"Car\": {\n      \"@id\": \"schema:Car\"\n    },\n    \"CarUsageType\": {\n      \"@id\": \"schema:CarUsageType\"\n    },\n    \"Cardiovascular\": {\n      \"@id\": \"schema:Cardiovascular\"\n    },\n    \"CardiovascularExam\": {\n      \"@id\": \"schema:CardiovascularExam\"\n    },\n    \"CaseSeries\": {\n      \"@id\": \"schema:CaseSeries\"\n    },\n    \"Casino\": {\n      \"@id\": \"schema:Casino\"\n    },\n    \"CassetteFormat\": {\n      \"@id\": \"schema:CassetteFormat\"\n    },\n    \"CategoryCode\": {\n      \"@id\": \"schema:CategoryCode\"\n    },\n    \"CategoryCodeSet\": {\n      \"@id\": \"schema:CategoryCodeSet\"\n    },\n    \"CatholicChurch\": {\n      \"@id\": \"schema:CatholicChurch\"\n    },\n    \"CausesHealthAspect\": {\n      \"@id\": \"schema:CausesHealthAspect\"\n    },\n    \"Cemetery\": {\n      \"@id\": \"schema:Cemetery\"\n    },\n    \"Chapter\": {\n      \"@id\": \"schema:Chapter\"\n    },\n    \"CharitableIncorporatedOrganization\": {\n      \"@id\": \"schema:CharitableIncorporatedOrganization\"\n    },\n    \"CheckAction\": {\n      \"@id\": \"schema:CheckAction\"\n    },\n    \"CheckInAction\": {\n      \"@id\": \"schema:CheckInAction\"\n    },\n    \"CheckOutAction\": {\n      \"@id\": \"schema:CheckOutAction\"\n    },\n    \"CheckoutPage\": {\n      \"@id\": \"schema:CheckoutPage\"\n    },\n    \"ChemicalSubstance\": {\n      \"@id\": \"schema:ChemicalSubstance\"\n    },\n    \"ChildCare\": {\n      \"@id\": \"schema:ChildCare\"\n    },\n    \"ChildrensEvent\": {\n      \"@id\": \"schema:ChildrensEvent\"\n    },\n    \"Chiropractic\": {\n      \"@id\": \"schema:Chiropractic\"\n    },\n    \"ChooseAction\": {\n      \"@id\": \"schema:ChooseAction\"\n    },\n    \"Church\": {\n      \"@id\": \"schema:Church\"\n    },\n    \"City\": {\n      \"@id\": \"schema:City\"\n    },\n    \"CityHall\": {\n      \"@id\": \"schema:CityHall\"\n    },\n    \"CivicStructure\": {\n      \"@id\": \"schema:CivicStructure\"\n    },\n    \"Claim\": {\n      \"@id\": \"schema:Claim\"\n    },\n    \"ClaimReview\": {\n      \"@id\": \"schema:ClaimReview\"\n    },\n    \"Class\": {\n      \"@id\": \"schema:Class\"\n    },\n    \"CleaningFee\": {\n      \"@id\": \"schema:CleaningFee\"\n    },\n    \"Clinician\": {\n      \"@id\": \"schema:Clinician\"\n    },\n    \"Clip\": {\n      \"@id\": \"schema:Clip\"\n    },\n    \"ClothingStore\": {\n      \"@id\": \"schema:ClothingStore\"\n    },\n    \"CoOp\": {\n      \"@id\": \"schema:CoOp\"\n    },\n    \"Code\": {\n      \"@id\": \"schema:Code\"\n    },\n    \"CohortStudy\": {\n      \"@id\": \"schema:CohortStudy\"\n    },\n    \"Collection\": {\n      \"@id\": \"schema:Collection\"\n    },\n    \"CollectionPage\": {\n      \"@id\": \"schema:CollectionPage\"\n    },\n    \"CollegeOrUniversity\": {\n      \"@id\": \"schema:CollegeOrUniversity\"\n    },\n    \"ComedyClub\": {\n      \"@id\": \"schema:ComedyClub\"\n    },\n    \"ComedyEvent\": {\n      \"@id\": \"schema:ComedyEvent\"\n    },\n    \"ComicCoverArt\": {\n      \"@id\": \"schema:ComicCoverArt\"\n    },\n    \"ComicIssue\": {\n      \"@id\": \"schema:ComicIssue\"\n    },\n    \"ComicSeries\": {\n      \"@id\": \"schema:ComicSeries\"\n    },\n    \"ComicStory\": {\n      \"@id\": \"schema:ComicStory\"\n    },\n    \"Comment\": {\n      \"@id\": \"schema:Comment\"\n    },\n    \"CommentAction\": {\n      \"@id\": \"schema:CommentAction\"\n    },\n    \"CommentPermission\": {\n      \"@id\": \"schema:CommentPermission\"\n    },\n    \"CommunicateAction\": {\n      \"@id\": \"schema:CommunicateAction\"\n    },\n    \"CommunityHealth\": {\n      \"@id\": \"schema:CommunityHealth\"\n    },\n    \"CompilationAlbum\": {\n      \"@id\": \"schema:CompilationAlbum\"\n    },\n    \"CompleteDataFeed\": {\n      \"@id\": \"schema:CompleteDataFeed\"\n    },\n    \"Completed\": {\n      \"@id\": \"schema:Completed\"\n    },\n    \"CompletedActionStatus\": {\n      \"@id\": \"schema:CompletedActionStatus\"\n    },\n    \"CompoundPriceSpecification\": {\n      \"@id\": \"schema:CompoundPriceSpecification\"\n    },\n    \"ComputerLanguage\": {\n      \"@id\": \"schema:ComputerLanguage\"\n    },\n    \"ComputerStore\": {\n      \"@id\": \"schema:ComputerStore\"\n    },\n    \"ConfirmAction\": {\n      \"@id\": \"schema:ConfirmAction\"\n    },\n    \"Consortium\": {\n      \"@id\": \"schema:Consortium\"\n    },\n    \"ConsumeAction\": {\n      \"@id\": \"schema:ConsumeAction\"\n    },\n    \"ContactPage\": {\n      \"@id\": \"schema:ContactPage\"\n    },\n    \"ContactPoint\": {\n      \"@id\": \"schema:ContactPoint\"\n    },\n    \"ContactPointOption\": {\n      \"@id\": \"schema:ContactPointOption\"\n    },\n    \"ContagiousnessHealthAspect\": {\n      \"@id\": \"schema:ContagiousnessHealthAspect\"\n    },\n    \"Continent\": {\n      \"@id\": \"schema:Continent\"\n    },\n    \"ControlAction\": {\n      \"@id\": \"schema:ControlAction\"\n    },\n    \"ConvenienceStore\": {\n      \"@id\": \"schema:ConvenienceStore\"\n    },\n    \"Conversation\": {\n      \"@id\": \"schema:Conversation\"\n    },\n    \"CookAction\": {\n      \"@id\": \"schema:CookAction\"\n    },\n    \"Corporation\": {\n      \"@id\": \"schema:Corporation\"\n    },\n    \"CorrectionComment\": {\n      \"@id\": \"schema:CorrectionComment\"\n    },\n    \"Country\": {\n      \"@id\": \"schema:Country\"\n    },\n    \"Course\": {\n      \"@id\": \"schema:Course\"\n    },\n    \"CourseInstance\": {\n      \"@id\": \"schema:CourseInstance\"\n    },\n    \"Courthouse\": {\n      \"@id\": \"schema:Courthouse\"\n    },\n    \"CoverArt\": {\n      \"@id\": \"schema:CoverArt\"\n    },\n    \"CovidTestingFacility\": {\n      \"@id\": \"schema:CovidTestingFacility\"\n    },\n    \"CreateAction\": {\n      \"@id\": \"schema:CreateAction\"\n    },\n    \"CreativeWork\": {\n      \"@id\": \"schema:CreativeWork\"\n    },\n    \"CreativeWorkSeason\": {\n      \"@id\": \"schema:CreativeWorkSeason\"\n    },\n    \"CreativeWorkSeries\": {\n      \"@id\": \"schema:CreativeWorkSeries\"\n    },\n    \"CreditCard\": {\n      \"@id\": \"schema:CreditCard\"\n    },\n    \"Crematorium\": {\n      \"@id\": \"schema:Crematorium\"\n    },\n    \"CriticReview\": {\n      \"@id\": \"schema:CriticReview\"\n    },\n    \"CrossSectional\": {\n      \"@id\": \"schema:CrossSectional\"\n    },\n    \"CssSelectorType\": {\n      \"@id\": \"schema:CssSelectorType\"\n    },\n    \"CurrencyConversionService\": {\n      \"@id\": \"schema:CurrencyConversionService\"\n    },\n    \"DDxElement\": {\n      \"@id\": \"schema:DDxElement\"\n    },\n    \"DJMixAlbum\": {\n      \"@id\": \"schema:DJMixAlbum\"\n    },\n    \"DVDFormat\": {\n      \"@id\": \"schema:DVDFormat\"\n    },\n    \"DamagedCondition\": {\n      \"@id\": \"schema:DamagedCondition\"\n    },\n    \"DanceEvent\": {\n      \"@id\": \"schema:DanceEvent\"\n    },\n    \"DanceGroup\": {\n      \"@id\": \"schema:DanceGroup\"\n    },\n    \"DangerousGoodConsideration\": {\n      \"@id\": \"schema:DangerousGoodConsideration\"\n    },\n    \"DataCatalog\": {\n      \"@id\": \"schema:DataCatalog\"\n    },\n    \"DataDownload\": {\n      \"@id\": \"schema:DataDownload\"\n    },\n    \"DataFeed\": {\n      \"@id\": \"schema:DataFeed\"\n    },\n    \"DataFeedItem\": {\n      \"@id\": \"schema:DataFeedItem\"\n    },\n    \"DataType\": {\n      \"@id\": \"schema:DataType\"\n    },\n    \"Dataset\": {\n      \"@id\": \"schema:Dataset\"\n    },\n    \"Date\": {\n      \"@id\": \"schema:Date\"\n    },\n    \"DateTime\": {\n      \"@id\": \"schema:DateTime\"\n    },\n    \"DatedMoneySpecification\": {\n      \"@id\": \"schema:DatedMoneySpecification\"\n    },\n    \"DayOfWeek\": {\n      \"@id\": \"schema:DayOfWeek\"\n    },\n    \"DaySpa\": {\n      \"@id\": \"schema:DaySpa\"\n    },\n    \"DeactivateAction\": {\n      \"@id\": \"schema:DeactivateAction\"\n    },\n    \"DecontextualizedContent\": {\n      \"@id\": \"schema:DecontextualizedContent\"\n    },\n    \"DefenceEstablishment\": {\n      \"@id\": \"schema:DefenceEstablishment\"\n    },\n    \"DefinedRegion\": {\n      \"@id\": \"schema:DefinedRegion\"\n    },\n    \"DefinedTerm\": {\n      \"@id\": \"schema:DefinedTerm\"\n    },\n    \"DefinedTermSet\": {\n      \"@id\": \"schema:DefinedTermSet\"\n    },\n    \"DefinitiveLegalValue\": {\n      \"@id\": \"schema:DefinitiveLegalValue\"\n    },\n    \"DeleteAction\": {\n      \"@id\": \"schema:DeleteAction\"\n    },\n    \"DeliveryChargeSpecification\": {\n      \"@id\": \"schema:DeliveryChargeSpecification\"\n    },\n    \"DeliveryEvent\": {\n      \"@id\": \"schema:DeliveryEvent\"\n    },\n    \"DeliveryMethod\": {\n      \"@id\": \"schema:DeliveryMethod\"\n    },\n    \"DeliveryTimeSettings\": {\n      \"@id\": \"schema:DeliveryTimeSettings\"\n    },\n    \"Demand\": {\n      \"@id\": \"schema:Demand\"\n    },\n    \"DemoAlbum\": {\n      \"@id\": \"schema:DemoAlbum\"\n    },\n    \"DemoGameAvailability\": {\n      \"@id\": \"schema:DemoGameAvailability\"\n    },\n    \"Dentist\": {\n      \"@id\": \"schema:Dentist\"\n    },\n    \"Dentistry\": {\n      \"@id\": \"schema:Dentistry\"\n    },\n    \"DepartAction\": {\n      \"@id\": \"schema:DepartAction\"\n    },\n    \"DepartmentStore\": {\n      \"@id\": \"schema:DepartmentStore\"\n    },\n    \"DepositAccount\": {\n      \"@id\": \"schema:DepositAccount\"\n    },\n    \"Dermatologic\": {\n      \"@id\": \"schema:Dermatologic\"\n    },\n    \"Dermatology\": {\n      \"@id\": \"schema:Dermatology\"\n    },\n    \"DesktopWebPlatform\": {\n      \"@id\": \"schema:DesktopWebPlatform\"\n    },\n    \"DiabeticDiet\": {\n      \"@id\": \"schema:DiabeticDiet\"\n    },\n    \"Diagnostic\": {\n      \"@id\": \"schema:Diagnostic\"\n    },\n    \"DiagnosticLab\": {\n      \"@id\": \"schema:DiagnosticLab\"\n    },\n    \"DiagnosticProcedure\": {\n      \"@id\": \"schema:DiagnosticProcedure\"\n    },\n    \"Diet\": {\n      \"@id\": \"schema:Diet\"\n    },\n    \"DietNutrition\": {\n      \"@id\": \"schema:DietNutrition\"\n    },\n    \"DietarySupplement\": {\n      \"@id\": \"schema:DietarySupplement\"\n    },\n    \"DigitalAudioTapeFormat\": {\n      \"@id\": \"schema:DigitalAudioTapeFormat\"\n    },\n    \"DigitalDocument\": {\n      \"@id\": \"schema:DigitalDocument\"\n    },\n    \"DigitalDocumentPermission\": {\n      \"@id\": \"schema:DigitalDocumentPermission\"\n    },\n    \"DigitalDocumentPermissionType\": {\n      \"@id\": \"schema:DigitalDocumentPermissionType\"\n    },\n    \"DigitalFormat\": {\n      \"@id\": \"schema:DigitalFormat\"\n    },\n    \"DigitalPlatformEnumeration\": {\n      \"@id\": \"schema:DigitalPlatformEnumeration\"\n    },\n    \"DisabilitySupport\": {\n      \"@id\": \"schema:DisabilitySupport\"\n    },\n    \"DisagreeAction\": {\n      \"@id\": \"schema:DisagreeAction\"\n    },\n    \"Discontinued\": {\n      \"@id\": \"schema:Discontinued\"\n    },\n    \"DiscoverAction\": {\n      \"@id\": \"schema:DiscoverAction\"\n    },\n    \"DiscussionForumPosting\": {\n      \"@id\": \"schema:DiscussionForumPosting\"\n    },\n    \"DislikeAction\": {\n      \"@id\": \"schema:DislikeAction\"\n    },\n    \"Distance\": {\n      \"@id\": \"schema:Distance\"\n    },\n    \"DistanceFee\": {\n      \"@id\": \"schema:DistanceFee\"\n    },\n    \"Distillery\": {\n      \"@id\": \"schema:Distillery\"\n    },\n    \"DonateAction\": {\n      \"@id\": \"schema:DonateAction\"\n    },\n    \"DoseSchedule\": {\n      \"@id\": \"schema:DoseSchedule\"\n    },\n    \"DoubleBlindedTrial\": {\n      \"@id\": \"schema:DoubleBlindedTrial\"\n    },\n    \"DownloadAction\": {\n      \"@id\": \"schema:DownloadAction\"\n    },\n    \"Downpayment\": {\n      \"@id\": \"schema:Downpayment\"\n    },\n    \"DrawAction\": {\n      \"@id\": \"schema:DrawAction\"\n    },\n    \"Drawing\": {\n      \"@id\": \"schema:Drawing\"\n    },\n    \"DrinkAction\": {\n      \"@id\": \"schema:DrinkAction\"\n    },\n    \"DriveWheelConfigurationValue\": {\n      \"@id\": \"schema:DriveWheelConfigurationValue\"\n    },\n    \"DrivingSchoolVehicleUsage\": {\n      \"@id\": \"schema:DrivingSchoolVehicleUsage\"\n    },\n    \"Drug\": {\n      \"@id\": \"schema:Drug\"\n    },\n    \"DrugClass\": {\n      \"@id\": \"schema:DrugClass\"\n    },\n    \"DrugCost\": {\n      \"@id\": \"schema:DrugCost\"\n    },\n    \"DrugCostCategory\": {\n      \"@id\": \"schema:DrugCostCategory\"\n    },\n    \"DrugLegalStatus\": {\n      \"@id\": \"schema:DrugLegalStatus\"\n    },\n    \"DrugPregnancyCategory\": {\n      \"@id\": \"schema:DrugPregnancyCategory\"\n    },\n    \"DrugPrescriptionStatus\": {\n      \"@id\": \"schema:DrugPrescriptionStatus\"\n    },\n    \"DrugStrength\": {\n      \"@id\": \"schema:DrugStrength\"\n    },\n    \"DryCleaningOrLaundry\": {\n      \"@id\": \"schema:DryCleaningOrLaundry\"\n    },\n    \"Duration\": {\n      \"@id\": \"schema:Duration\"\n    },\n    \"EBook\": {\n      \"@id\": \"schema:EBook\"\n    },\n    \"EPRelease\": {\n      \"@id\": \"schema:EPRelease\"\n    },\n    \"EUEnergyEfficiencyCategoryA\": {\n      \"@id\": \"schema:EUEnergyEfficiencyCategoryA\"\n    },\n    \"EUEnergyEfficiencyCategoryA1Plus\": {\n      \"@id\": \"schema:EUEnergyEfficiencyCategoryA1Plus\"\n    },\n    \"EUEnergyEfficiencyCategoryA2Plus\": {\n      \"@id\": \"schema:EUEnergyEfficiencyCategoryA2Plus\"\n    },\n    \"EUEnergyEfficiencyCategoryA3Plus\": {\n      \"@id\": \"schema:EUEnergyEfficiencyCategoryA3Plus\"\n    },\n    \"EUEnergyEfficiencyCategoryB\": {\n      \"@id\": \"schema:EUEnergyEfficiencyCategoryB\"\n    },\n    \"EUEnergyEfficiencyCategoryC\": {\n      \"@id\": \"schema:EUEnergyEfficiencyCategoryC\"\n    },\n    \"EUEnergyEfficiencyCategoryD\": {\n      \"@id\": \"schema:EUEnergyEfficiencyCategoryD\"\n    },\n    \"EUEnergyEfficiencyCategoryE\": {\n      \"@id\": \"schema:EUEnergyEfficiencyCategoryE\"\n    },\n    \"EUEnergyEfficiencyCategoryF\": {\n      \"@id\": \"schema:EUEnergyEfficiencyCategoryF\"\n    },\n    \"EUEnergyEfficiencyCategoryG\": {\n      \"@id\": \"schema:EUEnergyEfficiencyCategoryG\"\n    },\n    \"EUEnergyEfficiencyEnumeration\": {\n      \"@id\": \"schema:EUEnergyEfficiencyEnumeration\"\n    },\n    \"Ear\": {\n      \"@id\": \"schema:Ear\"\n    },\n    \"EatAction\": {\n      \"@id\": \"schema:EatAction\"\n    },\n    \"EditedOrCroppedContent\": {\n      \"@id\": \"schema:EditedOrCroppedContent\"\n    },\n    \"EducationEvent\": {\n      \"@id\": \"schema:EducationEvent\"\n    },\n    \"EducationalAudience\": {\n      \"@id\": \"schema:EducationalAudience\"\n    },\n    \"EducationalOccupationalCredential\": {\n      \"@id\": \"schema:EducationalOccupationalCredential\"\n    },\n    \"EducationalOccupationalProgram\": {\n      \"@id\": \"schema:EducationalOccupationalProgram\"\n    },\n    \"EducationalOrganization\": {\n      \"@id\": \"schema:EducationalOrganization\"\n    },\n    \"EffectivenessHealthAspect\": {\n      \"@id\": \"schema:EffectivenessHealthAspect\"\n    },\n    \"Electrician\": {\n      \"@id\": \"schema:Electrician\"\n    },\n    \"ElectronicsStore\": {\n      \"@id\": \"schema:ElectronicsStore\"\n    },\n    \"ElementarySchool\": {\n      \"@id\": \"schema:ElementarySchool\"\n    },\n    \"EmailMessage\": {\n      \"@id\": \"schema:EmailMessage\"\n    },\n    \"Embassy\": {\n      \"@id\": \"schema:Embassy\"\n    },\n    \"Emergency\": {\n      \"@id\": \"schema:Emergency\"\n    },\n    \"EmergencyService\": {\n      \"@id\": \"schema:EmergencyService\"\n    },\n    \"EmployeeRole\": {\n      \"@id\": \"schema:EmployeeRole\"\n    },\n    \"EmployerAggregateRating\": {\n      \"@id\": \"schema:EmployerAggregateRating\"\n    },\n    \"EmployerReview\": {\n      \"@id\": \"schema:EmployerReview\"\n    },\n    \"EmploymentAgency\": {\n      \"@id\": \"schema:EmploymentAgency\"\n    },\n    \"Endocrine\": {\n      \"@id\": \"schema:Endocrine\"\n    },\n    \"EndorseAction\": {\n      \"@id\": \"schema:EndorseAction\"\n    },\n    \"EndorsementRating\": {\n      \"@id\": \"schema:EndorsementRating\"\n    },\n    \"Energy\": {\n      \"@id\": \"schema:Energy\"\n    },\n    \"EnergyConsumptionDetails\": {\n      \"@id\": \"schema:EnergyConsumptionDetails\"\n    },\n    \"EnergyEfficiencyEnumeration\": {\n      \"@id\": \"schema:EnergyEfficiencyEnumeration\"\n    },\n    \"EnergyStarCertified\": {\n      \"@id\": \"schema:EnergyStarCertified\"\n    },\n    \"EnergyStarEnergyEfficiencyEnumeration\": {\n      \"@id\": \"schema:EnergyStarEnergyEfficiencyEnumeration\"\n    },\n    \"EngineSpecification\": {\n      \"@id\": \"schema:EngineSpecification\"\n    },\n    \"EnrollingByInvitation\": {\n      \"@id\": \"schema:EnrollingByInvitation\"\n    },\n    \"EntertainmentBusiness\": {\n      \"@id\": \"schema:EntertainmentBusiness\"\n    },\n    \"EntryPoint\": {\n      \"@id\": \"schema:EntryPoint\"\n    },\n    \"Enumeration\": {\n      \"@id\": \"schema:Enumeration\"\n    },\n    \"Episode\": {\n      \"@id\": \"schema:Episode\"\n    },\n    \"Event\": {\n      \"@id\": \"schema:Event\"\n    },\n    \"EventAttendanceModeEnumeration\": {\n      \"@id\": \"schema:EventAttendanceModeEnumeration\"\n    },\n    \"EventCancelled\": {\n      \"@id\": \"schema:EventCancelled\"\n    },\n    \"EventMovedOnline\": {\n      \"@id\": \"schema:EventMovedOnline\"\n    },\n    \"EventPostponed\": {\n      \"@id\": \"schema:EventPostponed\"\n    },\n    \"EventRescheduled\": {\n      \"@id\": \"schema:EventRescheduled\"\n    },\n    \"EventReservation\": {\n      \"@id\": \"schema:EventReservation\"\n    },\n    \"EventScheduled\": {\n      \"@id\": \"schema:EventScheduled\"\n    },\n    \"EventSeries\": {\n      \"@id\": \"schema:EventSeries\"\n    },\n    \"EventStatusType\": {\n      \"@id\": \"schema:EventStatusType\"\n    },\n    \"EventVenue\": {\n      \"@id\": \"schema:EventVenue\"\n    },\n    \"EvidenceLevelA\": {\n      \"@id\": \"schema:EvidenceLevelA\"\n    },\n    \"EvidenceLevelB\": {\n      \"@id\": \"schema:EvidenceLevelB\"\n    },\n    \"EvidenceLevelC\": {\n      \"@id\": \"schema:EvidenceLevelC\"\n    },\n    \"ExchangeRateSpecification\": {\n      \"@id\": \"schema:ExchangeRateSpecification\"\n    },\n    \"ExchangeRefund\": {\n      \"@id\": \"schema:ExchangeRefund\"\n    },\n    \"ExerciseAction\": {\n      \"@id\": \"schema:ExerciseAction\"\n    },\n    \"ExerciseGym\": {\n      \"@id\": \"schema:ExerciseGym\"\n    },\n    \"ExercisePlan\": {\n      \"@id\": \"schema:ExercisePlan\"\n    },\n    \"ExhibitionEvent\": {\n      \"@id\": \"schema:ExhibitionEvent\"\n    },\n    \"Eye\": {\n      \"@id\": \"schema:Eye\"\n    },\n    \"FAQPage\": {\n      \"@id\": \"schema:FAQPage\"\n    },\n    \"FDAcategoryA\": {\n      \"@id\": \"schema:FDAcategoryA\"\n    },\n    \"FDAcategoryB\": {\n      \"@id\": \"schema:FDAcategoryB\"\n    },\n    \"FDAcategoryC\": {\n      \"@id\": \"schema:FDAcategoryC\"\n    },\n    \"FDAcategoryD\": {\n      \"@id\": \"schema:FDAcategoryD\"\n    },\n    \"FDAcategoryX\": {\n      \"@id\": \"schema:FDAcategoryX\"\n    },\n    \"FDAnotEvaluated\": {\n      \"@id\": \"schema:FDAnotEvaluated\"\n    },\n    \"FMRadioChannel\": {\n      \"@id\": \"schema:FMRadioChannel\"\n    },\n    \"FailedActionStatus\": {\n      \"@id\": \"schema:FailedActionStatus\"\n    },\n    \"False\": {\n      \"@id\": \"schema:False\"\n    },\n    \"FastFoodRestaurant\": {\n      \"@id\": \"schema:FastFoodRestaurant\"\n    },\n    \"Female\": {\n      \"@id\": \"schema:Female\"\n    },\n    \"Festival\": {\n      \"@id\": \"schema:Festival\"\n    },\n    \"FilmAction\": {\n      \"@id\": \"schema:FilmAction\"\n    },\n    \"FinancialProduct\": {\n      \"@id\": \"schema:FinancialProduct\"\n    },\n    \"FinancialService\": {\n      \"@id\": \"schema:FinancialService\"\n    },\n    \"FindAction\": {\n      \"@id\": \"schema:FindAction\"\n    },\n    \"FireStation\": {\n      \"@id\": \"schema:FireStation\"\n    },\n    \"Flexibility\": {\n      \"@id\": \"schema:Flexibility\"\n    },\n    \"Flight\": {\n      \"@id\": \"schema:Flight\"\n    },\n    \"FlightReservation\": {\n      \"@id\": \"schema:FlightReservation\"\n    },\n    \"Float\": {\n      \"@id\": \"schema:Float\"\n    },\n    \"FloorPlan\": {\n      \"@id\": \"schema:FloorPlan\"\n    },\n    \"Florist\": {\n      \"@id\": \"schema:Florist\"\n    },\n    \"FollowAction\": {\n      \"@id\": \"schema:FollowAction\"\n    },\n    \"FoodEstablishment\": {\n      \"@id\": \"schema:FoodEstablishment\"\n    },\n    \"FoodEstablishmentReservation\": {\n      \"@id\": \"schema:FoodEstablishmentReservation\"\n    },\n    \"FoodEvent\": {\n      \"@id\": \"schema:FoodEvent\"\n    },\n    \"FoodService\": {\n      \"@id\": \"schema:FoodService\"\n    },\n    \"FourWheelDriveConfiguration\": {\n      \"@id\": \"schema:FourWheelDriveConfiguration\"\n    },\n    \"FreeReturn\": {\n      \"@id\": \"schema:FreeReturn\"\n    },\n    \"Friday\": {\n      \"@id\": \"schema:Friday\"\n    },\n    \"FrontWheelDriveConfiguration\": {\n      \"@id\": \"schema:FrontWheelDriveConfiguration\"\n    },\n    \"FullGameAvailability\": {\n      \"@id\": \"schema:FullGameAvailability\"\n    },\n    \"FullRefund\": {\n      \"@id\": \"schema:FullRefund\"\n    },\n    \"FundingAgency\": {\n      \"@id\": \"schema:FundingAgency\"\n    },\n    \"FundingScheme\": {\n      \"@id\": \"schema:FundingScheme\"\n    },\n    \"Fungus\": {\n      \"@id\": \"schema:Fungus\"\n    },\n    \"FurnitureStore\": {\n      \"@id\": \"schema:FurnitureStore\"\n    },\n    \"Game\": {\n      \"@id\": \"schema:Game\"\n    },\n    \"GameAvailabilityEnumeration\": {\n      \"@id\": \"schema:GameAvailabilityEnumeration\"\n    },\n    \"GamePlayMode\": {\n      \"@id\": \"schema:GamePlayMode\"\n    },\n    \"GameServer\": {\n      \"@id\": \"schema:GameServer\"\n    },\n    \"GameServerStatus\": {\n      \"@id\": \"schema:GameServerStatus\"\n    },\n    \"GardenStore\": {\n      \"@id\": \"schema:GardenStore\"\n    },\n    \"GasStation\": {\n      \"@id\": \"schema:GasStation\"\n    },\n    \"Gastroenterologic\": {\n      \"@id\": \"schema:Gastroenterologic\"\n    },\n    \"GatedResidenceCommunity\": {\n      \"@id\": \"schema:GatedResidenceCommunity\"\n    },\n    \"GenderType\": {\n      \"@id\": \"schema:GenderType\"\n    },\n    \"Gene\": {\n      \"@id\": \"schema:Gene\"\n    },\n    \"GeneralContractor\": {\n      \"@id\": \"schema:GeneralContractor\"\n    },\n    \"GenericWebPlatform\": {\n      \"@id\": \"schema:GenericWebPlatform\"\n    },\n    \"Genetic\": {\n      \"@id\": \"schema:Genetic\"\n    },\n    \"Genitourinary\": {\n      \"@id\": \"schema:Genitourinary\"\n    },\n    \"GeoCircle\": {\n      \"@id\": \"schema:GeoCircle\"\n    },\n    \"GeoCoordinates\": {\n      \"@id\": \"schema:GeoCoordinates\"\n    },\n    \"GeoShape\": {\n      \"@id\": \"schema:GeoShape\"\n    },\n    \"GeospatialGeometry\": {\n      \"@id\": \"schema:GeospatialGeometry\"\n    },\n    \"Geriatric\": {\n      \"@id\": \"schema:Geriatric\"\n    },\n    \"GettingAccessHealthAspect\": {\n      \"@id\": \"schema:GettingAccessHealthAspect\"\n    },\n    \"GiveAction\": {\n      \"@id\": \"schema:GiveAction\"\n    },\n    \"GlutenFreeDiet\": {\n      \"@id\": \"schema:GlutenFreeDiet\"\n    },\n    \"GolfCourse\": {\n      \"@id\": \"schema:GolfCourse\"\n    },\n    \"GovernmentBenefitsType\": {\n      \"@id\": \"schema:GovernmentBenefitsType\"\n    },\n    \"GovernmentBuilding\": {\n      \"@id\": \"schema:GovernmentBuilding\"\n    },\n    \"GovernmentOffice\": {\n      \"@id\": \"schema:GovernmentOffice\"\n    },\n    \"GovernmentOrganization\": {\n      \"@id\": \"schema:GovernmentOrganization\"\n    },\n    \"GovernmentPermit\": {\n      \"@id\": \"schema:GovernmentPermit\"\n    },\n    \"GovernmentService\": {\n      \"@id\": \"schema:GovernmentService\"\n    },\n    \"Grant\": {\n      \"@id\": \"schema:Grant\"\n    },\n    \"GraphicNovel\": {\n      \"@id\": \"schema:GraphicNovel\"\n    },\n    \"GroceryStore\": {\n      \"@id\": \"schema:GroceryStore\"\n    },\n    \"GroupBoardingPolicy\": {\n      \"@id\": \"schema:GroupBoardingPolicy\"\n    },\n    \"Guide\": {\n      \"@id\": \"schema:Guide\"\n    },\n    \"Gynecologic\": {\n      \"@id\": \"schema:Gynecologic\"\n    },\n    \"HVACBusiness\": {\n      \"@id\": \"schema:HVACBusiness\"\n    },\n    \"Hackathon\": {\n      \"@id\": \"schema:Hackathon\"\n    },\n    \"HairSalon\": {\n      \"@id\": \"schema:HairSalon\"\n    },\n    \"HalalDiet\": {\n      \"@id\": \"schema:HalalDiet\"\n    },\n    \"Hardcover\": {\n      \"@id\": \"schema:Hardcover\"\n    },\n    \"HardwareStore\": {\n      \"@id\": \"schema:HardwareStore\"\n    },\n    \"Head\": {\n      \"@id\": \"schema:Head\"\n    },\n    \"HealthAndBeautyBusiness\": {\n      \"@id\": \"schema:HealthAndBeautyBusiness\"\n    },\n    \"HealthAspectEnumeration\": {\n      \"@id\": \"schema:HealthAspectEnumeration\"\n    },\n    \"HealthCare\": {\n      \"@id\": \"schema:HealthCare\"\n    },\n    \"HealthClub\": {\n      \"@id\": \"schema:HealthClub\"\n    },\n    \"HealthInsurancePlan\": {\n      \"@id\": \"schema:HealthInsurancePlan\"\n    },\n    \"HealthPlanCostSharingSpecification\": {\n      \"@id\": \"schema:HealthPlanCostSharingSpecification\"\n    },\n    \"HealthPlanFormulary\": {\n      \"@id\": \"schema:HealthPlanFormulary\"\n    },\n    \"HealthPlanNetwork\": {\n      \"@id\": \"schema:HealthPlanNetwork\"\n    },\n    \"HealthTopicContent\": {\n      \"@id\": \"schema:HealthTopicContent\"\n    },\n    \"HealthcareConsideration\": {\n      \"@id\": \"schema:HealthcareConsideration\"\n    },\n    \"HearingImpairedSupported\": {\n      \"@id\": \"schema:HearingImpairedSupported\"\n    },\n    \"Hematologic\": {\n      \"@id\": \"schema:Hematologic\"\n    },\n    \"HighSchool\": {\n      \"@id\": \"schema:HighSchool\"\n    },\n    \"HinduDiet\": {\n      \"@id\": \"schema:HinduDiet\"\n    },\n    \"HinduTemple\": {\n      \"@id\": \"schema:HinduTemple\"\n    },\n    \"HobbyShop\": {\n      \"@id\": \"schema:HobbyShop\"\n    },\n    \"HomeAndConstructionBusiness\": {\n      \"@id\": \"schema:HomeAndConstructionBusiness\"\n    },\n    \"HomeGoodsStore\": {\n      \"@id\": \"schema:HomeGoodsStore\"\n    },\n    \"Homeopathic\": {\n      \"@id\": \"schema:Homeopathic\"\n    },\n    \"Hospital\": {\n      \"@id\": \"schema:Hospital\"\n    },\n    \"Hostel\": {\n      \"@id\": \"schema:Hostel\"\n    },\n    \"Hotel\": {\n      \"@id\": \"schema:Hotel\"\n    },\n    \"HotelRoom\": {\n      \"@id\": \"schema:HotelRoom\"\n    },\n    \"House\": {\n      \"@id\": \"schema:House\"\n    },\n    \"HousePainter\": {\n      \"@id\": \"schema:HousePainter\"\n    },\n    \"HowItWorksHealthAspect\": {\n      \"@id\": \"schema:HowItWorksHealthAspect\"\n    },\n    \"HowOrWhereHealthAspect\": {\n      \"@id\": \"schema:HowOrWhereHealthAspect\"\n    },\n    \"HowTo\": {\n      \"@id\": \"schema:HowTo\"\n    },\n    \"HowToDirection\": {\n      \"@id\": \"schema:HowToDirection\"\n    },\n    \"HowToItem\": {\n      \"@id\": \"schema:HowToItem\"\n    },\n    \"HowToSection\": {\n      \"@id\": \"schema:HowToSection\"\n    },\n    \"HowToStep\": {\n      \"@id\": \"schema:HowToStep\"\n    },\n    \"HowToSupply\": {\n      \"@id\": \"schema:HowToSupply\"\n    },\n    \"HowToTip\": {\n      \"@id\": \"schema:HowToTip\"\n    },\n    \"HowToTool\": {\n      \"@id\": \"schema:HowToTool\"\n    },\n    \"HyperToc\": {\n      \"@id\": \"schema:HyperToc\"\n    },\n    \"HyperTocEntry\": {\n      \"@id\": \"schema:HyperTocEntry\"\n    },\n    \"IOSPlatform\": {\n      \"@id\": \"schema:IOSPlatform\"\n    },\n    \"IceCreamShop\": {\n      \"@id\": \"schema:IceCreamShop\"\n    },\n    \"IgnoreAction\": {\n      \"@id\": \"schema:IgnoreAction\"\n    },\n    \"ImageGallery\": {\n      \"@id\": \"schema:ImageGallery\"\n    },\n    \"ImageObject\": {\n      \"@id\": \"schema:ImageObject\"\n    },\n    \"ImageObjectSnapshot\": {\n      \"@id\": \"schema:ImageObjectSnapshot\"\n    },\n    \"ImagingTest\": {\n      \"@id\": \"schema:ImagingTest\"\n    },\n    \"InForce\": {\n      \"@id\": \"schema:InForce\"\n    },\n    \"InStock\": {\n      \"@id\": \"schema:InStock\"\n    },\n    \"InStoreOnly\": {\n      \"@id\": \"schema:InStoreOnly\"\n    },\n    \"IndividualProduct\": {\n      \"@id\": \"schema:IndividualProduct\"\n    },\n    \"Infectious\": {\n      \"@id\": \"schema:Infectious\"\n    },\n    \"InfectiousAgentClass\": {\n      \"@id\": \"schema:InfectiousAgentClass\"\n    },\n    \"InfectiousDisease\": {\n      \"@id\": \"schema:InfectiousDisease\"\n    },\n    \"InformAction\": {\n      \"@id\": \"schema:InformAction\"\n    },\n    \"IngredientsHealthAspect\": {\n      \"@id\": \"schema:IngredientsHealthAspect\"\n    },\n    \"InsertAction\": {\n      \"@id\": \"schema:InsertAction\"\n    },\n    \"InstallAction\": {\n      \"@id\": \"schema:InstallAction\"\n    },\n    \"Installment\": {\n      \"@id\": \"schema:Installment\"\n    },\n    \"InsuranceAgency\": {\n      \"@id\": \"schema:InsuranceAgency\"\n    },\n    \"Intangible\": {\n      \"@id\": \"schema:Intangible\"\n    },\n    \"Integer\": {\n      \"@id\": \"schema:Integer\"\n    },\n    \"InteractAction\": {\n      \"@id\": \"schema:InteractAction\"\n    },\n    \"InteractionCounter\": {\n      \"@id\": \"schema:InteractionCounter\"\n    },\n    \"InternationalTrial\": {\n      \"@id\": \"schema:InternationalTrial\"\n    },\n    \"InternetCafe\": {\n      \"@id\": \"schema:InternetCafe\"\n    },\n    \"InvestmentFund\": {\n      \"@id\": \"schema:InvestmentFund\"\n    },\n    \"InvestmentOrDeposit\": {\n      \"@id\": \"schema:InvestmentOrDeposit\"\n    },\n    \"InviteAction\": {\n      \"@id\": \"schema:InviteAction\"\n    },\n    \"Invoice\": {\n      \"@id\": \"schema:Invoice\"\n    },\n    \"InvoicePrice\": {\n      \"@id\": \"schema:InvoicePrice\"\n    },\n    \"ItemAvailability\": {\n      \"@id\": \"schema:ItemAvailability\"\n    },\n    \"ItemList\": {\n      \"@id\": \"schema:ItemList\"\n    },\n    \"ItemListOrderAscending\": {\n      \"@id\": \"schema:ItemListOrderAscending\"\n    },\n    \"ItemListOrderDescending\": {\n      \"@id\": \"schema:ItemListOrderDescending\"\n    },\n    \"ItemListOrderType\": {\n      \"@id\": \"schema:ItemListOrderType\"\n    },\n    \"ItemListUnordered\": {\n      \"@id\": \"schema:ItemListUnordered\"\n    },\n    \"ItemPage\": {\n      \"@id\": \"schema:ItemPage\"\n    },\n    \"JewelryStore\": {\n      \"@id\": \"schema:JewelryStore\"\n    },\n    \"JobPosting\": {\n      \"@id\": \"schema:JobPosting\"\n    },\n    \"JoinAction\": {\n      \"@id\": \"schema:JoinAction\"\n    },\n    \"Joint\": {\n      \"@id\": \"schema:Joint\"\n    },\n    \"KosherDiet\": {\n      \"@id\": \"schema:KosherDiet\"\n    },\n    \"LaboratoryScience\": {\n      \"@id\": \"schema:LaboratoryScience\"\n    },\n    \"LakeBodyOfWater\": {\n      \"@id\": \"schema:LakeBodyOfWater\"\n    },\n    \"Landform\": {\n      \"@id\": \"schema:Landform\"\n    },\n    \"LandmarksOrHistoricalBuildings\": {\n      \"@id\": \"schema:LandmarksOrHistoricalBuildings\"\n    },\n    \"Language\": {\n      \"@id\": \"schema:Language\"\n    },\n    \"LaserDiscFormat\": {\n      \"@id\": \"schema:LaserDiscFormat\"\n    },\n    \"LearningResource\": {\n      \"@id\": \"schema:LearningResource\"\n    },\n    \"LeaveAction\": {\n      \"@id\": \"schema:LeaveAction\"\n    },\n    \"LeftHandDriving\": {\n      \"@id\": \"schema:LeftHandDriving\"\n    },\n    \"LegalForceStatus\": {\n      \"@id\": \"schema:LegalForceStatus\"\n    },\n    \"LegalService\": {\n      \"@id\": \"schema:LegalService\"\n    },\n    \"LegalValueLevel\": {\n      \"@id\": \"schema:LegalValueLevel\"\n    },\n    \"Legislation\": {\n      \"@id\": \"schema:Legislation\"\n    },\n    \"LegislationObject\": {\n      \"@id\": \"schema:LegislationObject\"\n    },\n    \"LegislativeBuilding\": {\n      \"@id\": \"schema:LegislativeBuilding\"\n    },\n    \"LeisureTimeActivity\": {\n      \"@id\": \"schema:LeisureTimeActivity\"\n    },\n    \"LendAction\": {\n      \"@id\": \"schema:LendAction\"\n    },\n    \"Library\": {\n      \"@id\": \"schema:Library\"\n    },\n    \"LibrarySystem\": {\n      \"@id\": \"schema:LibrarySystem\"\n    },\n    \"LifestyleModification\": {\n      \"@id\": \"schema:LifestyleModification\"\n    },\n    \"Ligament\": {\n      \"@id\": \"schema:Ligament\"\n    },\n    \"LikeAction\": {\n      \"@id\": \"schema:LikeAction\"\n    },\n    \"LimitedAvailability\": {\n      \"@id\": \"schema:LimitedAvailability\"\n    },\n    \"LimitedByGuaranteeCharity\": {\n      \"@id\": \"schema:LimitedByGuaranteeCharity\"\n    },\n    \"LinkRole\": {\n      \"@id\": \"schema:LinkRole\"\n    },\n    \"LiquorStore\": {\n      \"@id\": \"schema:LiquorStore\"\n    },\n    \"ListItem\": {\n      \"@id\": \"schema:ListItem\"\n    },\n    \"ListPrice\": {\n      \"@id\": \"schema:ListPrice\"\n    },\n    \"ListenAction\": {\n      \"@id\": \"schema:ListenAction\"\n    },\n    \"LiteraryEvent\": {\n      \"@id\": \"schema:LiteraryEvent\"\n    },\n    \"LiveAlbum\": {\n      \"@id\": \"schema:LiveAlbum\"\n    },\n    \"LiveBlogPosting\": {\n      \"@id\": \"schema:LiveBlogPosting\"\n    },\n    \"LivingWithHealthAspect\": {\n      \"@id\": \"schema:LivingWithHealthAspect\"\n    },\n    \"LoanOrCredit\": {\n      \"@id\": \"schema:LoanOrCredit\"\n    },\n    \"LocalBusiness\": {\n      \"@id\": \"schema:LocalBusiness\"\n    },\n    \"LocationFeatureSpecification\": {\n      \"@id\": \"schema:LocationFeatureSpecification\"\n    },\n    \"LockerDelivery\": {\n      \"@id\": \"schema:LockerDelivery\"\n    },\n    \"Locksmith\": {\n      \"@id\": \"schema:Locksmith\"\n    },\n    \"LodgingBusiness\": {\n      \"@id\": \"schema:LodgingBusiness\"\n    },\n    \"LodgingReservation\": {\n      \"@id\": \"schema:LodgingReservation\"\n    },\n    \"Longitudinal\": {\n      \"@id\": \"schema:Longitudinal\"\n    },\n    \"LoseAction\": {\n      \"@id\": \"schema:LoseAction\"\n    },\n    \"LowCalorieDiet\": {\n      \"@id\": \"schema:LowCalorieDiet\"\n    },\n    \"LowFatDiet\": {\n      \"@id\": \"schema:LowFatDiet\"\n    },\n    \"LowLactoseDiet\": {\n      \"@id\": \"schema:LowLactoseDiet\"\n    },\n    \"LowSaltDiet\": {\n      \"@id\": \"schema:LowSaltDiet\"\n    },\n    \"Lung\": {\n      \"@id\": \"schema:Lung\"\n    },\n    \"LymphaticVessel\": {\n      \"@id\": \"schema:LymphaticVessel\"\n    },\n    \"MRI\": {\n      \"@id\": \"schema:MRI\"\n    },\n    \"MSRP\": {\n      \"@id\": \"schema:MSRP\"\n    },\n    \"Male\": {\n      \"@id\": \"schema:Male\"\n    },\n    \"Manuscript\": {\n      \"@id\": \"schema:Manuscript\"\n    },\n    \"Map\": {\n      \"@id\": \"schema:Map\"\n    },\n    \"MapCategoryType\": {\n      \"@id\": \"schema:MapCategoryType\"\n    },\n    \"MarryAction\": {\n      \"@id\": \"schema:MarryAction\"\n    },\n    \"Mass\": {\n      \"@id\": \"schema:Mass\"\n    },\n    \"MathSolver\": {\n      \"@id\": \"schema:MathSolver\"\n    },\n    \"MaximumDoseSchedule\": {\n      \"@id\": \"schema:MaximumDoseSchedule\"\n    },\n    \"MayTreatHealthAspect\": {\n      \"@id\": \"schema:MayTreatHealthAspect\"\n    },\n    \"MeasurementTypeEnumeration\": {\n      \"@id\": \"schema:MeasurementTypeEnumeration\"\n    },\n    \"MediaGallery\": {\n      \"@id\": \"schema:MediaGallery\"\n    },\n    \"MediaManipulationRatingEnumeration\": {\n      \"@id\": \"schema:MediaManipulationRatingEnumeration\"\n    },\n    \"MediaObject\": {\n      \"@id\": \"schema:MediaObject\"\n    },\n    \"MediaReview\": {\n      \"@id\": \"schema:MediaReview\"\n    },\n    \"MediaReviewItem\": {\n      \"@id\": \"schema:MediaReviewItem\"\n    },\n    \"MediaSubscription\": {\n      \"@id\": \"schema:MediaSubscription\"\n    },\n    \"MedicalAudience\": {\n      \"@id\": \"schema:MedicalAudience\"\n    },\n    \"MedicalAudienceType\": {\n      \"@id\": \"schema:MedicalAudienceType\"\n    },\n    \"MedicalBusiness\": {\n      \"@id\": \"schema:MedicalBusiness\"\n    },\n    \"MedicalCause\": {\n      \"@id\": \"schema:MedicalCause\"\n    },\n    \"MedicalClinic\": {\n      \"@id\": \"schema:MedicalClinic\"\n    },\n    \"MedicalCode\": {\n      \"@id\": \"schema:MedicalCode\"\n    },\n    \"MedicalCondition\": {\n      \"@id\": \"schema:MedicalCondition\"\n    },\n    \"MedicalConditionStage\": {\n      \"@id\": \"schema:MedicalConditionStage\"\n    },\n    \"MedicalContraindication\": {\n      \"@id\": \"schema:MedicalContraindication\"\n    },\n    \"MedicalDevice\": {\n      \"@id\": \"schema:MedicalDevice\"\n    },\n    \"MedicalDevicePurpose\": {\n      \"@id\": \"schema:MedicalDevicePurpose\"\n    },\n    \"MedicalEntity\": {\n      \"@id\": \"schema:MedicalEntity\"\n    },\n    \"MedicalEnumeration\": {\n      \"@id\": \"schema:MedicalEnumeration\"\n    },\n    \"MedicalEvidenceLevel\": {\n      \"@id\": \"schema:MedicalEvidenceLevel\"\n    },\n    \"MedicalGuideline\": {\n      \"@id\": \"schema:MedicalGuideline\"\n    },\n    \"MedicalGuidelineContraindication\": {\n      \"@id\": \"schema:MedicalGuidelineContraindication\"\n    },\n    \"MedicalGuidelineRecommendation\": {\n      \"@id\": \"schema:MedicalGuidelineRecommendation\"\n    },\n    \"MedicalImagingTechnique\": {\n      \"@id\": \"schema:MedicalImagingTechnique\"\n    },\n    \"MedicalIndication\": {\n      \"@id\": \"schema:MedicalIndication\"\n    },\n    \"MedicalIntangible\": {\n      \"@id\": \"schema:MedicalIntangible\"\n    },\n    \"MedicalObservationalStudy\": {\n      \"@id\": \"schema:MedicalObservationalStudy\"\n    },\n    \"MedicalObservationalStudyDesign\": {\n      \"@id\": \"schema:MedicalObservationalStudyDesign\"\n    },\n    \"MedicalOrganization\": {\n      \"@id\": \"schema:MedicalOrganization\"\n    },\n    \"MedicalProcedure\": {\n      \"@id\": \"schema:MedicalProcedure\"\n    },\n    \"MedicalProcedureType\": {\n      \"@id\": \"schema:MedicalProcedureType\"\n    },\n    \"MedicalResearcher\": {\n      \"@id\": \"schema:MedicalResearcher\"\n    },\n    \"MedicalRiskCalculator\": {\n      \"@id\": \"schema:MedicalRiskCalculator\"\n    },\n    \"MedicalRiskEstimator\": {\n      \"@id\": \"schema:MedicalRiskEstimator\"\n    },\n    \"MedicalRiskFactor\": {\n      \"@id\": \"schema:MedicalRiskFactor\"\n    },\n    \"MedicalRiskScore\": {\n      \"@id\": \"schema:MedicalRiskScore\"\n    },\n    \"MedicalScholarlyArticle\": {\n      \"@id\": \"schema:MedicalScholarlyArticle\"\n    },\n    \"MedicalSign\": {\n      \"@id\": \"schema:MedicalSign\"\n    },\n    \"MedicalSignOrSymptom\": {\n      \"@id\": \"schema:MedicalSignOrSymptom\"\n    },\n    \"MedicalSpecialty\": {\n      \"@id\": \"schema:MedicalSpecialty\"\n    },\n    \"MedicalStudy\": {\n      \"@id\": \"schema:MedicalStudy\"\n    },\n    \"MedicalStudyStatus\": {\n      \"@id\": \"schema:MedicalStudyStatus\"\n    },\n    \"MedicalSymptom\": {\n      \"@id\": \"schema:MedicalSymptom\"\n    },\n    \"MedicalTest\": {\n      \"@id\": \"schema:MedicalTest\"\n    },\n    \"MedicalTestPanel\": {\n      \"@id\": \"schema:MedicalTestPanel\"\n    },\n    \"MedicalTherapy\": {\n      \"@id\": \"schema:MedicalTherapy\"\n    },\n    \"MedicalTrial\": {\n      \"@id\": \"schema:MedicalTrial\"\n    },\n    \"MedicalTrialDesign\": {\n      \"@id\": \"schema:MedicalTrialDesign\"\n    },\n    \"MedicalWebPage\": {\n      \"@id\": \"schema:MedicalWebPage\"\n    },\n    \"MedicineSystem\": {\n      \"@id\": \"schema:MedicineSystem\"\n    },\n    \"MeetingRoom\": {\n      \"@id\": \"schema:MeetingRoom\"\n    },\n    \"MensClothingStore\": {\n      \"@id\": \"schema:MensClothingStore\"\n    },\n    \"Menu\": {\n      \"@id\": \"schema:Menu\"\n    },\n    \"MenuItem\": {\n      \"@id\": \"schema:MenuItem\"\n    },\n    \"MenuSection\": {\n      \"@id\": \"schema:MenuSection\"\n    },\n    \"MerchantReturnEnumeration\": {\n      \"@id\": \"schema:MerchantReturnEnumeration\"\n    },\n    \"MerchantReturnFiniteReturnWindow\": {\n      \"@id\": \"schema:MerchantReturnFiniteReturnWindow\"\n    },\n    \"MerchantReturnNotPermitted\": {\n      \"@id\": \"schema:MerchantReturnNotPermitted\"\n    },\n    \"MerchantReturnPolicy\": {\n      \"@id\": \"schema:MerchantReturnPolicy\"\n    },\n    \"MerchantReturnPolicySeasonalOverride\": {\n      \"@id\": \"schema:MerchantReturnPolicySeasonalOverride\"\n    },\n    \"MerchantReturnUnlimitedWindow\": {\n      \"@id\": \"schema:MerchantReturnUnlimitedWindow\"\n    },\n    \"MerchantReturnUnspecified\": {\n      \"@id\": \"schema:MerchantReturnUnspecified\"\n    },\n    \"Message\": {\n      \"@id\": \"schema:Message\"\n    },\n    \"MiddleSchool\": {\n      \"@id\": \"schema:MiddleSchool\"\n    },\n    \"Midwifery\": {\n      \"@id\": \"schema:Midwifery\"\n    },\n    \"MinimumAdvertisedPrice\": {\n      \"@id\": \"schema:MinimumAdvertisedPrice\"\n    },\n    \"MisconceptionsHealthAspect\": {\n      \"@id\": \"schema:MisconceptionsHealthAspect\"\n    },\n    \"MixedEventAttendanceMode\": {\n      \"@id\": \"schema:MixedEventAttendanceMode\"\n    },\n    \"MixtapeAlbum\": {\n      \"@id\": \"schema:MixtapeAlbum\"\n    },\n    \"MobileApplication\": {\n      \"@id\": \"schema:MobileApplication\"\n    },\n    \"MobilePhoneStore\": {\n      \"@id\": \"schema:MobilePhoneStore\"\n    },\n    \"MobileWebPlatform\": {\n      \"@id\": \"schema:MobileWebPlatform\"\n    },\n    \"MolecularEntity\": {\n      \"@id\": \"schema:MolecularEntity\"\n    },\n    \"Monday\": {\n      \"@id\": \"schema:Monday\"\n    },\n    \"MonetaryAmount\": {\n      \"@id\": \"schema:MonetaryAmount\"\n    },\n    \"MonetaryAmountDistribution\": {\n      \"@id\": \"schema:MonetaryAmountDistribution\"\n    },\n    \"MonetaryGrant\": {\n      \"@id\": \"schema:MonetaryGrant\"\n    },\n    \"MoneyTransfer\": {\n      \"@id\": \"schema:MoneyTransfer\"\n    },\n    \"MortgageLoan\": {\n      \"@id\": \"schema:MortgageLoan\"\n    },\n    \"Mosque\": {\n      \"@id\": \"schema:Mosque\"\n    },\n    \"Motel\": {\n      \"@id\": \"schema:Motel\"\n    },\n    \"Motorcycle\": {\n      \"@id\": \"schema:Motorcycle\"\n    },\n    \"MotorcycleDealer\": {\n      \"@id\": \"schema:MotorcycleDealer\"\n    },\n    \"MotorcycleRepair\": {\n      \"@id\": \"schema:MotorcycleRepair\"\n    },\n    \"MotorizedBicycle\": {\n      \"@id\": \"schema:MotorizedBicycle\"\n    },\n    \"Mountain\": {\n      \"@id\": \"schema:Mountain\"\n    },\n    \"MoveAction\": {\n      \"@id\": \"schema:MoveAction\"\n    },\n    \"Movie\": {\n      \"@id\": \"schema:Movie\"\n    },\n    \"MovieClip\": {\n      \"@id\": \"schema:MovieClip\"\n    },\n    \"MovieRentalStore\": {\n      \"@id\": \"schema:MovieRentalStore\"\n    },\n    \"MovieSeries\": {\n      \"@id\": \"schema:MovieSeries\"\n    },\n    \"MovieTheater\": {\n      \"@id\": \"schema:MovieTheater\"\n    },\n    \"MovingCompany\": {\n      \"@id\": \"schema:MovingCompany\"\n    },\n    \"MultiCenterTrial\": {\n      \"@id\": \"schema:MultiCenterTrial\"\n    },\n    \"MultiPlayer\": {\n      \"@id\": \"schema:MultiPlayer\"\n    },\n    \"MulticellularParasite\": {\n      \"@id\": \"schema:MulticellularParasite\"\n    },\n    \"Muscle\": {\n      \"@id\": \"schema:Muscle\"\n    },\n    \"Musculoskeletal\": {\n      \"@id\": \"schema:Musculoskeletal\"\n    },\n    \"MusculoskeletalExam\": {\n      \"@id\": \"schema:MusculoskeletalExam\"\n    },\n    \"Museum\": {\n      \"@id\": \"schema:Museum\"\n    },\n    \"MusicAlbum\": {\n      \"@id\": \"schema:MusicAlbum\"\n    },\n    \"MusicAlbumProductionType\": {\n      \"@id\": \"schema:MusicAlbumProductionType\"\n    },\n    \"MusicAlbumReleaseType\": {\n      \"@id\": \"schema:MusicAlbumReleaseType\"\n    },\n    \"MusicComposition\": {\n      \"@id\": \"schema:MusicComposition\"\n    },\n    \"MusicEvent\": {\n      \"@id\": \"schema:MusicEvent\"\n    },\n    \"MusicGroup\": {\n      \"@id\": \"schema:MusicGroup\"\n    },\n    \"MusicPlaylist\": {\n      \"@id\": \"schema:MusicPlaylist\"\n    },\n    \"MusicRecording\": {\n      \"@id\": \"schema:MusicRecording\"\n    },\n    \"MusicRelease\": {\n      \"@id\": \"schema:MusicRelease\"\n    },\n    \"MusicReleaseFormatType\": {\n      \"@id\": \"schema:MusicReleaseFormatType\"\n    },\n    \"MusicStore\": {\n      \"@id\": \"schema:MusicStore\"\n    },\n    \"MusicVenue\": {\n      \"@id\": \"schema:MusicVenue\"\n    },\n    \"MusicVideoObject\": {\n      \"@id\": \"schema:MusicVideoObject\"\n    },\n    \"NGO\": {\n      \"@id\": \"schema:NGO\"\n    },\n    \"NLNonprofitType\": {\n      \"@id\": \"schema:NLNonprofitType\"\n    },\n    \"NailSalon\": {\n      \"@id\": \"schema:NailSalon\"\n    },\n    \"NarcoticConsideration\": {\n      \"@id\": \"schema:NarcoticConsideration\"\n    },\n    \"Neck\": {\n      \"@id\": \"schema:Neck\"\n    },\n    \"Nerve\": {\n      \"@id\": \"schema:Nerve\"\n    },\n    \"Neuro\": {\n      \"@id\": \"schema:Neuro\"\n    },\n    \"Neurologic\": {\n      \"@id\": \"schema:Neurologic\"\n    },\n    \"NewCondition\": {\n      \"@id\": \"schema:NewCondition\"\n    },\n    \"NewsArticle\": {\n      \"@id\": \"schema:NewsArticle\"\n    },\n    \"NewsMediaOrganization\": {\n      \"@id\": \"schema:NewsMediaOrganization\"\n    },\n    \"Newspaper\": {\n      \"@id\": \"schema:Newspaper\"\n    },\n    \"NightClub\": {\n      \"@id\": \"schema:NightClub\"\n    },\n    \"NoninvasiveProcedure\": {\n      \"@id\": \"schema:NoninvasiveProcedure\"\n    },\n    \"Nonprofit501a\": {\n      \"@id\": \"schema:Nonprofit501a\"\n    },\n    \"Nonprofit501c1\": {\n      \"@id\": \"schema:Nonprofit501c1\"\n    },\n    \"Nonprofit501c10\": {\n      \"@id\": \"schema:Nonprofit501c10\"\n    },\n    \"Nonprofit501c11\": {\n      \"@id\": \"schema:Nonprofit501c11\"\n    },\n    \"Nonprofit501c12\": {\n      \"@id\": \"schema:Nonprofit501c12\"\n    },\n    \"Nonprofit501c13\": {\n      \"@id\": \"schema:Nonprofit501c13\"\n    },\n    \"Nonprofit501c14\": {\n      \"@id\": \"schema:Nonprofit501c14\"\n    },\n    \"Nonprofit501c15\": {\n      \"@id\": \"schema:Nonprofit501c15\"\n    },\n    \"Nonprofit501c16\": {\n      \"@id\": \"schema:Nonprofit501c16\"\n    },\n    \"Nonprofit501c17\": {\n      \"@id\": \"schema:Nonprofit501c17\"\n    },\n    \"Nonprofit501c18\": {\n      \"@id\": \"schema:Nonprofit501c18\"\n    },\n    \"Nonprofit501c19\": {\n      \"@id\": \"schema:Nonprofit501c19\"\n    },\n    \"Nonprofit501c2\": {\n      \"@id\": \"schema:Nonprofit501c2\"\n    },\n    \"Nonprofit501c20\": {\n      \"@id\": \"schema:Nonprofit501c20\"\n    },\n    \"Nonprofit501c21\": {\n      \"@id\": \"schema:Nonprofit501c21\"\n    },\n    \"Nonprofit501c22\": {\n      \"@id\": \"schema:Nonprofit501c22\"\n    },\n    \"Nonprofit501c23\": {\n      \"@id\": \"schema:Nonprofit501c23\"\n    },\n    \"Nonprofit501c24\": {\n      \"@id\": \"schema:Nonprofit501c24\"\n    },\n    \"Nonprofit501c25\": {\n      \"@id\": \"schema:Nonprofit501c25\"\n    },\n    \"Nonprofit501c26\": {\n      \"@id\": \"schema:Nonprofit501c26\"\n    },\n    \"Nonprofit501c27\": {\n      \"@id\": \"schema:Nonprofit501c27\"\n    },\n    \"Nonprofit501c28\": {\n      \"@id\": \"schema:Nonprofit501c28\"\n    },\n    \"Nonprofit501c3\": {\n      \"@id\": \"schema:Nonprofit501c3\"\n    },\n    \"Nonprofit501c4\": {\n      \"@id\": \"schema:Nonprofit501c4\"\n    },\n    \"Nonprofit501c5\": {\n      \"@id\": \"schema:Nonprofit501c5\"\n    },\n    \"Nonprofit501c6\": {\n      \"@id\": \"schema:Nonprofit501c6\"\n    },\n    \"Nonprofit501c7\": {\n      \"@id\": \"schema:Nonprofit501c7\"\n    },\n    \"Nonprofit501c8\": {\n      \"@id\": \"schema:Nonprofit501c8\"\n    },\n    \"Nonprofit501c9\": {\n      \"@id\": \"schema:Nonprofit501c9\"\n    },\n    \"Nonprofit501d\": {\n      \"@id\": \"schema:Nonprofit501d\"\n    },\n    \"Nonprofit501e\": {\n      \"@id\": \"schema:Nonprofit501e\"\n    },\n    \"Nonprofit501f\": {\n      \"@id\": \"schema:Nonprofit501f\"\n    },\n    \"Nonprofit501k\": {\n      \"@id\": \"schema:Nonprofit501k\"\n    },\n    \"Nonprofit501n\": {\n      \"@id\": \"schema:Nonprofit501n\"\n    },\n    \"Nonprofit501q\": {\n      \"@id\": \"schema:Nonprofit501q\"\n    },\n    \"Nonprofit527\": {\n      \"@id\": \"schema:Nonprofit527\"\n    },\n    \"NonprofitANBI\": {\n      \"@id\": \"schema:NonprofitANBI\"\n    },\n    \"NonprofitSBBI\": {\n      \"@id\": \"schema:NonprofitSBBI\"\n    },\n    \"NonprofitType\": {\n      \"@id\": \"schema:NonprofitType\"\n    },\n    \"Nose\": {\n      \"@id\": \"schema:Nose\"\n    },\n    \"NotInForce\": {\n      \"@id\": \"schema:NotInForce\"\n    },\n    \"NotYetRecruiting\": {\n      \"@id\": \"schema:NotYetRecruiting\"\n    },\n    \"Notary\": {\n      \"@id\": \"schema:Notary\"\n    },\n    \"NoteDigitalDocument\": {\n      \"@id\": \"schema:NoteDigitalDocument\"\n    },\n    \"Number\": {\n      \"@id\": \"schema:Number\"\n    },\n    \"Nursing\": {\n      \"@id\": \"schema:Nursing\"\n    },\n    \"NutritionInformation\": {\n      \"@id\": \"schema:NutritionInformation\"\n    },\n    \"OTC\": {\n      \"@id\": \"schema:OTC\"\n    },\n    \"Observation\": {\n      \"@id\": \"schema:Observation\"\n    },\n    \"Observational\": {\n      \"@id\": \"schema:Observational\"\n    },\n    \"Obstetric\": {\n      \"@id\": \"schema:Obstetric\"\n    },\n    \"Occupation\": {\n      \"@id\": \"schema:Occupation\"\n    },\n    \"OccupationalActivity\": {\n      \"@id\": \"schema:OccupationalActivity\"\n    },\n    \"OccupationalExperienceRequirements\": {\n      \"@id\": \"schema:OccupationalExperienceRequirements\"\n    },\n    \"OccupationalTherapy\": {\n      \"@id\": \"schema:OccupationalTherapy\"\n    },\n    \"OceanBodyOfWater\": {\n      \"@id\": \"schema:OceanBodyOfWater\"\n    },\n    \"Offer\": {\n      \"@id\": \"schema:Offer\"\n    },\n    \"OfferCatalog\": {\n      \"@id\": \"schema:OfferCatalog\"\n    },\n    \"OfferForLease\": {\n      \"@id\": \"schema:OfferForLease\"\n    },\n    \"OfferForPurchase\": {\n      \"@id\": \"schema:OfferForPurchase\"\n    },\n    \"OfferItemCondition\": {\n      \"@id\": \"schema:OfferItemCondition\"\n    },\n    \"OfferShippingDetails\": {\n      \"@id\": \"schema:OfferShippingDetails\"\n    },\n    \"OfficeEquipmentStore\": {\n      \"@id\": \"schema:OfficeEquipmentStore\"\n    },\n    \"OfficialLegalValue\": {\n      \"@id\": \"schema:OfficialLegalValue\"\n    },\n    \"OfflineEventAttendanceMode\": {\n      \"@id\": \"schema:OfflineEventAttendanceMode\"\n    },\n    \"OfflinePermanently\": {\n      \"@id\": \"schema:OfflinePermanently\"\n    },\n    \"OfflineTemporarily\": {\n      \"@id\": \"schema:OfflineTemporarily\"\n    },\n    \"OnDemandEvent\": {\n      \"@id\": \"schema:OnDemandEvent\"\n    },\n    \"OnSitePickup\": {\n      \"@id\": \"schema:OnSitePickup\"\n    },\n    \"Oncologic\": {\n      \"@id\": \"schema:Oncologic\"\n    },\n    \"OneTimePayments\": {\n      \"@id\": \"schema:OneTimePayments\"\n    },\n    \"Online\": {\n      \"@id\": \"schema:Online\"\n    },\n    \"OnlineBusiness\": {\n      \"@id\": \"schema:OnlineBusiness\"\n    },\n    \"OnlineEventAttendanceMode\": {\n      \"@id\": \"schema:OnlineEventAttendanceMode\"\n    },\n    \"OnlineFull\": {\n      \"@id\": \"schema:OnlineFull\"\n    },\n    \"OnlineOnly\": {\n      \"@id\": \"schema:OnlineOnly\"\n    },\n    \"OnlineStore\": {\n      \"@id\": \"schema:OnlineStore\"\n    },\n    \"OpenTrial\": {\n      \"@id\": \"schema:OpenTrial\"\n    },\n    \"OpeningHoursSpecification\": {\n      \"@id\": \"schema:OpeningHoursSpecification\"\n    },\n    \"OpinionNewsArticle\": {\n      \"@id\": \"schema:OpinionNewsArticle\"\n    },\n    \"Optician\": {\n      \"@id\": \"schema:Optician\"\n    },\n    \"Optometric\": {\n      \"@id\": \"schema:Optometric\"\n    },\n    \"Order\": {\n      \"@id\": \"schema:Order\"\n    },\n    \"OrderAction\": {\n      \"@id\": \"schema:OrderAction\"\n    },\n    \"OrderCancelled\": {\n      \"@id\": \"schema:OrderCancelled\"\n    },\n    \"OrderDelivered\": {\n      \"@id\": \"schema:OrderDelivered\"\n    },\n    \"OrderInTransit\": {\n      \"@id\": \"schema:OrderInTransit\"\n    },\n    \"OrderItem\": {\n      \"@id\": \"schema:OrderItem\"\n    },\n    \"OrderPaymentDue\": {\n      \"@id\": \"schema:OrderPaymentDue\"\n    },\n    \"OrderPickupAvailable\": {\n      \"@id\": \"schema:OrderPickupAvailable\"\n    },\n    \"OrderProblem\": {\n      \"@id\": \"schema:OrderProblem\"\n    },\n    \"OrderProcessing\": {\n      \"@id\": \"schema:OrderProcessing\"\n    },\n    \"OrderReturned\": {\n      \"@id\": \"schema:OrderReturned\"\n    },\n    \"OrderStatus\": {\n      \"@id\": \"schema:OrderStatus\"\n    },\n    \"Organization\": {\n      \"@id\": \"schema:Organization\"\n    },\n    \"OrganizationRole\": {\n      \"@id\": \"schema:OrganizationRole\"\n    },\n    \"OrganizeAction\": {\n      \"@id\": \"schema:OrganizeAction\"\n    },\n    \"OriginalMediaContent\": {\n      \"@id\": \"schema:OriginalMediaContent\"\n    },\n    \"OriginalShippingFees\": {\n      \"@id\": \"schema:OriginalShippingFees\"\n    },\n    \"Osteopathic\": {\n      \"@id\": \"schema:Osteopathic\"\n    },\n    \"Otolaryngologic\": {\n      \"@id\": \"schema:Otolaryngologic\"\n    },\n    \"OutOfStock\": {\n      \"@id\": \"schema:OutOfStock\"\n    },\n    \"OutletStore\": {\n      \"@id\": \"schema:OutletStore\"\n    },\n    \"OverviewHealthAspect\": {\n      \"@id\": \"schema:OverviewHealthAspect\"\n    },\n    \"OwnershipInfo\": {\n      \"@id\": \"schema:OwnershipInfo\"\n    },\n    \"PET\": {\n      \"@id\": \"schema:PET\"\n    },\n    \"PaidLeave\": {\n      \"@id\": \"schema:PaidLeave\"\n    },\n    \"PaintAction\": {\n      \"@id\": \"schema:PaintAction\"\n    },\n    \"Painting\": {\n      \"@id\": \"schema:Painting\"\n    },\n    \"PalliativeProcedure\": {\n      \"@id\": \"schema:PalliativeProcedure\"\n    },\n    \"Paperback\": {\n      \"@id\": \"schema:Paperback\"\n    },\n    \"ParcelDelivery\": {\n      \"@id\": \"schema:ParcelDelivery\"\n    },\n    \"ParcelService\": {\n      \"@id\": \"schema:ParcelService\"\n    },\n    \"ParentAudience\": {\n      \"@id\": \"schema:ParentAudience\"\n    },\n    \"ParentalSupport\": {\n      \"@id\": \"schema:ParentalSupport\"\n    },\n    \"Park\": {\n      \"@id\": \"schema:Park\"\n    },\n    \"ParkingFacility\": {\n      \"@id\": \"schema:ParkingFacility\"\n    },\n    \"ParkingMap\": {\n      \"@id\": \"schema:ParkingMap\"\n    },\n    \"PartiallyInForce\": {\n      \"@id\": \"schema:PartiallyInForce\"\n    },\n    \"Pathology\": {\n      \"@id\": \"schema:Pathology\"\n    },\n    \"PathologyTest\": {\n      \"@id\": \"schema:PathologyTest\"\n    },\n    \"Patient\": {\n      \"@id\": \"schema:Patient\"\n    },\n    \"PatientExperienceHealthAspect\": {\n      \"@id\": \"schema:PatientExperienceHealthAspect\"\n    },\n    \"PawnShop\": {\n      \"@id\": \"schema:PawnShop\"\n    },\n    \"PayAction\": {\n      \"@id\": \"schema:PayAction\"\n    },\n    \"PaymentAutomaticallyApplied\": {\n      \"@id\": \"schema:PaymentAutomaticallyApplied\"\n    },\n    \"PaymentCard\": {\n      \"@id\": \"schema:PaymentCard\"\n    },\n    \"PaymentChargeSpecification\": {\n      \"@id\": \"schema:PaymentChargeSpecification\"\n    },\n    \"PaymentComplete\": {\n      \"@id\": \"schema:PaymentComplete\"\n    },\n    \"PaymentDeclined\": {\n      \"@id\": \"schema:PaymentDeclined\"\n    },\n    \"PaymentDue\": {\n      \"@id\": \"schema:PaymentDue\"\n    },\n    \"PaymentMethod\": {\n      \"@id\": \"schema:PaymentMethod\"\n    },\n    \"PaymentPastDue\": {\n      \"@id\": \"schema:PaymentPastDue\"\n    },\n    \"PaymentService\": {\n      \"@id\": \"schema:PaymentService\"\n    },\n    \"PaymentStatusType\": {\n      \"@id\": \"schema:PaymentStatusType\"\n    },\n    \"Pediatric\": {\n      \"@id\": \"schema:Pediatric\"\n    },\n    \"PeopleAudience\": {\n      \"@id\": \"schema:PeopleAudience\"\n    },\n    \"PercutaneousProcedure\": {\n      \"@id\": \"schema:PercutaneousProcedure\"\n    },\n    \"PerformAction\": {\n      \"@id\": \"schema:PerformAction\"\n    },\n    \"PerformanceRole\": {\n      \"@id\": \"schema:PerformanceRole\"\n    },\n    \"PerformingArtsTheater\": {\n      \"@id\": \"schema:PerformingArtsTheater\"\n    },\n    \"PerformingGroup\": {\n      \"@id\": \"schema:PerformingGroup\"\n    },\n    \"Periodical\": {\n      \"@id\": \"schema:Periodical\"\n    },\n    \"Permit\": {\n      \"@id\": \"schema:Permit\"\n    },\n    \"Person\": {\n      \"@id\": \"schema:Person\"\n    },\n    \"PetStore\": {\n      \"@id\": \"schema:PetStore\"\n    },\n    \"Pharmacy\": {\n      \"@id\": \"schema:Pharmacy\"\n    },\n    \"PharmacySpecialty\": {\n      \"@id\": \"schema:PharmacySpecialty\"\n    },\n    \"Photograph\": {\n      \"@id\": \"schema:Photograph\"\n    },\n    \"PhotographAction\": {\n      \"@id\": \"schema:PhotographAction\"\n    },\n    \"PhysicalActivity\": {\n      \"@id\": \"schema:PhysicalActivity\"\n    },\n    \"PhysicalActivityCategory\": {\n      \"@id\": \"schema:PhysicalActivityCategory\"\n    },\n    \"PhysicalExam\": {\n      \"@id\": \"schema:PhysicalExam\"\n    },\n    \"PhysicalTherapy\": {\n      \"@id\": \"schema:PhysicalTherapy\"\n    },\n    \"Physician\": {\n      \"@id\": \"schema:Physician\"\n    },\n    \"Physiotherapy\": {\n      \"@id\": \"schema:Physiotherapy\"\n    },\n    \"Place\": {\n      \"@id\": \"schema:Place\"\n    },\n    \"PlaceOfWorship\": {\n      \"@id\": \"schema:PlaceOfWorship\"\n    },\n    \"PlaceboControlledTrial\": {\n      \"@id\": \"schema:PlaceboControlledTrial\"\n    },\n    \"PlanAction\": {\n      \"@id\": \"schema:PlanAction\"\n    },\n    \"PlasticSurgery\": {\n      \"@id\": \"schema:PlasticSurgery\"\n    },\n    \"Play\": {\n      \"@id\": \"schema:Play\"\n    },\n    \"PlayAction\": {\n      \"@id\": \"schema:PlayAction\"\n    },\n    \"PlayGameAction\": {\n      \"@id\": \"schema:PlayGameAction\"\n    },\n    \"Playground\": {\n      \"@id\": \"schema:Playground\"\n    },\n    \"Plumber\": {\n      \"@id\": \"schema:Plumber\"\n    },\n    \"PodcastEpisode\": {\n      \"@id\": \"schema:PodcastEpisode\"\n    },\n    \"PodcastSeason\": {\n      \"@id\": \"schema:PodcastSeason\"\n    },\n    \"PodcastSeries\": {\n      \"@id\": \"schema:PodcastSeries\"\n    },\n    \"Podiatric\": {\n      \"@id\": \"schema:Podiatric\"\n    },\n    \"PoliceStation\": {\n      \"@id\": \"schema:PoliceStation\"\n    },\n    \"Pond\": {\n      \"@id\": \"schema:Pond\"\n    },\n    \"PostOffice\": {\n      \"@id\": \"schema:PostOffice\"\n    },\n    \"PostalAddress\": {\n      \"@id\": \"schema:PostalAddress\"\n    },\n    \"PostalCodeRangeSpecification\": {\n      \"@id\": \"schema:PostalCodeRangeSpecification\"\n    },\n    \"Poster\": {\n      \"@id\": \"schema:Poster\"\n    },\n    \"PotentialActionStatus\": {\n      \"@id\": \"schema:PotentialActionStatus\"\n    },\n    \"PreOrder\": {\n      \"@id\": \"schema:PreOrder\"\n    },\n    \"PreOrderAction\": {\n      \"@id\": \"schema:PreOrderAction\"\n    },\n    \"PreSale\": {\n      \"@id\": \"schema:PreSale\"\n    },\n    \"PregnancyHealthAspect\": {\n      \"@id\": \"schema:PregnancyHealthAspect\"\n    },\n    \"PrependAction\": {\n      \"@id\": \"schema:PrependAction\"\n    },\n    \"Preschool\": {\n      \"@id\": \"schema:Preschool\"\n    },\n    \"PrescriptionOnly\": {\n      \"@id\": \"schema:PrescriptionOnly\"\n    },\n    \"PresentationDigitalDocument\": {\n      \"@id\": \"schema:PresentationDigitalDocument\"\n    },\n    \"PreventionHealthAspect\": {\n      \"@id\": \"schema:PreventionHealthAspect\"\n    },\n    \"PreventionIndication\": {\n      \"@id\": \"schema:PreventionIndication\"\n    },\n    \"PriceComponentTypeEnumeration\": {\n      \"@id\": \"schema:PriceComponentTypeEnumeration\"\n    },\n    \"PriceSpecification\": {\n      \"@id\": \"schema:PriceSpecification\"\n    },\n    \"PriceTypeEnumeration\": {\n      \"@id\": \"schema:PriceTypeEnumeration\"\n    },\n    \"PrimaryCare\": {\n      \"@id\": \"schema:PrimaryCare\"\n    },\n    \"Prion\": {\n      \"@id\": \"schema:Prion\"\n    },\n    \"Product\": {\n      \"@id\": \"schema:Product\"\n    },\n    \"ProductCollection\": {\n      \"@id\": \"schema:ProductCollection\"\n    },\n    \"ProductGroup\": {\n      \"@id\": \"schema:ProductGroup\"\n    },\n    \"ProductModel\": {\n      \"@id\": \"schema:ProductModel\"\n    },\n    \"ProductReturnEnumeration\": {\n      \"@id\": \"schema:ProductReturnEnumeration\"\n    },\n    \"ProductReturnFiniteReturnWindow\": {\n      \"@id\": \"schema:ProductReturnFiniteReturnWindow\"\n    },\n    \"ProductReturnNotPermitted\": {\n      \"@id\": \"schema:ProductReturnNotPermitted\"\n    },\n    \"ProductReturnPolicy\": {\n      \"@id\": \"schema:ProductReturnPolicy\"\n    },\n    \"ProductReturnUnlimitedWindow\": {\n      \"@id\": \"schema:ProductReturnUnlimitedWindow\"\n    },\n    \"ProductReturnUnspecified\": {\n      \"@id\": \"schema:ProductReturnUnspecified\"\n    },\n    \"ProfessionalService\": {\n      \"@id\": \"schema:ProfessionalService\"\n    },\n    \"ProfilePage\": {\n      \"@id\": \"schema:ProfilePage\"\n    },\n    \"PrognosisHealthAspect\": {\n      \"@id\": \"schema:PrognosisHealthAspect\"\n    },\n    \"ProgramMembership\": {\n      \"@id\": \"schema:ProgramMembership\"\n    },\n    \"Project\": {\n      \"@id\": \"schema:Project\"\n    },\n    \"PronounceableText\": {\n      \"@id\": \"schema:PronounceableText\"\n    },\n    \"Property\": {\n      \"@id\": \"schema:Property\"\n    },\n    \"PropertyValue\": {\n      \"@id\": \"schema:PropertyValue\"\n    },\n    \"PropertyValueSpecification\": {\n      \"@id\": \"schema:PropertyValueSpecification\"\n    },\n    \"Protein\": {\n      \"@id\": \"schema:Protein\"\n    },\n    \"Protozoa\": {\n      \"@id\": \"schema:Protozoa\"\n    },\n    \"Psychiatric\": {\n      \"@id\": \"schema:Psychiatric\"\n    },\n    \"PsychologicalTreatment\": {\n      \"@id\": \"schema:PsychologicalTreatment\"\n    },\n    \"PublicHealth\": {\n      \"@id\": \"schema:PublicHealth\"\n    },\n    \"PublicHolidays\": {\n      \"@id\": \"schema:PublicHolidays\"\n    },\n    \"PublicSwimmingPool\": {\n      \"@id\": \"schema:PublicSwimmingPool\"\n    },\n    \"PublicToilet\": {\n      \"@id\": \"schema:PublicToilet\"\n    },\n    \"PublicationEvent\": {\n      \"@id\": \"schema:PublicationEvent\"\n    },\n    \"PublicationIssue\": {\n      \"@id\": \"schema:PublicationIssue\"\n    },\n    \"PublicationVolume\": {\n      \"@id\": \"schema:PublicationVolume\"\n    },\n    \"Pulmonary\": {\n      \"@id\": \"schema:Pulmonary\"\n    },\n    \"QAPage\": {\n      \"@id\": \"schema:QAPage\"\n    },\n    \"QualitativeValue\": {\n      \"@id\": \"schema:QualitativeValue\"\n    },\n    \"QuantitativeValue\": {\n      \"@id\": \"schema:QuantitativeValue\"\n    },\n    \"QuantitativeValueDistribution\": {\n      \"@id\": \"schema:QuantitativeValueDistribution\"\n    },\n    \"Quantity\": {\n      \"@id\": \"schema:Quantity\"\n    },\n    \"Question\": {\n      \"@id\": \"schema:Question\"\n    },\n    \"Quiz\": {\n      \"@id\": \"schema:Quiz\"\n    },\n    \"Quotation\": {\n      \"@id\": \"schema:Quotation\"\n    },\n    \"QuoteAction\": {\n      \"@id\": \"schema:QuoteAction\"\n    },\n    \"RVPark\": {\n      \"@id\": \"schema:RVPark\"\n    },\n    \"RadiationTherapy\": {\n      \"@id\": \"schema:RadiationTherapy\"\n    },\n    \"RadioBroadcastService\": {\n      \"@id\": \"schema:RadioBroadcastService\"\n    },\n    \"RadioChannel\": {\n      \"@id\": \"schema:RadioChannel\"\n    },\n    \"RadioClip\": {\n      \"@id\": \"schema:RadioClip\"\n    },\n    \"RadioEpisode\": {\n      \"@id\": \"schema:RadioEpisode\"\n    },\n    \"RadioSeason\": {\n      \"@id\": \"schema:RadioSeason\"\n    },\n    \"RadioSeries\": {\n      \"@id\": \"schema:RadioSeries\"\n    },\n    \"RadioStation\": {\n      \"@id\": \"schema:RadioStation\"\n    },\n    \"Radiography\": {\n      \"@id\": \"schema:Radiography\"\n    },\n    \"RandomizedTrial\": {\n      \"@id\": \"schema:RandomizedTrial\"\n    },\n    \"Rating\": {\n      \"@id\": \"schema:Rating\"\n    },\n    \"ReactAction\": {\n      \"@id\": \"schema:ReactAction\"\n    },\n    \"ReadAction\": {\n      \"@id\": \"schema:ReadAction\"\n    },\n    \"ReadPermission\": {\n      \"@id\": \"schema:ReadPermission\"\n    },\n    \"RealEstateAgent\": {\n      \"@id\": \"schema:RealEstateAgent\"\n    },\n    \"RealEstateListing\": {\n      \"@id\": \"schema:RealEstateListing\"\n    },\n    \"RearWheelDriveConfiguration\": {\n      \"@id\": \"schema:RearWheelDriveConfiguration\"\n    },\n    \"ReceiveAction\": {\n      \"@id\": \"schema:ReceiveAction\"\n    },\n    \"Recipe\": {\n      \"@id\": \"schema:Recipe\"\n    },\n    \"Recommendation\": {\n      \"@id\": \"schema:Recommendation\"\n    },\n    \"RecommendedDoseSchedule\": {\n      \"@id\": \"schema:RecommendedDoseSchedule\"\n    },\n    \"Recruiting\": {\n      \"@id\": \"schema:Recruiting\"\n    },\n    \"RecyclingCenter\": {\n      \"@id\": \"schema:RecyclingCenter\"\n    },\n    \"ReducedRelevanceForChildrenConsideration\": {\n      \"@id\": \"schema:ReducedRelevanceForChildrenConsideration\"\n    },\n    \"RefundTypeEnumeration\": {\n      \"@id\": \"schema:RefundTypeEnumeration\"\n    },\n    \"RefurbishedCondition\": {\n      \"@id\": \"schema:RefurbishedCondition\"\n    },\n    \"RegisterAction\": {\n      \"@id\": \"schema:RegisterAction\"\n    },\n    \"Registry\": {\n      \"@id\": \"schema:Registry\"\n    },\n    \"ReimbursementCap\": {\n      \"@id\": \"schema:ReimbursementCap\"\n    },\n    \"RejectAction\": {\n      \"@id\": \"schema:RejectAction\"\n    },\n    \"RelatedTopicsHealthAspect\": {\n      \"@id\": \"schema:RelatedTopicsHealthAspect\"\n    },\n    \"RemixAlbum\": {\n      \"@id\": \"schema:RemixAlbum\"\n    },\n    \"Renal\": {\n      \"@id\": \"schema:Renal\"\n    },\n    \"RentAction\": {\n      \"@id\": \"schema:RentAction\"\n    },\n    \"RentalCarReservation\": {\n      \"@id\": \"schema:RentalCarReservation\"\n    },\n    \"RentalVehicleUsage\": {\n      \"@id\": \"schema:RentalVehicleUsage\"\n    },\n    \"RepaymentSpecification\": {\n      \"@id\": \"schema:RepaymentSpecification\"\n    },\n    \"ReplaceAction\": {\n      \"@id\": \"schema:ReplaceAction\"\n    },\n    \"ReplyAction\": {\n      \"@id\": \"schema:ReplyAction\"\n    },\n    \"Report\": {\n      \"@id\": \"schema:Report\"\n    },\n    \"ReportageNewsArticle\": {\n      \"@id\": \"schema:ReportageNewsArticle\"\n    },\n    \"ReportedDoseSchedule\": {\n      \"@id\": \"schema:ReportedDoseSchedule\"\n    },\n    \"ResearchOrganization\": {\n      \"@id\": \"schema:ResearchOrganization\"\n    },\n    \"ResearchProject\": {\n      \"@id\": \"schema:ResearchProject\"\n    },\n    \"Researcher\": {\n      \"@id\": \"schema:Researcher\"\n    },\n    \"Reservation\": {\n      \"@id\": \"schema:Reservation\"\n    },\n    \"ReservationCancelled\": {\n      \"@id\": \"schema:ReservationCancelled\"\n    },\n    \"ReservationConfirmed\": {\n      \"@id\": \"schema:ReservationConfirmed\"\n    },\n    \"ReservationHold\": {\n      \"@id\": \"schema:ReservationHold\"\n    },\n    \"ReservationPackage\": {\n      \"@id\": \"schema:ReservationPackage\"\n    },\n    \"ReservationPending\": {\n      \"@id\": \"schema:ReservationPending\"\n    },\n    \"ReservationStatusType\": {\n      \"@id\": \"schema:ReservationStatusType\"\n    },\n    \"ReserveAction\": {\n      \"@id\": \"schema:ReserveAction\"\n    },\n    \"Reservoir\": {\n      \"@id\": \"schema:Reservoir\"\n    },\n    \"Residence\": {\n      \"@id\": \"schema:Residence\"\n    },\n    \"Resort\": {\n      \"@id\": \"schema:Resort\"\n    },\n    \"RespiratoryTherapy\": {\n      \"@id\": \"schema:RespiratoryTherapy\"\n    },\n    \"Restaurant\": {\n      \"@id\": \"schema:Restaurant\"\n    },\n    \"RestockingFees\": {\n      \"@id\": \"schema:RestockingFees\"\n    },\n    \"RestrictedDiet\": {\n      \"@id\": \"schema:RestrictedDiet\"\n    },\n    \"ResultsAvailable\": {\n      \"@id\": \"schema:ResultsAvailable\"\n    },\n    \"ResultsNotAvailable\": {\n      \"@id\": \"schema:ResultsNotAvailable\"\n    },\n    \"ResumeAction\": {\n      \"@id\": \"schema:ResumeAction\"\n    },\n    \"Retail\": {\n      \"@id\": \"schema:Retail\"\n    },\n    \"ReturnAction\": {\n      \"@id\": \"schema:ReturnAction\"\n    },\n    \"ReturnAtKiosk\": {\n      \"@id\": \"schema:ReturnAtKiosk\"\n    },\n    \"ReturnByMail\": {\n      \"@id\": \"schema:ReturnByMail\"\n    },\n    \"ReturnFeesCustomerResponsibility\": {\n      \"@id\": \"schema:ReturnFeesCustomerResponsibility\"\n    },\n    \"ReturnFeesEnumeration\": {\n      \"@id\": \"schema:ReturnFeesEnumeration\"\n    },\n    \"ReturnInStore\": {\n      \"@id\": \"schema:ReturnInStore\"\n    },\n    \"ReturnLabelCustomerResponsibility\": {\n      \"@id\": \"schema:ReturnLabelCustomerResponsibility\"\n    },\n    \"ReturnLabelDownloadAndPrint\": {\n      \"@id\": \"schema:ReturnLabelDownloadAndPrint\"\n    },\n    \"ReturnLabelInBox\": {\n      \"@id\": \"schema:ReturnLabelInBox\"\n    },\n    \"ReturnLabelSourceEnumeration\": {\n      \"@id\": \"schema:ReturnLabelSourceEnumeration\"\n    },\n    \"ReturnMethodEnumeration\": {\n      \"@id\": \"schema:ReturnMethodEnumeration\"\n    },\n    \"ReturnShippingFees\": {\n      \"@id\": \"schema:ReturnShippingFees\"\n    },\n    \"Review\": {\n      \"@id\": \"schema:Review\"\n    },\n    \"ReviewAction\": {\n      \"@id\": \"schema:ReviewAction\"\n    },\n    \"ReviewNewsArticle\": {\n      \"@id\": \"schema:ReviewNewsArticle\"\n    },\n    \"Rheumatologic\": {\n      \"@id\": \"schema:Rheumatologic\"\n    },\n    \"RightHandDriving\": {\n      \"@id\": \"schema:RightHandDriving\"\n    },\n    \"RisksOrComplicationsHealthAspect\": {\n      \"@id\": \"schema:RisksOrComplicationsHealthAspect\"\n    },\n    \"RiverBodyOfWater\": {\n      \"@id\": \"schema:RiverBodyOfWater\"\n    },\n    \"Role\": {\n      \"@id\": \"schema:Role\"\n    },\n    \"RoofingContractor\": {\n      \"@id\": \"schema:RoofingContractor\"\n    },\n    \"Room\": {\n      \"@id\": \"schema:Room\"\n    },\n    \"RsvpAction\": {\n      \"@id\": \"schema:RsvpAction\"\n    },\n    \"RsvpResponseMaybe\": {\n      \"@id\": \"schema:RsvpResponseMaybe\"\n    },\n    \"RsvpResponseNo\": {\n      \"@id\": \"schema:RsvpResponseNo\"\n    },\n    \"RsvpResponseType\": {\n      \"@id\": \"schema:RsvpResponseType\"\n    },\n    \"RsvpResponseYes\": {\n      \"@id\": \"schema:RsvpResponseYes\"\n    },\n    \"SRP\": {\n      \"@id\": \"schema:SRP\"\n    },\n    \"SafetyHealthAspect\": {\n      \"@id\": \"schema:SafetyHealthAspect\"\n    },\n    \"SaleEvent\": {\n      \"@id\": \"schema:SaleEvent\"\n    },\n    \"SalePrice\": {\n      \"@id\": \"schema:SalePrice\"\n    },\n    \"SatireOrParodyContent\": {\n      \"@id\": \"schema:SatireOrParodyContent\"\n    },\n    \"SatiricalArticle\": {\n      \"@id\": \"schema:SatiricalArticle\"\n    },\n    \"Saturday\": {\n      \"@id\": \"schema:Saturday\"\n    },\n    \"Schedule\": {\n      \"@id\": \"schema:Schedule\"\n    },\n    \"ScheduleAction\": {\n      \"@id\": \"schema:ScheduleAction\"\n    },\n    \"ScholarlyArticle\": {\n      \"@id\": \"schema:ScholarlyArticle\"\n    },\n    \"School\": {\n      \"@id\": \"schema:School\"\n    },\n    \"SchoolDistrict\": {\n      \"@id\": \"schema:SchoolDistrict\"\n    },\n    \"ScreeningEvent\": {\n      \"@id\": \"schema:ScreeningEvent\"\n    },\n    \"ScreeningHealthAspect\": {\n      \"@id\": \"schema:ScreeningHealthAspect\"\n    },\n    \"Sculpture\": {\n      \"@id\": \"schema:Sculpture\"\n    },\n    \"SeaBodyOfWater\": {\n      \"@id\": \"schema:SeaBodyOfWater\"\n    },\n    \"SearchAction\": {\n      \"@id\": \"schema:SearchAction\"\n    },\n    \"SearchRescueOrganization\": {\n      \"@id\": \"schema:SearchRescueOrganization\"\n    },\n    \"SearchResultsPage\": {\n      \"@id\": \"schema:SearchResultsPage\"\n    },\n    \"Season\": {\n      \"@id\": \"schema:Season\"\n    },\n    \"Seat\": {\n      \"@id\": \"schema:Seat\"\n    },\n    \"SeatingMap\": {\n      \"@id\": \"schema:SeatingMap\"\n    },\n    \"SeeDoctorHealthAspect\": {\n      \"@id\": \"schema:SeeDoctorHealthAspect\"\n    },\n    \"SeekToAction\": {\n      \"@id\": \"schema:SeekToAction\"\n    },\n    \"SelfCareHealthAspect\": {\n      \"@id\": \"schema:SelfCareHealthAspect\"\n    },\n    \"SelfStorage\": {\n      \"@id\": \"schema:SelfStorage\"\n    },\n    \"SellAction\": {\n      \"@id\": \"schema:SellAction\"\n    },\n    \"SendAction\": {\n      \"@id\": \"schema:SendAction\"\n    },\n    \"Series\": {\n      \"@id\": \"schema:Series\"\n    },\n    \"Service\": {\n      \"@id\": \"schema:Service\"\n    },\n    \"ServiceChannel\": {\n      \"@id\": \"schema:ServiceChannel\"\n    },\n    \"SexualContentConsideration\": {\n      \"@id\": \"schema:SexualContentConsideration\"\n    },\n    \"ShareAction\": {\n      \"@id\": \"schema:ShareAction\"\n    },\n    \"SheetMusic\": {\n      \"@id\": \"schema:SheetMusic\"\n    },\n    \"ShippingDeliveryTime\": {\n      \"@id\": \"schema:ShippingDeliveryTime\"\n    },\n    \"ShippingRateSettings\": {\n      \"@id\": \"schema:ShippingRateSettings\"\n    },\n    \"ShoeStore\": {\n      \"@id\": \"schema:ShoeStore\"\n    },\n    \"ShoppingCenter\": {\n      \"@id\": \"schema:ShoppingCenter\"\n    },\n    \"ShortStory\": {\n      \"@id\": \"schema:ShortStory\"\n    },\n    \"SideEffectsHealthAspect\": {\n      \"@id\": \"schema:SideEffectsHealthAspect\"\n    },\n    \"SingleBlindedTrial\": {\n      \"@id\": \"schema:SingleBlindedTrial\"\n    },\n    \"SingleCenterTrial\": {\n      \"@id\": \"schema:SingleCenterTrial\"\n    },\n    \"SingleFamilyResidence\": {\n      \"@id\": \"schema:SingleFamilyResidence\"\n    },\n    \"SinglePlayer\": {\n      \"@id\": \"schema:SinglePlayer\"\n    },\n    \"SingleRelease\": {\n      \"@id\": \"schema:SingleRelease\"\n    },\n    \"SiteNavigationElement\": {\n      \"@id\": \"schema:SiteNavigationElement\"\n    },\n    \"SizeGroupEnumeration\": {\n      \"@id\": \"schema:SizeGroupEnumeration\"\n    },\n    \"SizeSpecification\": {\n      \"@id\": \"schema:SizeSpecification\"\n    },\n    \"SizeSystemEnumeration\": {\n      \"@id\": \"schema:SizeSystemEnumeration\"\n    },\n    \"SizeSystemImperial\": {\n      \"@id\": \"schema:SizeSystemImperial\"\n    },\n    \"SizeSystemMetric\": {\n      \"@id\": \"schema:SizeSystemMetric\"\n    },\n    \"SkiResort\": {\n      \"@id\": \"schema:SkiResort\"\n    },\n    \"Skin\": {\n      \"@id\": \"schema:Skin\"\n    },\n    \"SocialEvent\": {\n      \"@id\": \"schema:SocialEvent\"\n    },\n    \"SocialMediaPosting\": {\n      \"@id\": \"schema:SocialMediaPosting\"\n    },\n    \"SoftwareApplication\": {\n      \"@id\": \"schema:SoftwareApplication\"\n    },\n    \"SoftwareSourceCode\": {\n      \"@id\": \"schema:SoftwareSourceCode\"\n    },\n    \"SoldOut\": {\n      \"@id\": \"schema:SoldOut\"\n    },\n    \"SolveMathAction\": {\n      \"@id\": \"schema:SolveMathAction\"\n    },\n    \"SomeProducts\": {\n      \"@id\": \"schema:SomeProducts\"\n    },\n    \"SoundtrackAlbum\": {\n      \"@id\": \"schema:SoundtrackAlbum\"\n    },\n    \"SpeakableSpecification\": {\n      \"@id\": \"schema:SpeakableSpecification\"\n    },\n    \"SpecialAnnouncement\": {\n      \"@id\": \"schema:SpecialAnnouncement\"\n    },\n    \"Specialty\": {\n      \"@id\": \"schema:Specialty\"\n    },\n    \"SpeechPathology\": {\n      \"@id\": \"schema:SpeechPathology\"\n    },\n    \"SpokenWordAlbum\": {\n      \"@id\": \"schema:SpokenWordAlbum\"\n    },\n    \"SportingGoodsStore\": {\n      \"@id\": \"schema:SportingGoodsStore\"\n    },\n    \"SportsActivityLocation\": {\n      \"@id\": \"schema:SportsActivityLocation\"\n    },\n    \"SportsClub\": {\n      \"@id\": \"schema:SportsClub\"\n    },\n    \"SportsEvent\": {\n      \"@id\": \"schema:SportsEvent\"\n    },\n    \"SportsOrganization\": {\n      \"@id\": \"schema:SportsOrganization\"\n    },\n    \"SportsTeam\": {\n      \"@id\": \"schema:SportsTeam\"\n    },\n    \"SpreadsheetDigitalDocument\": {\n      \"@id\": \"schema:SpreadsheetDigitalDocument\"\n    },\n    \"StadiumOrArena\": {\n      \"@id\": \"schema:StadiumOrArena\"\n    },\n    \"StagedContent\": {\n      \"@id\": \"schema:StagedContent\"\n    },\n    \"StagesHealthAspect\": {\n      \"@id\": \"schema:StagesHealthAspect\"\n    },\n    \"State\": {\n      \"@id\": \"schema:State\"\n    },\n    \"Statement\": {\n      \"@id\": \"schema:Statement\"\n    },\n    \"StatisticalPopulation\": {\n      \"@id\": \"schema:StatisticalPopulation\"\n    },\n    \"StatusEnumeration\": {\n      \"@id\": \"schema:StatusEnumeration\"\n    },\n    \"SteeringPositionValue\": {\n      \"@id\": \"schema:SteeringPositionValue\"\n    },\n    \"Store\": {\n      \"@id\": \"schema:Store\"\n    },\n    \"StoreCreditRefund\": {\n      \"@id\": \"schema:StoreCreditRefund\"\n    },\n    \"StrengthTraining\": {\n      \"@id\": \"schema:StrengthTraining\"\n    },\n    \"StructuredValue\": {\n      \"@id\": \"schema:StructuredValue\"\n    },\n    \"StudioAlbum\": {\n      \"@id\": \"schema:StudioAlbum\"\n    },\n    \"StupidType\": {\n      \"@id\": \"schema:StupidType\"\n    },\n    \"SubscribeAction\": {\n      \"@id\": \"schema:SubscribeAction\"\n    },\n    \"Subscription\": {\n      \"@id\": \"schema:Subscription\"\n    },\n    \"Substance\": {\n      \"@id\": \"schema:Substance\"\n    },\n    \"SubwayStation\": {\n      \"@id\": \"schema:SubwayStation\"\n    },\n    \"Suite\": {\n      \"@id\": \"schema:Suite\"\n    },\n    \"Sunday\": {\n      \"@id\": \"schema:Sunday\"\n    },\n    \"SuperficialAnatomy\": {\n      \"@id\": \"schema:SuperficialAnatomy\"\n    },\n    \"Surgical\": {\n      \"@id\": \"schema:Surgical\"\n    },\n    \"SurgicalProcedure\": {\n      \"@id\": \"schema:SurgicalProcedure\"\n    },\n    \"SuspendAction\": {\n      \"@id\": \"schema:SuspendAction\"\n    },\n    \"Suspended\": {\n      \"@id\": \"schema:Suspended\"\n    },\n    \"SymptomsHealthAspect\": {\n      \"@id\": \"schema:SymptomsHealthAspect\"\n    },\n    \"Synagogue\": {\n      \"@id\": \"schema:Synagogue\"\n    },\n    \"TVClip\": {\n      \"@id\": \"schema:TVClip\"\n    },\n    \"TVEpisode\": {\n      \"@id\": \"schema:TVEpisode\"\n    },\n    \"TVSeason\": {\n      \"@id\": \"schema:TVSeason\"\n    },\n    \"TVSeries\": {\n      \"@id\": \"schema:TVSeries\"\n    },\n    \"Table\": {\n      \"@id\": \"schema:Table\"\n    },\n    \"TakeAction\": {\n      \"@id\": \"schema:TakeAction\"\n    },\n    \"TattooParlor\": {\n      \"@id\": \"schema:TattooParlor\"\n    },\n    \"Taxi\": {\n      \"@id\": \"schema:Taxi\"\n    },\n    \"TaxiReservation\": {\n      \"@id\": \"schema:TaxiReservation\"\n    },\n    \"TaxiService\": {\n      \"@id\": \"schema:TaxiService\"\n    },\n    \"TaxiStand\": {\n      \"@id\": \"schema:TaxiStand\"\n    },\n    \"TaxiVehicleUsage\": {\n      \"@id\": \"schema:TaxiVehicleUsage\"\n    },\n    \"Taxon\": {\n      \"@id\": \"schema:Taxon\"\n    },\n    \"TechArticle\": {\n      \"@id\": \"schema:TechArticle\"\n    },\n    \"TelevisionChannel\": {\n      \"@id\": \"schema:TelevisionChannel\"\n    },\n    \"TelevisionStation\": {\n      \"@id\": \"schema:TelevisionStation\"\n    },\n    \"TennisComplex\": {\n      \"@id\": \"schema:TennisComplex\"\n    },\n    \"Terminated\": {\n      \"@id\": \"schema:Terminated\"\n    },\n    \"Text\": {\n      \"@id\": \"schema:Text\"\n    },\n    \"TextDigitalDocument\": {\n      \"@id\": \"schema:TextDigitalDocument\"\n    },\n    \"TheaterEvent\": {\n      \"@id\": \"schema:TheaterEvent\"\n    },\n    \"TheaterGroup\": {\n      \"@id\": \"schema:TheaterGroup\"\n    },\n    \"Therapeutic\": {\n      \"@id\": \"schema:Therapeutic\"\n    },\n    \"TherapeuticProcedure\": {\n      \"@id\": \"schema:TherapeuticProcedure\"\n    },\n    \"Thesis\": {\n      \"@id\": \"schema:Thesis\"\n    },\n    \"Thing\": {\n      \"@id\": \"schema:Thing\"\n    },\n    \"Throat\": {\n      \"@id\": \"schema:Throat\"\n    },\n    \"Thursday\": {\n      \"@id\": \"schema:Thursday\"\n    },\n    \"Ticket\": {\n      \"@id\": \"schema:Ticket\"\n    },\n    \"TieAction\": {\n      \"@id\": \"schema:TieAction\"\n    },\n    \"Time\": {\n      \"@id\": \"schema:Time\"\n    },\n    \"TipAction\": {\n      \"@id\": \"schema:TipAction\"\n    },\n    \"TireShop\": {\n      \"@id\": \"schema:TireShop\"\n    },\n    \"TobaccoNicotineConsideration\": {\n      \"@id\": \"schema:TobaccoNicotineConsideration\"\n    },\n    \"TollFree\": {\n      \"@id\": \"schema:TollFree\"\n    },\n    \"TouristAttraction\": {\n      \"@id\": \"schema:TouristAttraction\"\n    },\n    \"TouristDestination\": {\n      \"@id\": \"schema:TouristDestination\"\n    },\n    \"TouristInformationCenter\": {\n      \"@id\": \"schema:TouristInformationCenter\"\n    },\n    \"TouristTrip\": {\n      \"@id\": \"schema:TouristTrip\"\n    },\n    \"Toxicologic\": {\n      \"@id\": \"schema:Toxicologic\"\n    },\n    \"ToyStore\": {\n      \"@id\": \"schema:ToyStore\"\n    },\n    \"TrackAction\": {\n      \"@id\": \"schema:TrackAction\"\n    },\n    \"TradeAction\": {\n      \"@id\": \"schema:TradeAction\"\n    },\n    \"TraditionalChinese\": {\n      \"@id\": \"schema:TraditionalChinese\"\n    },\n    \"TrainReservation\": {\n      \"@id\": \"schema:TrainReservation\"\n    },\n    \"TrainStation\": {\n      \"@id\": \"schema:TrainStation\"\n    },\n    \"TrainTrip\": {\n      \"@id\": \"schema:TrainTrip\"\n    },\n    \"TransferAction\": {\n      \"@id\": \"schema:TransferAction\"\n    },\n    \"TransformedContent\": {\n      \"@id\": \"schema:TransformedContent\"\n    },\n    \"TransitMap\": {\n      \"@id\": \"schema:TransitMap\"\n    },\n    \"TravelAction\": {\n      \"@id\": \"schema:TravelAction\"\n    },\n    \"TravelAgency\": {\n      \"@id\": \"schema:TravelAgency\"\n    },\n    \"TreatmentIndication\": {\n      \"@id\": \"schema:TreatmentIndication\"\n    },\n    \"TreatmentsHealthAspect\": {\n      \"@id\": \"schema:TreatmentsHealthAspect\"\n    },\n    \"Trip\": {\n      \"@id\": \"schema:Trip\"\n    },\n    \"TripleBlindedTrial\": {\n      \"@id\": \"schema:TripleBlindedTrial\"\n    },\n    \"True\": {\n      \"@id\": \"schema:True\"\n    },\n    \"Tuesday\": {\n      \"@id\": \"schema:Tuesday\"\n    },\n    \"TypeAndQuantityNode\": {\n      \"@id\": \"schema:TypeAndQuantityNode\"\n    },\n    \"TypesHealthAspect\": {\n      \"@id\": \"schema:TypesHealthAspect\"\n    },\n    \"UKNonprofitType\": {\n      \"@id\": \"schema:UKNonprofitType\"\n    },\n    \"UKTrust\": {\n      \"@id\": \"schema:UKTrust\"\n    },\n    \"URL\": {\n      \"@id\": \"schema:URL\"\n    },\n    \"USNonprofitType\": {\n      \"@id\": \"schema:USNonprofitType\"\n    },\n    \"Ultrasound\": {\n      \"@id\": \"schema:Ultrasound\"\n    },\n    \"UnRegisterAction\": {\n      \"@id\": \"schema:UnRegisterAction\"\n    },\n    \"UnclassifiedAdultConsideration\": {\n      \"@id\": \"schema:UnclassifiedAdultConsideration\"\n    },\n    \"UnemploymentSupport\": {\n      \"@id\": \"schema:UnemploymentSupport\"\n    },\n    \"UnincorporatedAssociationCharity\": {\n      \"@id\": \"schema:UnincorporatedAssociationCharity\"\n    },\n    \"UnitPriceSpecification\": {\n      \"@id\": \"schema:UnitPriceSpecification\"\n    },\n    \"UnofficialLegalValue\": {\n      \"@id\": \"schema:UnofficialLegalValue\"\n    },\n    \"UpdateAction\": {\n      \"@id\": \"schema:UpdateAction\"\n    },\n    \"Urologic\": {\n      \"@id\": \"schema:Urologic\"\n    },\n    \"UsageOrScheduleHealthAspect\": {\n      \"@id\": \"schema:UsageOrScheduleHealthAspect\"\n    },\n    \"UseAction\": {\n      \"@id\": \"schema:UseAction\"\n    },\n    \"UsedCondition\": {\n      \"@id\": \"schema:UsedCondition\"\n    },\n    \"UserBlocks\": {\n      \"@id\": \"schema:UserBlocks\"\n    },\n    \"UserCheckins\": {\n      \"@id\": \"schema:UserCheckins\"\n    },\n    \"UserComments\": {\n      \"@id\": \"schema:UserComments\"\n    },\n    \"UserDownloads\": {\n      \"@id\": \"schema:UserDownloads\"\n    },\n    \"UserInteraction\": {\n      \"@id\": \"schema:UserInteraction\"\n    },\n    \"UserLikes\": {\n      \"@id\": \"schema:UserLikes\"\n    },\n    \"UserPageVisits\": {\n      \"@id\": \"schema:UserPageVisits\"\n    },\n    \"UserPlays\": {\n      \"@id\": \"schema:UserPlays\"\n    },\n    \"UserPlusOnes\": {\n      \"@id\": \"schema:UserPlusOnes\"\n    },\n    \"UserReview\": {\n      \"@id\": \"schema:UserReview\"\n    },\n    \"UserTweets\": {\n      \"@id\": \"schema:UserTweets\"\n    },\n    \"VeganDiet\": {\n      \"@id\": \"schema:VeganDiet\"\n    },\n    \"VegetarianDiet\": {\n      \"@id\": \"schema:VegetarianDiet\"\n    },\n    \"Vehicle\": {\n      \"@id\": \"schema:Vehicle\"\n    },\n    \"Vein\": {\n      \"@id\": \"schema:Vein\"\n    },\n    \"VenueMap\": {\n      \"@id\": \"schema:VenueMap\"\n    },\n    \"Vessel\": {\n      \"@id\": \"schema:Vessel\"\n    },\n    \"VeterinaryCare\": {\n      \"@id\": \"schema:VeterinaryCare\"\n    },\n    \"VideoGallery\": {\n      \"@id\": \"schema:VideoGallery\"\n    },\n    \"VideoGame\": {\n      \"@id\": \"schema:VideoGame\"\n    },\n    \"VideoGameClip\": {\n      \"@id\": \"schema:VideoGameClip\"\n    },\n    \"VideoGameSeries\": {\n      \"@id\": \"schema:VideoGameSeries\"\n    },\n    \"VideoObject\": {\n      \"@id\": \"schema:VideoObject\"\n    },\n    \"VideoObjectSnapshot\": {\n      \"@id\": \"schema:VideoObjectSnapshot\"\n    },\n    \"ViewAction\": {\n      \"@id\": \"schema:ViewAction\"\n    },\n    \"VinylFormat\": {\n      \"@id\": \"schema:VinylFormat\"\n    },\n    \"ViolenceConsideration\": {\n      \"@id\": \"schema:ViolenceConsideration\"\n    },\n    \"VirtualLocation\": {\n      \"@id\": \"schema:VirtualLocation\"\n    },\n    \"Virus\": {\n      \"@id\": \"schema:Virus\"\n    },\n    \"VisualArtsEvent\": {\n      \"@id\": \"schema:VisualArtsEvent\"\n    },\n    \"VisualArtwork\": {\n      \"@id\": \"schema:VisualArtwork\"\n    },\n    \"VitalSign\": {\n      \"@id\": \"schema:VitalSign\"\n    },\n    \"Volcano\": {\n      \"@id\": \"schema:Volcano\"\n    },\n    \"VoteAction\": {\n      \"@id\": \"schema:VoteAction\"\n    },\n    \"WPAdBlock\": {\n      \"@id\": \"schema:WPAdBlock\"\n    },\n    \"WPFooter\": {\n      \"@id\": \"schema:WPFooter\"\n    },\n    \"WPHeader\": {\n      \"@id\": \"schema:WPHeader\"\n    },\n    \"WPSideBar\": {\n      \"@id\": \"schema:WPSideBar\"\n    },\n    \"WantAction\": {\n      \"@id\": \"schema:WantAction\"\n    },\n    \"WarrantyPromise\": {\n      \"@id\": \"schema:WarrantyPromise\"\n    },\n    \"WarrantyScope\": {\n      \"@id\": \"schema:WarrantyScope\"\n    },\n    \"WatchAction\": {\n      \"@id\": \"schema:WatchAction\"\n    },\n    \"Waterfall\": {\n      \"@id\": \"schema:Waterfall\"\n    },\n    \"WeaponConsideration\": {\n      \"@id\": \"schema:WeaponConsideration\"\n    },\n    \"WearAction\": {\n      \"@id\": \"schema:WearAction\"\n    },\n    \"WearableMeasurementBack\": {\n      \"@id\": \"schema:WearableMeasurementBack\"\n    },\n    \"WearableMeasurementChestOrBust\": {\n      \"@id\": \"schema:WearableMeasurementChestOrBust\"\n    },\n    \"WearableMeasurementCollar\": {\n      \"@id\": \"schema:WearableMeasurementCollar\"\n    },\n    \"WearableMeasurementCup\": {\n      \"@id\": \"schema:WearableMeasurementCup\"\n    },\n    \"WearableMeasurementHeight\": {\n      \"@id\": \"schema:WearableMeasurementHeight\"\n    },\n    \"WearableMeasurementHips\": {\n      \"@id\": \"schema:WearableMeasurementHips\"\n    },\n    \"WearableMeasurementInseam\": {\n      \"@id\": \"schema:WearableMeasurementInseam\"\n    },\n    \"WearableMeasurementLength\": {\n      \"@id\": \"schema:WearableMeasurementLength\"\n    },\n    \"WearableMeasurementOutsideLeg\": {\n      \"@id\": \"schema:WearableMeasurementOutsideLeg\"\n    },\n    \"WearableMeasurementSleeve\": {\n      \"@id\": \"schema:WearableMeasurementSleeve\"\n    },\n    \"WearableMeasurementTypeEnumeration\": {\n      \"@id\": \"schema:WearableMeasurementTypeEnumeration\"\n    },\n    \"WearableMeasurementWaist\": {\n      \"@id\": \"schema:WearableMeasurementWaist\"\n    },\n    \"WearableMeasurementWidth\": {\n      \"@id\": \"schema:WearableMeasurementWidth\"\n    },\n    \"WearableSizeGroupBig\": {\n      \"@id\": \"schema:WearableSizeGroupBig\"\n    },\n    \"WearableSizeGroupBoys\": {\n      \"@id\": \"schema:WearableSizeGroupBoys\"\n    },\n    \"WearableSizeGroupEnumeration\": {\n      \"@id\": \"schema:WearableSizeGroupEnumeration\"\n    },\n    \"WearableSizeGroupExtraShort\": {\n      \"@id\": \"schema:WearableSizeGroupExtraShort\"\n    },\n    \"WearableSizeGroupExtraTall\": {\n      \"@id\": \"schema:WearableSizeGroupExtraTall\"\n    },\n    \"WearableSizeGroupGirls\": {\n      \"@id\": \"schema:WearableSizeGroupGirls\"\n    },\n    \"WearableSizeGroupHusky\": {\n      \"@id\": \"schema:WearableSizeGroupHusky\"\n    },\n    \"WearableSizeGroupInfants\": {\n      \"@id\": \"schema:WearableSizeGroupInfants\"\n    },\n    \"WearableSizeGroupJuniors\": {\n      \"@id\": \"schema:WearableSizeGroupJuniors\"\n    },\n    \"WearableSizeGroupMaternity\": {\n      \"@id\": \"schema:WearableSizeGroupMaternity\"\n    },\n    \"WearableSizeGroupMens\": {\n      \"@id\": \"schema:WearableSizeGroupMens\"\n    },\n    \"WearableSizeGroupMisses\": {\n      \"@id\": \"schema:WearableSizeGroupMisses\"\n    },\n    \"WearableSizeGroupPetite\": {\n      \"@id\": \"schema:WearableSizeGroupPetite\"\n    },\n    \"WearableSizeGroupPlus\": {\n      \"@id\": \"schema:WearableSizeGroupPlus\"\n    },\n    \"WearableSizeGroupRegular\": {\n      \"@id\": \"schema:WearableSizeGroupRegular\"\n    },\n    \"WearableSizeGroupShort\": {\n      \"@id\": \"schema:WearableSizeGroupShort\"\n    },\n    \"WearableSizeGroupTall\": {\n      \"@id\": \"schema:WearableSizeGroupTall\"\n    },\n    \"WearableSizeGroupWomens\": {\n      \"@id\": \"schema:WearableSizeGroupWomens\"\n    },\n    \"WearableSizeSystemAU\": {\n      \"@id\": \"schema:WearableSizeSystemAU\"\n    },\n    \"WearableSizeSystemBR\": {\n      \"@id\": \"schema:WearableSizeSystemBR\"\n    },\n    \"WearableSizeSystemCN\": {\n      \"@id\": \"schema:WearableSizeSystemCN\"\n    },\n    \"WearableSizeSystemContinental\": {\n      \"@id\": \"schema:WearableSizeSystemContinental\"\n    },\n    \"WearableSizeSystemDE\": {\n      \"@id\": \"schema:WearableSizeSystemDE\"\n    },\n    \"WearableSizeSystemEN13402\": {\n      \"@id\": \"schema:WearableSizeSystemEN13402\"\n    },\n    \"WearableSizeSystemEnumeration\": {\n      \"@id\": \"schema:WearableSizeSystemEnumeration\"\n    },\n    \"WearableSizeSystemEurope\": {\n      \"@id\": \"schema:WearableSizeSystemEurope\"\n    },\n    \"WearableSizeSystemFR\": {\n      \"@id\": \"schema:WearableSizeSystemFR\"\n    },\n    \"WearableSizeSystemGS1\": {\n      \"@id\": \"schema:WearableSizeSystemGS1\"\n    },\n    \"WearableSizeSystemIT\": {\n      \"@id\": \"schema:WearableSizeSystemIT\"\n    },\n    \"WearableSizeSystemJP\": {\n      \"@id\": \"schema:WearableSizeSystemJP\"\n    },\n    \"WearableSizeSystemMX\": {\n      \"@id\": \"schema:WearableSizeSystemMX\"\n    },\n    \"WearableSizeSystemUK\": {\n      \"@id\": \"schema:WearableSizeSystemUK\"\n    },\n    \"WearableSizeSystemUS\": {\n      \"@id\": \"schema:WearableSizeSystemUS\"\n    },\n    \"WebAPI\": {\n      \"@id\": \"schema:WebAPI\"\n    },\n    \"WebApplication\": {\n      \"@id\": \"schema:WebApplication\"\n    },\n    \"WebContent\": {\n      \"@id\": \"schema:WebContent\"\n    },\n    \"WebPage\": {\n      \"@id\": \"schema:WebPage\"\n    },\n    \"WebPageElement\": {\n      \"@id\": \"schema:WebPageElement\"\n    },\n    \"WebSite\": {\n      \"@id\": \"schema:WebSite\"\n    },\n    \"Wednesday\": {\n      \"@id\": \"schema:Wednesday\"\n    },\n    \"WesternConventional\": {\n      \"@id\": \"schema:WesternConventional\"\n    },\n    \"Wholesale\": {\n      \"@id\": \"schema:Wholesale\"\n    },\n    \"WholesaleStore\": {\n      \"@id\": \"schema:WholesaleStore\"\n    },\n    \"WinAction\": {\n      \"@id\": \"schema:WinAction\"\n    },\n    \"Winery\": {\n      \"@id\": \"schema:Winery\"\n    },\n    \"Withdrawn\": {\n      \"@id\": \"schema:Withdrawn\"\n    },\n    \"WorkBasedProgram\": {\n      \"@id\": \"schema:WorkBasedProgram\"\n    },\n    \"WorkersUnion\": {\n      \"@id\": \"schema:WorkersUnion\"\n    },\n    \"WriteAction\": {\n      \"@id\": \"schema:WriteAction\"\n    },\n    \"WritePermission\": {\n      \"@id\": \"schema:WritePermission\"\n    },\n    \"XPathType\": {\n      \"@id\": \"schema:XPathType\"\n    },\n    \"XRay\": {\n      \"@id\": \"schema:XRay\"\n    },\n    \"ZoneBoardingPolicy\": {\n      \"@id\": \"schema:ZoneBoardingPolicy\"\n    },\n    \"Zoo\": {\n      \"@id\": \"schema:Zoo\"\n    },\n    \"about\": {\n      \"@id\": \"schema:about\"\n    },\n    \"abridged\": {\n      \"@id\": \"schema:abridged\"\n    },\n    \"abstract\": {\n      \"@id\": \"schema:abstract\"\n    },\n    \"accelerationTime\": {\n      \"@id\": \"schema:accelerationTime\"\n    },\n    \"acceptedAnswer\": {\n      \"@id\": \"schema:acceptedAnswer\"\n    },\n    \"acceptedOffer\": {\n      \"@id\": \"schema:acceptedOffer\"\n    },\n    \"acceptedPaymentMethod\": {\n      \"@id\": \"schema:acceptedPaymentMethod\"\n    },\n    \"acceptsReservations\": {\n      \"@id\": \"schema:acceptsReservations\"\n    },\n    \"accessCode\": {\n      \"@id\": \"schema:accessCode\"\n    },\n    \"accessMode\": {\n      \"@id\": \"schema:accessMode\"\n    },\n    \"accessModeSufficient\": {\n      \"@id\": \"schema:accessModeSufficient\"\n    },\n    \"accessibilityAPI\": {\n      \"@id\": \"schema:accessibilityAPI\"\n    },\n    \"accessibilityControl\": {\n      \"@id\": \"schema:accessibilityControl\"\n    },\n    \"accessibilityFeature\": {\n      \"@id\": \"schema:accessibilityFeature\"\n    },\n    \"accessibilityHazard\": {\n      \"@id\": \"schema:accessibilityHazard\"\n    },\n    \"accessibilitySummary\": {\n      \"@id\": \"schema:accessibilitySummary\"\n    },\n    \"accommodationCategory\": {\n      \"@id\": \"schema:accommodationCategory\"\n    },\n    \"accommodationFloorPlan\": {\n      \"@id\": \"schema:accommodationFloorPlan\"\n    },\n    \"accountId\": {\n      \"@id\": \"schema:accountId\"\n    },\n    \"accountMinimumInflow\": {\n      \"@id\": \"schema:accountMinimumInflow\"\n    },\n    \"accountOverdraftLimit\": {\n      \"@id\": \"schema:accountOverdraftLimit\"\n    },\n    \"accountablePerson\": {\n      \"@id\": \"schema:accountablePerson\"\n    },\n    \"acquireLicensePage\": {\n      \"@id\": \"schema:acquireLicensePage\",\n      \"@type\": \"@id\"\n    },\n    \"acquiredFrom\": {\n      \"@id\": \"schema:acquiredFrom\"\n    },\n    \"acrissCode\": {\n      \"@id\": \"schema:acrissCode\"\n    },\n    \"actionAccessibilityRequirement\": {\n      \"@id\": \"schema:actionAccessibilityRequirement\"\n    },\n    \"actionApplication\": {\n      \"@id\": \"schema:actionApplication\"\n    },\n    \"actionOption\": {\n      \"@id\": \"schema:actionOption\"\n    },\n    \"actionPlatform\": {\n      \"@id\": \"schema:actionPlatform\"\n    },\n    \"actionStatus\": {\n      \"@id\": \"schema:actionStatus\"\n    },\n    \"actionableFeedbackPolicy\": {\n      \"@id\": \"schema:actionableFeedbackPolicy\",\n      \"@type\": \"@id\"\n    },\n    \"activeIngredient\": {\n      \"@id\": \"schema:activeIngredient\"\n    },\n    \"activityDuration\": {\n      \"@id\": \"schema:activityDuration\"\n    },\n    \"activityFrequency\": {\n      \"@id\": \"schema:activityFrequency\"\n    },\n    \"actor\": {\n      \"@id\": \"schema:actor\"\n    },\n    \"actors\": {\n      \"@id\": \"schema:actors\"\n    },\n    \"addOn\": {\n      \"@id\": \"schema:addOn\"\n    },\n    \"additionalName\": {\n      \"@id\": \"schema:additionalName\"\n    },\n    \"additionalNumberOfGuests\": {\n      \"@id\": \"schema:additionalNumberOfGuests\"\n    },\n    \"additionalProperty\": {\n      \"@id\": \"schema:additionalProperty\"\n    },\n    \"additionalType\": {\n      \"@id\": \"schema:additionalType\",\n      \"@type\": \"@id\"\n    },\n    \"additionalVariable\": {\n      \"@id\": \"schema:additionalVariable\"\n    },\n    \"address\": {\n      \"@id\": \"schema:address\"\n    },\n    \"addressCountry\": {\n      \"@id\": \"schema:addressCountry\"\n    },\n    \"addressLocality\": {\n      \"@id\": \"schema:addressLocality\"\n    },\n    \"addressRegion\": {\n      \"@id\": \"schema:addressRegion\"\n    },\n    \"administrationRoute\": {\n      \"@id\": \"schema:administrationRoute\"\n    },\n    \"advanceBookingRequirement\": {\n      \"@id\": \"schema:advanceBookingRequirement\"\n    },\n    \"adverseOutcome\": {\n      \"@id\": \"schema:adverseOutcome\"\n    },\n    \"affectedBy\": {\n      \"@id\": \"schema:affectedBy\"\n    },\n    \"affiliation\": {\n      \"@id\": \"schema:affiliation\"\n    },\n    \"afterMedia\": {\n      \"@id\": \"schema:afterMedia\",\n      \"@type\": \"@id\"\n    },\n    \"agent\": {\n      \"@id\": \"schema:agent\"\n    },\n    \"aggregateRating\": {\n      \"@id\": \"schema:aggregateRating\"\n    },\n    \"aircraft\": {\n      \"@id\": \"schema:aircraft\"\n    },\n    \"album\": {\n      \"@id\": \"schema:album\"\n    },\n    \"albumProductionType\": {\n      \"@id\": \"schema:albumProductionType\"\n    },\n    \"albumRelease\": {\n      \"@id\": \"schema:albumRelease\"\n    },\n    \"albumReleaseType\": {\n      \"@id\": \"schema:albumReleaseType\"\n    },\n    \"albums\": {\n      \"@id\": \"schema:albums\"\n    },\n    \"alcoholWarning\": {\n      \"@id\": \"schema:alcoholWarning\"\n    },\n    \"algorithm\": {\n      \"@id\": \"schema:algorithm\"\n    },\n    \"alignmentType\": {\n      \"@id\": \"schema:alignmentType\"\n    },\n    \"alternateName\": {\n      \"@id\": \"schema:alternateName\"\n    },\n    \"alternativeHeadline\": {\n      \"@id\": \"schema:alternativeHeadline\"\n    },\n    \"alternativeOf\": {\n      \"@id\": \"schema:alternativeOf\"\n    },\n    \"alumni\": {\n      \"@id\": \"schema:alumni\"\n    },\n    \"alumniOf\": {\n      \"@id\": \"schema:alumniOf\"\n    },\n    \"amenityFeature\": {\n      \"@id\": \"schema:amenityFeature\"\n    },\n    \"amount\": {\n      \"@id\": \"schema:amount\"\n    },\n    \"amountOfThisGood\": {\n      \"@id\": \"schema:amountOfThisGood\"\n    },\n    \"announcementLocation\": {\n      \"@id\": \"schema:announcementLocation\"\n    },\n    \"annualPercentageRate\": {\n      \"@id\": \"schema:annualPercentageRate\"\n    },\n    \"answerCount\": {\n      \"@id\": \"schema:answerCount\"\n    },\n    \"answerExplanation\": {\n      \"@id\": \"schema:answerExplanation\"\n    },\n    \"antagonist\": {\n      \"@id\": \"schema:antagonist\"\n    },\n    \"appearance\": {\n      \"@id\": \"schema:appearance\"\n    },\n    \"applicableCountry\": {\n      \"@id\": \"schema:applicableCountry\"\n    },\n    \"applicableLocation\": {\n      \"@id\": \"schema:applicableLocation\"\n    },\n    \"applicantLocationRequirements\": {\n      \"@id\": \"schema:applicantLocationRequirements\"\n    },\n    \"application\": {\n      \"@id\": \"schema:application\"\n    },\n    \"applicationCategory\": {\n      \"@id\": \"schema:applicationCategory\"\n    },\n    \"applicationContact\": {\n      \"@id\": \"schema:applicationContact\"\n    },\n    \"applicationDeadline\": {\n      \"@id\": \"schema:applicationDeadline\",\n      \"@type\": \"Date\"\n    },\n    \"applicationStartDate\": {\n      \"@id\": \"schema:applicationStartDate\",\n      \"@type\": \"Date\"\n    },\n    \"applicationSubCategory\": {\n      \"@id\": \"schema:applicationSubCategory\"\n    },\n    \"applicationSuite\": {\n      \"@id\": \"schema:applicationSuite\"\n    },\n    \"appliesToDeliveryMethod\": {\n      \"@id\": \"schema:appliesToDeliveryMethod\"\n    },\n    \"appliesToPaymentMethod\": {\n      \"@id\": \"schema:appliesToPaymentMethod\"\n    },\n    \"archiveHeld\": {\n      \"@id\": \"schema:archiveHeld\"\n    },\n    \"archivedAt\": {\n      \"@id\": \"schema:archivedAt\",\n      \"@type\": \"@id\"\n    },\n    \"area\": {\n      \"@id\": \"schema:area\"\n    },\n    \"areaServed\": {\n      \"@id\": \"schema:areaServed\"\n    },\n    \"arrivalAirport\": {\n      \"@id\": \"schema:arrivalAirport\"\n    },\n    \"arrivalBoatTerminal\": {\n      \"@id\": \"schema:arrivalBoatTerminal\"\n    },\n    \"arrivalBusStop\": {\n      \"@id\": \"schema:arrivalBusStop\"\n    },\n    \"arrivalGate\": {\n      \"@id\": \"schema:arrivalGate\"\n    },\n    \"arrivalPlatform\": {\n      \"@id\": \"schema:arrivalPlatform\"\n    },\n    \"arrivalStation\": {\n      \"@id\": \"schema:arrivalStation\"\n    },\n    \"arrivalTerminal\": {\n      \"@id\": \"schema:arrivalTerminal\"\n    },\n    \"arrivalTime\": {\n      \"@id\": \"schema:arrivalTime\"\n    },\n    \"artEdition\": {\n      \"@id\": \"schema:artEdition\"\n    },\n    \"artMedium\": {\n      \"@id\": \"schema:artMedium\"\n    },\n    \"arterialBranch\": {\n      \"@id\": \"schema:arterialBranch\"\n    },\n    \"artform\": {\n      \"@id\": \"schema:artform\"\n    },\n    \"articleBody\": {\n      \"@id\": \"schema:articleBody\"\n    },\n    \"articleSection\": {\n      \"@id\": \"schema:articleSection\"\n    },\n    \"artist\": {\n      \"@id\": \"schema:artist\"\n    },\n    \"artworkSurface\": {\n      \"@id\": \"schema:artworkSurface\"\n    },\n    \"asin\": {\n      \"@id\": \"schema:asin\"\n    },\n    \"aspect\": {\n      \"@id\": \"schema:aspect\"\n    },\n    \"assembly\": {\n      \"@id\": \"schema:assembly\"\n    },\n    \"assemblyVersion\": {\n      \"@id\": \"schema:assemblyVersion\"\n    },\n    \"assesses\": {\n      \"@id\": \"schema:assesses\"\n    },\n    \"associatedAnatomy\": {\n      \"@id\": \"schema:associatedAnatomy\"\n    },\n    \"associatedArticle\": {\n      \"@id\": \"schema:associatedArticle\"\n    },\n    \"associatedClaimReview\": {\n      \"@id\": \"schema:associatedClaimReview\"\n    },\n    \"associatedDisease\": {\n      \"@id\": \"schema:associatedDisease\",\n      \"@type\": \"@id\"\n    },\n    \"associatedMedia\": {\n      \"@id\": \"schema:associatedMedia\"\n    },\n    \"associatedMediaReview\": {\n      \"@id\": \"schema:associatedMediaReview\"\n    },\n    \"associatedPathophysiology\": {\n      \"@id\": \"schema:associatedPathophysiology\"\n    },\n    \"associatedReview\": {\n      \"@id\": \"schema:associatedReview\"\n    },\n    \"athlete\": {\n      \"@id\": \"schema:athlete\"\n    },\n    \"attendee\": {\n      \"@id\": \"schema:attendee\"\n    },\n    \"attendees\": {\n      \"@id\": \"schema:attendees\"\n    },\n    \"audience\": {\n      \"@id\": \"schema:audience\"\n    },\n    \"audienceType\": {\n      \"@id\": \"schema:audienceType\"\n    },\n    \"audio\": {\n      \"@id\": \"schema:audio\"\n    },\n    \"authenticator\": {\n      \"@id\": \"schema:authenticator\"\n    },\n    \"author\": {\n      \"@id\": \"schema:author\"\n    },\n    \"availability\": {\n      \"@id\": \"schema:availability\"\n    },\n    \"availabilityEnds\": {\n      \"@id\": \"schema:availabilityEnds\",\n      \"@type\": \"Date\"\n    },\n    \"availabilityStarts\": {\n      \"@id\": \"schema:availabilityStarts\",\n      \"@type\": \"Date\"\n    },\n    \"availableAtOrFrom\": {\n      \"@id\": \"schema:availableAtOrFrom\"\n    },\n    \"availableChannel\": {\n      \"@id\": \"schema:availableChannel\"\n    },\n    \"availableDeliveryMethod\": {\n      \"@id\": \"schema:availableDeliveryMethod\"\n    },\n    \"availableFrom\": {\n      \"@id\": \"schema:availableFrom\"\n    },\n    \"availableIn\": {\n      \"@id\": \"schema:availableIn\"\n    },\n    \"availableLanguage\": {\n      \"@id\": \"schema:availableLanguage\"\n    },\n    \"availableOnDevice\": {\n      \"@id\": \"schema:availableOnDevice\"\n    },\n    \"availableService\": {\n      \"@id\": \"schema:availableService\"\n    },\n    \"availableStrength\": {\n      \"@id\": \"schema:availableStrength\"\n    },\n    \"availableTest\": {\n      \"@id\": \"schema:availableTest\"\n    },\n    \"availableThrough\": {\n      \"@id\": \"schema:availableThrough\"\n    },\n    \"award\": {\n      \"@id\": \"schema:award\"\n    },\n    \"awards\": {\n      \"@id\": \"schema:awards\"\n    },\n    \"awayTeam\": {\n      \"@id\": \"schema:awayTeam\"\n    },\n    \"backstory\": {\n      \"@id\": \"schema:backstory\"\n    },\n    \"bankAccountType\": {\n      \"@id\": \"schema:bankAccountType\"\n    },\n    \"baseSalary\": {\n      \"@id\": \"schema:baseSalary\"\n    },\n    \"bccRecipient\": {\n      \"@id\": \"schema:bccRecipient\"\n    },\n    \"bed\": {\n      \"@id\": \"schema:bed\"\n    },\n    \"beforeMedia\": {\n      \"@id\": \"schema:beforeMedia\",\n      \"@type\": \"@id\"\n    },\n    \"beneficiaryBank\": {\n      \"@id\": \"schema:beneficiaryBank\"\n    },\n    \"benefits\": {\n      \"@id\": \"schema:benefits\"\n    },\n    \"benefitsSummaryUrl\": {\n      \"@id\": \"schema:benefitsSummaryUrl\",\n      \"@type\": \"@id\"\n    },\n    \"bestRating\": {\n      \"@id\": \"schema:bestRating\"\n    },\n    \"billingAddress\": {\n      \"@id\": \"schema:billingAddress\"\n    },\n    \"billingDuration\": {\n      \"@id\": \"schema:billingDuration\"\n    },\n    \"billingIncrement\": {\n      \"@id\": \"schema:billingIncrement\"\n    },\n    \"billingPeriod\": {\n      \"@id\": \"schema:billingPeriod\"\n    },\n    \"billingStart\": {\n      \"@id\": \"schema:billingStart\"\n    },\n    \"bioChemInteraction\": {\n      \"@id\": \"schema:bioChemInteraction\"\n    },\n    \"bioChemSimilarity\": {\n      \"@id\": \"schema:bioChemSimilarity\"\n    },\n    \"biologicalRole\": {\n      \"@id\": \"schema:biologicalRole\"\n    },\n    \"biomechnicalClass\": {\n      \"@id\": \"schema:biomechnicalClass\"\n    },\n    \"birthDate\": {\n      \"@id\": \"schema:birthDate\",\n      \"@type\": \"Date\"\n    },\n    \"birthPlace\": {\n      \"@id\": \"schema:birthPlace\"\n    },\n    \"bitrate\": {\n      \"@id\": \"schema:bitrate\"\n    },\n    \"blogPost\": {\n      \"@id\": \"schema:blogPost\"\n    },\n    \"blogPosts\": {\n      \"@id\": \"schema:blogPosts\"\n    },\n    \"bloodSupply\": {\n      \"@id\": \"schema:bloodSupply\"\n    },\n    \"boardingGroup\": {\n      \"@id\": \"schema:boardingGroup\"\n    },\n    \"boardingPolicy\": {\n      \"@id\": \"schema:boardingPolicy\"\n    },\n    \"bodyLocation\": {\n      \"@id\": \"schema:bodyLocation\"\n    },\n    \"bodyType\": {\n      \"@id\": \"schema:bodyType\"\n    },\n    \"bookEdition\": {\n      \"@id\": \"schema:bookEdition\"\n    },\n    \"bookFormat\": {\n      \"@id\": \"schema:bookFormat\"\n    },\n    \"bookingAgent\": {\n      \"@id\": \"schema:bookingAgent\"\n    },\n    \"bookingTime\": {\n      \"@id\": \"schema:bookingTime\"\n    },\n    \"borrower\": {\n      \"@id\": \"schema:borrower\"\n    },\n    \"box\": {\n      \"@id\": \"schema:box\"\n    },\n    \"branch\": {\n      \"@id\": \"schema:branch\"\n    },\n    \"branchCode\": {\n      \"@id\": \"schema:branchCode\"\n    },\n    \"branchOf\": {\n      \"@id\": \"schema:branchOf\"\n    },\n    \"brand\": {\n      \"@id\": \"schema:brand\"\n    },\n    \"breadcrumb\": {\n      \"@id\": \"schema:breadcrumb\"\n    },\n    \"breastfeedingWarning\": {\n      \"@id\": \"schema:breastfeedingWarning\"\n    },\n    \"broadcastAffiliateOf\": {\n      \"@id\": \"schema:broadcastAffiliateOf\"\n    },\n    \"broadcastChannelId\": {\n      \"@id\": \"schema:broadcastChannelId\"\n    },\n    \"broadcastDisplayName\": {\n      \"@id\": \"schema:broadcastDisplayName\"\n    },\n    \"broadcastFrequency\": {\n      \"@id\": \"schema:broadcastFrequency\"\n    },\n    \"broadcastFrequencyValue\": {\n      \"@id\": \"schema:broadcastFrequencyValue\"\n    },\n    \"broadcastOfEvent\": {\n      \"@id\": \"schema:broadcastOfEvent\"\n    },\n    \"broadcastServiceTier\": {\n      \"@id\": \"schema:broadcastServiceTier\"\n    },\n    \"broadcastSignalModulation\": {\n      \"@id\": \"schema:broadcastSignalModulation\"\n    },\n    \"broadcastSubChannel\": {\n      \"@id\": \"schema:broadcastSubChannel\"\n    },\n    \"broadcastTimezone\": {\n      \"@id\": \"schema:broadcastTimezone\"\n    },\n    \"broadcaster\": {\n      \"@id\": \"schema:broadcaster\"\n    },\n    \"broker\": {\n      \"@id\": \"schema:broker\"\n    },\n    \"browserRequirements\": {\n      \"@id\": \"schema:browserRequirements\"\n    },\n    \"busName\": {\n      \"@id\": \"schema:busName\"\n    },\n    \"busNumber\": {\n      \"@id\": \"schema:busNumber\"\n    },\n    \"businessDays\": {\n      \"@id\": \"schema:businessDays\"\n    },\n    \"businessFunction\": {\n      \"@id\": \"schema:businessFunction\"\n    },\n    \"buyer\": {\n      \"@id\": \"schema:buyer\"\n    },\n    \"byArtist\": {\n      \"@id\": \"schema:byArtist\"\n    },\n    \"byDay\": {\n      \"@id\": \"schema:byDay\"\n    },\n    \"byMonth\": {\n      \"@id\": \"schema:byMonth\"\n    },\n    \"byMonthDay\": {\n      \"@id\": \"schema:byMonthDay\"\n    },\n    \"byMonthWeek\": {\n      \"@id\": \"schema:byMonthWeek\"\n    },\n    \"callSign\": {\n      \"@id\": \"schema:callSign\"\n    },\n    \"calories\": {\n      \"@id\": \"schema:calories\"\n    },\n    \"candidate\": {\n      \"@id\": \"schema:candidate\"\n    },\n    \"caption\": {\n      \"@id\": \"schema:caption\"\n    },\n    \"carbohydrateContent\": {\n      \"@id\": \"schema:carbohydrateContent\"\n    },\n    \"cargoVolume\": {\n      \"@id\": \"schema:cargoVolume\"\n    },\n    \"carrier\": {\n      \"@id\": \"schema:carrier\"\n    },\n    \"carrierRequirements\": {\n      \"@id\": \"schema:carrierRequirements\"\n    },\n    \"cashBack\": {\n      \"@id\": \"schema:cashBack\"\n    },\n    \"catalog\": {\n      \"@id\": \"schema:catalog\"\n    },\n    \"catalogNumber\": {\n      \"@id\": \"schema:catalogNumber\"\n    },\n    \"category\": {\n      \"@id\": \"schema:category\"\n    },\n    \"causeOf\": {\n      \"@id\": \"schema:causeOf\"\n    },\n    \"ccRecipient\": {\n      \"@id\": \"schema:ccRecipient\"\n    },\n    \"character\": {\n      \"@id\": \"schema:character\"\n    },\n    \"characterAttribute\": {\n      \"@id\": \"schema:characterAttribute\"\n    },\n    \"characterName\": {\n      \"@id\": \"schema:characterName\"\n    },\n    \"cheatCode\": {\n      \"@id\": \"schema:cheatCode\"\n    },\n    \"checkinTime\": {\n      \"@id\": \"schema:checkinTime\"\n    },\n    \"checkoutPageURLTemplate\": {\n      \"@id\": \"schema:checkoutPageURLTemplate\"\n    },\n    \"checkoutTime\": {\n      \"@id\": \"schema:checkoutTime\"\n    },\n    \"chemicalComposition\": {\n      \"@id\": \"schema:chemicalComposition\"\n    },\n    \"chemicalRole\": {\n      \"@id\": \"schema:chemicalRole\"\n    },\n    \"childMaxAge\": {\n      \"@id\": \"schema:childMaxAge\"\n    },\n    \"childMinAge\": {\n      \"@id\": \"schema:childMinAge\"\n    },\n    \"childTaxon\": {\n      \"@id\": \"schema:childTaxon\"\n    },\n    \"children\": {\n      \"@id\": \"schema:children\"\n    },\n    \"cholesterolContent\": {\n      \"@id\": \"schema:cholesterolContent\"\n    },\n    \"circle\": {\n      \"@id\": \"schema:circle\"\n    },\n    \"citation\": {\n      \"@id\": \"schema:citation\"\n    },\n    \"claimInterpreter\": {\n      \"@id\": \"schema:claimInterpreter\"\n    },\n    \"claimReviewed\": {\n      \"@id\": \"schema:claimReviewed\"\n    },\n    \"clincalPharmacology\": {\n      \"@id\": \"schema:clincalPharmacology\"\n    },\n    \"clinicalPharmacology\": {\n      \"@id\": \"schema:clinicalPharmacology\"\n    },\n    \"clipNumber\": {\n      \"@id\": \"schema:clipNumber\"\n    },\n    \"closes\": {\n      \"@id\": \"schema:closes\"\n    },\n    \"coach\": {\n      \"@id\": \"schema:coach\"\n    },\n    \"code\": {\n      \"@id\": \"schema:code\"\n    },\n    \"codeRepository\": {\n      \"@id\": \"schema:codeRepository\",\n      \"@type\": \"@id\"\n    },\n    \"codeSampleType\": {\n      \"@id\": \"schema:codeSampleType\"\n    },\n    \"codeValue\": {\n      \"@id\": \"schema:codeValue\"\n    },\n    \"codingSystem\": {\n      \"@id\": \"schema:codingSystem\"\n    },\n    \"colleague\": {\n      \"@id\": \"schema:colleague\",\n      \"@type\": \"@id\"\n    },\n    \"colleagues\": {\n      \"@id\": \"schema:colleagues\"\n    },\n    \"collection\": {\n      \"@id\": \"schema:collection\"\n    },\n    \"collectionSize\": {\n      \"@id\": \"schema:collectionSize\"\n    },\n    \"color\": {\n      \"@id\": \"schema:color\"\n    },\n    \"colorist\": {\n      \"@id\": \"schema:colorist\"\n    },\n    \"comment\": {\n      \"@id\": \"schema:comment\"\n    },\n    \"commentCount\": {\n      \"@id\": \"schema:commentCount\"\n    },\n    \"commentText\": {\n      \"@id\": \"schema:commentText\"\n    },\n    \"commentTime\": {\n      \"@id\": \"schema:commentTime\",\n      \"@type\": \"Date\"\n    },\n    \"competencyRequired\": {\n      \"@id\": \"schema:competencyRequired\"\n    },\n    \"competitor\": {\n      \"@id\": \"schema:competitor\"\n    },\n    \"composer\": {\n      \"@id\": \"schema:composer\"\n    },\n    \"comprisedOf\": {\n      \"@id\": \"schema:comprisedOf\"\n    },\n    \"conditionsOfAccess\": {\n      \"@id\": \"schema:conditionsOfAccess\"\n    },\n    \"confirmationNumber\": {\n      \"@id\": \"schema:confirmationNumber\"\n    },\n    \"connectedTo\": {\n      \"@id\": \"schema:connectedTo\"\n    },\n    \"constrainingProperty\": {\n      \"@id\": \"schema:constrainingProperty\"\n    },\n    \"contactOption\": {\n      \"@id\": \"schema:contactOption\"\n    },\n    \"contactPoint\": {\n      \"@id\": \"schema:contactPoint\"\n    },\n    \"contactPoints\": {\n      \"@id\": \"schema:contactPoints\"\n    },\n    \"contactType\": {\n      \"@id\": \"schema:contactType\"\n    },\n    \"contactlessPayment\": {\n      \"@id\": \"schema:contactlessPayment\"\n    },\n    \"containedIn\": {\n      \"@id\": \"schema:containedIn\"\n    },\n    \"containedInPlace\": {\n      \"@id\": \"schema:containedInPlace\"\n    },\n    \"containsPlace\": {\n      \"@id\": \"schema:containsPlace\"\n    },\n    \"containsSeason\": {\n      \"@id\": \"schema:containsSeason\"\n    },\n    \"contentLocation\": {\n      \"@id\": \"schema:contentLocation\"\n    },\n    \"contentRating\": {\n      \"@id\": \"schema:contentRating\"\n    },\n    \"contentReferenceTime\": {\n      \"@id\": \"schema:contentReferenceTime\"\n    },\n    \"contentSize\": {\n      \"@id\": \"schema:contentSize\"\n    },\n    \"contentType\": {\n      \"@id\": \"schema:contentType\"\n    },\n    \"contentUrl\": {\n      \"@id\": \"schema:contentUrl\",\n      \"@type\": \"@id\"\n    },\n    \"contraindication\": {\n      \"@id\": \"schema:contraindication\"\n    },\n    \"contributor\": {\n      \"@id\": \"schema:contributor\"\n    },\n    \"cookTime\": {\n      \"@id\": \"schema:cookTime\"\n    },\n    \"cookingMethod\": {\n      \"@id\": \"schema:cookingMethod\"\n    },\n    \"copyrightHolder\": {\n      \"@id\": \"schema:copyrightHolder\"\n    },\n    \"copyrightNotice\": {\n      \"@id\": \"schema:copyrightNotice\"\n    },\n    \"copyrightYear\": {\n      \"@id\": \"schema:copyrightYear\"\n    },\n    \"correction\": {\n      \"@id\": \"schema:correction\"\n    },\n    \"correctionsPolicy\": {\n      \"@id\": \"schema:correctionsPolicy\",\n      \"@type\": \"@id\"\n    },\n    \"costCategory\": {\n      \"@id\": \"schema:costCategory\"\n    },\n    \"costCurrency\": {\n      \"@id\": \"schema:costCurrency\"\n    },\n    \"costOrigin\": {\n      \"@id\": \"schema:costOrigin\"\n    },\n    \"costPerUnit\": {\n      \"@id\": \"schema:costPerUnit\"\n    },\n    \"countriesNotSupported\": {\n      \"@id\": \"schema:countriesNotSupported\"\n    },\n    \"countriesSupported\": {\n      \"@id\": \"schema:countriesSupported\"\n    },\n    \"countryOfAssembly\": {\n      \"@id\": \"schema:countryOfAssembly\"\n    },\n    \"countryOfLastProcessing\": {\n      \"@id\": \"schema:countryOfLastProcessing\"\n    },\n    \"countryOfOrigin\": {\n      \"@id\": \"schema:countryOfOrigin\"\n    },\n    \"course\": {\n      \"@id\": \"schema:course\"\n    },\n    \"courseCode\": {\n      \"@id\": \"schema:courseCode\"\n    },\n    \"courseMode\": {\n      \"@id\": \"schema:courseMode\"\n    },\n    \"coursePrerequisites\": {\n      \"@id\": \"schema:coursePrerequisites\"\n    },\n    \"courseWorkload\": {\n      \"@id\": \"schema:courseWorkload\"\n    },\n    \"coverageEndTime\": {\n      \"@id\": \"schema:coverageEndTime\"\n    },\n    \"coverageStartTime\": {\n      \"@id\": \"schema:coverageStartTime\"\n    },\n    \"creativeWorkStatus\": {\n      \"@id\": \"schema:creativeWorkStatus\"\n    },\n    \"creator\": {\n      \"@id\": \"schema:creator\"\n    },\n    \"credentialCategory\": {\n      \"@id\": \"schema:credentialCategory\"\n    },\n    \"creditText\": {\n      \"@id\": \"schema:creditText\"\n    },\n    \"creditedTo\": {\n      \"@id\": \"schema:creditedTo\"\n    },\n    \"cssSelector\": {\n      \"@id\": \"schema:cssSelector\"\n    },\n    \"currenciesAccepted\": {\n      \"@id\": \"schema:currenciesAccepted\"\n    },\n    \"currency\": {\n      \"@id\": \"schema:currency\"\n    },\n    \"currentExchangeRate\": {\n      \"@id\": \"schema:currentExchangeRate\"\n    },\n    \"customer\": {\n      \"@id\": \"schema:customer\"\n    },\n    \"customerRemorseReturnFees\": {\n      \"@id\": \"schema:customerRemorseReturnFees\"\n    },\n    \"customerRemorseReturnLabelSource\": {\n      \"@id\": \"schema:customerRemorseReturnLabelSource\"\n    },\n    \"customerRemorseReturnShippingFeesAmount\": {\n      \"@id\": \"schema:customerRemorseReturnShippingFeesAmount\"\n    },\n    \"cutoffTime\": {\n      \"@id\": \"schema:cutoffTime\"\n    },\n    \"cvdCollectionDate\": {\n      \"@id\": \"schema:cvdCollectionDate\"\n    },\n    \"cvdFacilityCounty\": {\n      \"@id\": \"schema:cvdFacilityCounty\"\n    },\n    \"cvdFacilityId\": {\n      \"@id\": \"schema:cvdFacilityId\"\n    },\n    \"cvdNumBeds\": {\n      \"@id\": \"schema:cvdNumBeds\"\n    },\n    \"cvdNumBedsOcc\": {\n      \"@id\": \"schema:cvdNumBedsOcc\"\n    },\n    \"cvdNumC19Died\": {\n      \"@id\": \"schema:cvdNumC19Died\"\n    },\n    \"cvdNumC19HOPats\": {\n      \"@id\": \"schema:cvdNumC19HOPats\"\n    },\n    \"cvdNumC19HospPats\": {\n      \"@id\": \"schema:cvdNumC19HospPats\"\n    },\n    \"cvdNumC19MechVentPats\": {\n      \"@id\": \"schema:cvdNumC19MechVentPats\"\n    },\n    \"cvdNumC19OFMechVentPats\": {\n      \"@id\": \"schema:cvdNumC19OFMechVentPats\"\n    },\n    \"cvdNumC19OverflowPats\": {\n      \"@id\": \"schema:cvdNumC19OverflowPats\"\n    },\n    \"cvdNumICUBeds\": {\n      \"@id\": \"schema:cvdNumICUBeds\"\n    },\n    \"cvdNumICUBedsOcc\": {\n      \"@id\": \"schema:cvdNumICUBedsOcc\"\n    },\n    \"cvdNumTotBeds\": {\n      \"@id\": \"schema:cvdNumTotBeds\"\n    },\n    \"cvdNumVent\": {\n      \"@id\": \"schema:cvdNumVent\"\n    },\n    \"cvdNumVentUse\": {\n      \"@id\": \"schema:cvdNumVentUse\"\n    },\n    \"dataFeedElement\": {\n      \"@id\": \"schema:dataFeedElement\"\n    },\n    \"dataset\": {\n      \"@id\": \"schema:dataset\"\n    },\n    \"datasetTimeInterval\": {\n      \"@id\": \"schema:datasetTimeInterval\"\n    },\n    \"dateCreated\": {\n      \"@id\": \"schema:dateCreated\",\n      \"@type\": \"Date\"\n    },\n    \"dateDeleted\": {\n      \"@id\": \"schema:dateDeleted\",\n      \"@type\": \"Date\"\n    },\n    \"dateIssued\": {\n      \"@id\": \"schema:dateIssued\",\n      \"@type\": \"Date\"\n    },\n    \"dateModified\": {\n      \"@id\": \"schema:dateModified\",\n      \"@type\": \"Date\"\n    },\n    \"datePosted\": {\n      \"@id\": \"schema:datePosted\",\n      \"@type\": \"Date\"\n    },\n    \"datePublished\": {\n      \"@id\": \"schema:datePublished\",\n      \"@type\": \"Date\"\n    },\n    \"dateRead\": {\n      \"@id\": \"schema:dateRead\",\n      \"@type\": \"Date\"\n    },\n    \"dateReceived\": {\n      \"@id\": \"schema:dateReceived\"\n    },\n    \"dateSent\": {\n      \"@id\": \"schema:dateSent\"\n    },\n    \"dateVehicleFirstRegistered\": {\n      \"@id\": \"schema:dateVehicleFirstRegistered\",\n      \"@type\": \"Date\"\n    },\n    \"dateline\": {\n      \"@id\": \"schema:dateline\"\n    },\n    \"dayOfWeek\": {\n      \"@id\": \"schema:dayOfWeek\"\n    },\n    \"deathDate\": {\n      \"@id\": \"schema:deathDate\",\n      \"@type\": \"Date\"\n    },\n    \"deathPlace\": {\n      \"@id\": \"schema:deathPlace\"\n    },\n    \"defaultValue\": {\n      \"@id\": \"schema:defaultValue\"\n    },\n    \"deliveryAddress\": {\n      \"@id\": \"schema:deliveryAddress\"\n    },\n    \"deliveryLeadTime\": {\n      \"@id\": \"schema:deliveryLeadTime\"\n    },\n    \"deliveryMethod\": {\n      \"@id\": \"schema:deliveryMethod\"\n    },\n    \"deliveryStatus\": {\n      \"@id\": \"schema:deliveryStatus\"\n    },\n    \"deliveryTime\": {\n      \"@id\": \"schema:deliveryTime\"\n    },\n    \"department\": {\n      \"@id\": \"schema:department\"\n    },\n    \"departureAirport\": {\n      \"@id\": \"schema:departureAirport\"\n    },\n    \"departureBoatTerminal\": {\n      \"@id\": \"schema:departureBoatTerminal\"\n    },\n    \"departureBusStop\": {\n      \"@id\": \"schema:departureBusStop\"\n    },\n    \"departureGate\": {\n      \"@id\": \"schema:departureGate\"\n    },\n    \"departurePlatform\": {\n      \"@id\": \"schema:departurePlatform\"\n    },\n    \"departureStation\": {\n      \"@id\": \"schema:departureStation\"\n    },\n    \"departureTerminal\": {\n      \"@id\": \"schema:departureTerminal\"\n    },\n    \"departureTime\": {\n      \"@id\": \"schema:departureTime\"\n    },\n    \"dependencies\": {\n      \"@id\": \"schema:dependencies\"\n    },\n    \"depth\": {\n      \"@id\": \"schema:depth\"\n    },\n    \"description\": {\n      \"@id\": \"schema:description\"\n    },\n    \"device\": {\n      \"@id\": \"schema:device\"\n    },\n    \"diagnosis\": {\n      \"@id\": \"schema:diagnosis\"\n    },\n    \"diagram\": {\n      \"@id\": \"schema:diagram\"\n    },\n    \"diet\": {\n      \"@id\": \"schema:diet\"\n    },\n    \"dietFeatures\": {\n      \"@id\": \"schema:dietFeatures\"\n    },\n    \"differentialDiagnosis\": {\n      \"@id\": \"schema:differentialDiagnosis\"\n    },\n    \"directApply\": {\n      \"@id\": \"schema:directApply\"\n    },\n    \"director\": {\n      \"@id\": \"schema:director\"\n    },\n    \"directors\": {\n      \"@id\": \"schema:directors\"\n    },\n    \"disambiguatingDescription\": {\n      \"@id\": \"schema:disambiguatingDescription\"\n    },\n    \"discount\": {\n      \"@id\": \"schema:discount\"\n    },\n    \"discountCode\": {\n      \"@id\": \"schema:discountCode\"\n    },\n    \"discountCurrency\": {\n      \"@id\": \"schema:discountCurrency\"\n    },\n    \"discusses\": {\n      \"@id\": \"schema:discusses\"\n    },\n    \"discussionUrl\": {\n      \"@id\": \"schema:discussionUrl\",\n      \"@type\": \"@id\"\n    },\n    \"diseasePreventionInfo\": {\n      \"@id\": \"schema:diseasePreventionInfo\",\n      \"@type\": \"@id\"\n    },\n    \"diseaseSpreadStatistics\": {\n      \"@id\": \"schema:diseaseSpreadStatistics\",\n      \"@type\": \"@id\"\n    },\n    \"dissolutionDate\": {\n      \"@id\": \"schema:dissolutionDate\",\n      \"@type\": \"Date\"\n    },\n    \"distance\": {\n      \"@id\": \"schema:distance\"\n    },\n    \"distinguishingSign\": {\n      \"@id\": \"schema:distinguishingSign\"\n    },\n    \"distribution\": {\n      \"@id\": \"schema:distribution\"\n    },\n    \"diversityPolicy\": {\n      \"@id\": \"schema:diversityPolicy\",\n      \"@type\": \"@id\"\n    },\n    \"diversityStaffingReport\": {\n      \"@id\": \"schema:diversityStaffingReport\",\n      \"@type\": \"@id\"\n    },\n    \"documentation\": {\n      \"@id\": \"schema:documentation\",\n      \"@type\": \"@id\"\n    },\n    \"doesNotShip\": {\n      \"@id\": \"schema:doesNotShip\"\n    },\n    \"domainIncludes\": {\n      \"@id\": \"schema:domainIncludes\"\n    },\n    \"domiciledMortgage\": {\n      \"@id\": \"schema:domiciledMortgage\"\n    },\n    \"doorTime\": {\n      \"@id\": \"schema:doorTime\"\n    },\n    \"dosageForm\": {\n      \"@id\": \"schema:dosageForm\"\n    },\n    \"doseSchedule\": {\n      \"@id\": \"schema:doseSchedule\"\n    },\n    \"doseUnit\": {\n      \"@id\": \"schema:doseUnit\"\n    },\n    \"doseValue\": {\n      \"@id\": \"schema:doseValue\"\n    },\n    \"downPayment\": {\n      \"@id\": \"schema:downPayment\"\n    },\n    \"downloadUrl\": {\n      \"@id\": \"schema:downloadUrl\",\n      \"@type\": \"@id\"\n    },\n    \"downvoteCount\": {\n      \"@id\": \"schema:downvoteCount\"\n    },\n    \"drainsTo\": {\n      \"@id\": \"schema:drainsTo\"\n    },\n    \"driveWheelConfiguration\": {\n      \"@id\": \"schema:driveWheelConfiguration\"\n    },\n    \"dropoffLocation\": {\n      \"@id\": \"schema:dropoffLocation\"\n    },\n    \"dropoffTime\": {\n      \"@id\": \"schema:dropoffTime\"\n    },\n    \"drug\": {\n      \"@id\": \"schema:drug\"\n    },\n    \"drugClass\": {\n      \"@id\": \"schema:drugClass\"\n    },\n    \"drugUnit\": {\n      \"@id\": \"schema:drugUnit\"\n    },\n    \"duns\": {\n      \"@id\": \"schema:duns\"\n    },\n    \"duplicateTherapy\": {\n      \"@id\": \"schema:duplicateTherapy\"\n    },\n    \"duration\": {\n      \"@id\": \"schema:duration\"\n    },\n    \"durationOfWarranty\": {\n      \"@id\": \"schema:durationOfWarranty\"\n    },\n    \"duringMedia\": {\n      \"@id\": \"schema:duringMedia\",\n      \"@type\": \"@id\"\n    },\n    \"earlyPrepaymentPenalty\": {\n      \"@id\": \"schema:earlyPrepaymentPenalty\"\n    },\n    \"editEIDR\": {\n      \"@id\": \"schema:editEIDR\"\n    },\n    \"editor\": {\n      \"@id\": \"schema:editor\"\n    },\n    \"eduQuestionType\": {\n      \"@id\": \"schema:eduQuestionType\"\n    },\n    \"educationRequirements\": {\n      \"@id\": \"schema:educationRequirements\"\n    },\n    \"educationalAlignment\": {\n      \"@id\": \"schema:educationalAlignment\"\n    },\n    \"educationalCredentialAwarded\": {\n      \"@id\": \"schema:educationalCredentialAwarded\"\n    },\n    \"educationalFramework\": {\n      \"@id\": \"schema:educationalFramework\"\n    },\n    \"educationalLevel\": {\n      \"@id\": \"schema:educationalLevel\"\n    },\n    \"educationalProgramMode\": {\n      \"@id\": \"schema:educationalProgramMode\"\n    },\n    \"educationalRole\": {\n      \"@id\": \"schema:educationalRole\"\n    },\n    \"educationalUse\": {\n      \"@id\": \"schema:educationalUse\"\n    },\n    \"elevation\": {\n      \"@id\": \"schema:elevation\"\n    },\n    \"eligibilityToWorkRequirement\": {\n      \"@id\": \"schema:eligibilityToWorkRequirement\"\n    },\n    \"eligibleCustomerType\": {\n      \"@id\": \"schema:eligibleCustomerType\"\n    },\n    \"eligibleDuration\": {\n      \"@id\": \"schema:eligibleDuration\"\n    },\n    \"eligibleQuantity\": {\n      \"@id\": \"schema:eligibleQuantity\"\n    },\n    \"eligibleRegion\": {\n      \"@id\": \"schema:eligibleRegion\"\n    },\n    \"eligibleTransactionVolume\": {\n      \"@id\": \"schema:eligibleTransactionVolume\"\n    },\n    \"email\": {\n      \"@id\": \"schema:email\"\n    },\n    \"embedUrl\": {\n      \"@id\": \"schema:embedUrl\",\n      \"@type\": \"@id\"\n    },\n    \"embeddedTextCaption\": {\n      \"@id\": \"schema:embeddedTextCaption\"\n    },\n    \"emissionsCO2\": {\n      \"@id\": \"schema:emissionsCO2\"\n    },\n    \"employee\": {\n      \"@id\": \"schema:employee\"\n    },\n    \"employees\": {\n      \"@id\": \"schema:employees\"\n    },\n    \"employerOverview\": {\n      \"@id\": \"schema:employerOverview\"\n    },\n    \"employmentType\": {\n      \"@id\": \"schema:employmentType\"\n    },\n    \"employmentUnit\": {\n      \"@id\": \"schema:employmentUnit\"\n    },\n    \"encodesBioChemEntity\": {\n      \"@id\": \"schema:encodesBioChemEntity\"\n    },\n    \"encodesCreativeWork\": {\n      \"@id\": \"schema:encodesCreativeWork\"\n    },\n    \"encoding\": {\n      \"@id\": \"schema:encoding\"\n    },\n    \"encodingFormat\": {\n      \"@id\": \"schema:encodingFormat\"\n    },\n    \"encodingType\": {\n      \"@id\": \"schema:encodingType\"\n    },\n    \"encodings\": {\n      \"@id\": \"schema:encodings\"\n    },\n    \"endDate\": {\n      \"@id\": \"schema:endDate\",\n      \"@type\": \"Date\"\n    },\n    \"endOffset\": {\n      \"@id\": \"schema:endOffset\"\n    },\n    \"endTime\": {\n      \"@id\": \"schema:endTime\"\n    },\n    \"endorsee\": {\n      \"@id\": \"schema:endorsee\"\n    },\n    \"endorsers\": {\n      \"@id\": \"schema:endorsers\"\n    },\n    \"energyEfficiencyScaleMax\": {\n      \"@id\": \"schema:energyEfficiencyScaleMax\"\n    },\n    \"energyEfficiencyScaleMin\": {\n      \"@id\": \"schema:energyEfficiencyScaleMin\"\n    },\n    \"engineDisplacement\": {\n      \"@id\": \"schema:engineDisplacement\"\n    },\n    \"enginePower\": {\n      \"@id\": \"schema:enginePower\"\n    },\n    \"engineType\": {\n      \"@id\": \"schema:engineType\"\n    },\n    \"entertainmentBusiness\": {\n      \"@id\": \"schema:entertainmentBusiness\"\n    },\n    \"epidemiology\": {\n      \"@id\": \"schema:epidemiology\"\n    },\n    \"episode\": {\n      \"@id\": \"schema:episode\"\n    },\n    \"episodeNumber\": {\n      \"@id\": \"schema:episodeNumber\"\n    },\n    \"episodes\": {\n      \"@id\": \"schema:episodes\"\n    },\n    \"equal\": {\n      \"@id\": \"schema:equal\"\n    },\n    \"error\": {\n      \"@id\": \"schema:error\"\n    },\n    \"estimatedCost\": {\n      \"@id\": \"schema:estimatedCost\"\n    },\n    \"estimatedFlightDuration\": {\n      \"@id\": \"schema:estimatedFlightDuration\"\n    },\n    \"estimatedSalary\": {\n      \"@id\": \"schema:estimatedSalary\"\n    },\n    \"estimatesRiskOf\": {\n      \"@id\": \"schema:estimatesRiskOf\"\n    },\n    \"ethicsPolicy\": {\n      \"@id\": \"schema:ethicsPolicy\",\n      \"@type\": \"@id\"\n    },\n    \"event\": {\n      \"@id\": \"schema:event\"\n    },\n    \"eventAttendanceMode\": {\n      \"@id\": \"schema:eventAttendanceMode\"\n    },\n    \"eventSchedule\": {\n      \"@id\": \"schema:eventSchedule\"\n    },\n    \"eventStatus\": {\n      \"@id\": \"schema:eventStatus\"\n    },\n    \"events\": {\n      \"@id\": \"schema:events\"\n    },\n    \"evidenceLevel\": {\n      \"@id\": \"schema:evidenceLevel\"\n    },\n    \"evidenceOrigin\": {\n      \"@id\": \"schema:evidenceOrigin\"\n    },\n    \"exampleOfWork\": {\n      \"@id\": \"schema:exampleOfWork\"\n    },\n    \"exceptDate\": {\n      \"@id\": \"schema:exceptDate\",\n      \"@type\": \"Date\"\n    },\n    \"exchangeRateSpread\": {\n      \"@id\": \"schema:exchangeRateSpread\"\n    },\n    \"executableLibraryName\": {\n      \"@id\": \"schema:executableLibraryName\"\n    },\n    \"exerciseCourse\": {\n      \"@id\": \"schema:exerciseCourse\"\n    },\n    \"exercisePlan\": {\n      \"@id\": \"schema:exercisePlan\"\n    },\n    \"exerciseRelatedDiet\": {\n      \"@id\": \"schema:exerciseRelatedDiet\"\n    },\n    \"exerciseType\": {\n      \"@id\": \"schema:exerciseType\"\n    },\n    \"exifData\": {\n      \"@id\": \"schema:exifData\"\n    },\n    \"expectedArrivalFrom\": {\n      \"@id\": \"schema:expectedArrivalFrom\",\n      \"@type\": \"Date\"\n    },\n    \"expectedArrivalUntil\": {\n      \"@id\": \"schema:expectedArrivalUntil\",\n      \"@type\": \"Date\"\n    },\n    \"expectedPrognosis\": {\n      \"@id\": \"schema:expectedPrognosis\"\n    },\n    \"expectsAcceptanceOf\": {\n      \"@id\": \"schema:expectsAcceptanceOf\"\n    },\n    \"experienceInPlaceOfEducation\": {\n      \"@id\": \"schema:experienceInPlaceOfEducation\"\n    },\n    \"experienceRequirements\": {\n      \"@id\": \"schema:experienceRequirements\"\n    },\n    \"expertConsiderations\": {\n      \"@id\": \"schema:expertConsiderations\"\n    },\n    \"expires\": {\n      \"@id\": \"schema:expires\",\n      \"@type\": \"Date\"\n    },\n    \"expressedIn\": {\n      \"@id\": \"schema:expressedIn\"\n    },\n    \"familyName\": {\n      \"@id\": \"schema:familyName\"\n    },\n    \"fatContent\": {\n      \"@id\": \"schema:fatContent\"\n    },\n    \"faxNumber\": {\n      \"@id\": \"schema:faxNumber\"\n    },\n    \"featureList\": {\n      \"@id\": \"schema:featureList\"\n    },\n    \"feesAndCommissionsSpecification\": {\n      \"@id\": \"schema:feesAndCommissionsSpecification\"\n    },\n    \"fiberContent\": {\n      \"@id\": \"schema:fiberContent\"\n    },\n    \"fileFormat\": {\n      \"@id\": \"schema:fileFormat\"\n    },\n    \"fileSize\": {\n      \"@id\": \"schema:fileSize\"\n    },\n    \"financialAidEligible\": {\n      \"@id\": \"schema:financialAidEligible\"\n    },\n    \"firstAppearance\": {\n      \"@id\": \"schema:firstAppearance\"\n    },\n    \"firstPerformance\": {\n      \"@id\": \"schema:firstPerformance\"\n    },\n    \"flightDistance\": {\n      \"@id\": \"schema:flightDistance\"\n    },\n    \"flightNumber\": {\n      \"@id\": \"schema:flightNumber\"\n    },\n    \"floorLevel\": {\n      \"@id\": \"schema:floorLevel\"\n    },\n    \"floorLimit\": {\n      \"@id\": \"schema:floorLimit\"\n    },\n    \"floorSize\": {\n      \"@id\": \"schema:floorSize\"\n    },\n    \"followee\": {\n      \"@id\": \"schema:followee\"\n    },\n    \"follows\": {\n      \"@id\": \"schema:follows\"\n    },\n    \"followup\": {\n      \"@id\": \"schema:followup\"\n    },\n    \"foodEstablishment\": {\n      \"@id\": \"schema:foodEstablishment\"\n    },\n    \"foodEvent\": {\n      \"@id\": \"schema:foodEvent\"\n    },\n    \"foodWarning\": {\n      \"@id\": \"schema:foodWarning\"\n    },\n    \"founder\": {\n      \"@id\": \"schema:founder\"\n    },\n    \"founders\": {\n      \"@id\": \"schema:founders\"\n    },\n    \"foundingDate\": {\n      \"@id\": \"schema:foundingDate\",\n      \"@type\": \"Date\"\n    },\n    \"foundingLocation\": {\n      \"@id\": \"schema:foundingLocation\"\n    },\n    \"free\": {\n      \"@id\": \"schema:free\"\n    },\n    \"freeShippingThreshold\": {\n      \"@id\": \"schema:freeShippingThreshold\"\n    },\n    \"frequency\": {\n      \"@id\": \"schema:frequency\"\n    },\n    \"fromLocation\": {\n      \"@id\": \"schema:fromLocation\"\n    },\n    \"fuelCapacity\": {\n      \"@id\": \"schema:fuelCapacity\"\n    },\n    \"fuelConsumption\": {\n      \"@id\": \"schema:fuelConsumption\"\n    },\n    \"fuelEfficiency\": {\n      \"@id\": \"schema:fuelEfficiency\"\n    },\n    \"fuelType\": {\n      \"@id\": \"schema:fuelType\"\n    },\n    \"functionalClass\": {\n      \"@id\": \"schema:functionalClass\"\n    },\n    \"fundedItem\": {\n      \"@id\": \"schema:fundedItem\"\n    },\n    \"funder\": {\n      \"@id\": \"schema:funder\"\n    },\n    \"funding\": {\n      \"@id\": \"schema:funding\"\n    },\n    \"game\": {\n      \"@id\": \"schema:game\"\n    },\n    \"gameAvailabilityType\": {\n      \"@id\": \"schema:gameAvailabilityType\"\n    },\n    \"gameEdition\": {\n      \"@id\": \"schema:gameEdition\"\n    },\n    \"gameItem\": {\n      \"@id\": \"schema:gameItem\"\n    },\n    \"gameLocation\": {\n      \"@id\": \"schema:gameLocation\",\n      \"@type\": \"@id\"\n    },\n    \"gamePlatform\": {\n      \"@id\": \"schema:gamePlatform\"\n    },\n    \"gameServer\": {\n      \"@id\": \"schema:gameServer\"\n    },\n    \"gameTip\": {\n      \"@id\": \"schema:gameTip\"\n    },\n    \"gender\": {\n      \"@id\": \"schema:gender\"\n    },\n    \"genre\": {\n      \"@id\": \"schema:genre\"\n    },\n    \"geo\": {\n      \"@id\": \"schema:geo\"\n    },\n    \"geoContains\": {\n      \"@id\": \"schema:geoContains\"\n    },\n    \"geoCoveredBy\": {\n      \"@id\": \"schema:geoCoveredBy\"\n    },\n    \"geoCovers\": {\n      \"@id\": \"schema:geoCovers\"\n    },\n    \"geoCrosses\": {\n      \"@id\": \"schema:geoCrosses\"\n    },\n    \"geoDisjoint\": {\n      \"@id\": \"schema:geoDisjoint\"\n    },\n    \"geoEquals\": {\n      \"@id\": \"schema:geoEquals\"\n    },\n    \"geoIntersects\": {\n      \"@id\": \"schema:geoIntersects\"\n    },\n    \"geoMidpoint\": {\n      \"@id\": \"schema:geoMidpoint\"\n    },\n    \"geoOverlaps\": {\n      \"@id\": \"schema:geoOverlaps\"\n    },\n    \"geoRadius\": {\n      \"@id\": \"schema:geoRadius\"\n    },\n    \"geoTouches\": {\n      \"@id\": \"schema:geoTouches\"\n    },\n    \"geoWithin\": {\n      \"@id\": \"schema:geoWithin\"\n    },\n    \"geographicArea\": {\n      \"@id\": \"schema:geographicArea\"\n    },\n    \"gettingTestedInfo\": {\n      \"@id\": \"schema:gettingTestedInfo\",\n      \"@type\": \"@id\"\n    },\n    \"givenName\": {\n      \"@id\": \"schema:givenName\"\n    },\n    \"globalLocationNumber\": {\n      \"@id\": \"schema:globalLocationNumber\"\n    },\n    \"governmentBenefitsInfo\": {\n      \"@id\": \"schema:governmentBenefitsInfo\"\n    },\n    \"gracePeriod\": {\n      \"@id\": \"schema:gracePeriod\"\n    },\n    \"grantee\": {\n      \"@id\": \"schema:grantee\"\n    },\n    \"greater\": {\n      \"@id\": \"schema:greater\"\n    },\n    \"greaterOrEqual\": {\n      \"@id\": \"schema:greaterOrEqual\"\n    },\n    \"gtin\": {\n      \"@id\": \"schema:gtin\"\n    },\n    \"gtin12\": {\n      \"@id\": \"schema:gtin12\"\n    },\n    \"gtin13\": {\n      \"@id\": \"schema:gtin13\"\n    },\n    \"gtin14\": {\n      \"@id\": \"schema:gtin14\"\n    },\n    \"gtin8\": {\n      \"@id\": \"schema:gtin8\"\n    },\n    \"guideline\": {\n      \"@id\": \"schema:guideline\"\n    },\n    \"guidelineDate\": {\n      \"@id\": \"schema:guidelineDate\",\n      \"@type\": \"Date\"\n    },\n    \"guidelineSubject\": {\n      \"@id\": \"schema:guidelineSubject\"\n    },\n    \"handlingTime\": {\n      \"@id\": \"schema:handlingTime\"\n    },\n    \"hasAdultConsideration\": {\n      \"@id\": \"schema:hasAdultConsideration\"\n    },\n    \"hasBioChemEntityPart\": {\n      \"@id\": \"schema:hasBioChemEntityPart\"\n    },\n    \"hasBioPolymerSequence\": {\n      \"@id\": \"schema:hasBioPolymerSequence\"\n    },\n    \"hasBroadcastChannel\": {\n      \"@id\": \"schema:hasBroadcastChannel\"\n    },\n    \"hasCategoryCode\": {\n      \"@id\": \"schema:hasCategoryCode\"\n    },\n    \"hasCourse\": {\n      \"@id\": \"schema:hasCourse\"\n    },\n    \"hasCourseInstance\": {\n      \"@id\": \"schema:hasCourseInstance\"\n    },\n    \"hasCredential\": {\n      \"@id\": \"schema:hasCredential\"\n    },\n    \"hasDefinedTerm\": {\n      \"@id\": \"schema:hasDefinedTerm\"\n    },\n    \"hasDeliveryMethod\": {\n      \"@id\": \"schema:hasDeliveryMethod\"\n    },\n    \"hasDigitalDocumentPermission\": {\n      \"@id\": \"schema:hasDigitalDocumentPermission\"\n    },\n    \"hasDriveThroughService\": {\n      \"@id\": \"schema:hasDriveThroughService\"\n    },\n    \"hasEnergyConsumptionDetails\": {\n      \"@id\": \"schema:hasEnergyConsumptionDetails\"\n    },\n    \"hasEnergyEfficiencyCategory\": {\n      \"@id\": \"schema:hasEnergyEfficiencyCategory\"\n    },\n    \"hasHealthAspect\": {\n      \"@id\": \"schema:hasHealthAspect\"\n    },\n    \"hasMap\": {\n      \"@id\": \"schema:hasMap\",\n      \"@type\": \"@id\"\n    },\n    \"hasMeasurement\": {\n      \"@id\": \"schema:hasMeasurement\"\n    },\n    \"hasMenu\": {\n      \"@id\": \"schema:hasMenu\"\n    },\n    \"hasMenuItem\": {\n      \"@id\": \"schema:hasMenuItem\"\n    },\n    \"hasMenuSection\": {\n      \"@id\": \"schema:hasMenuSection\"\n    },\n    \"hasMerchantReturnPolicy\": {\n      \"@id\": \"schema:hasMerchantReturnPolicy\"\n    },\n    \"hasMolecularFunction\": {\n      \"@id\": \"schema:hasMolecularFunction\",\n      \"@type\": \"@id\"\n    },\n    \"hasOccupation\": {\n      \"@id\": \"schema:hasOccupation\"\n    },\n    \"hasOfferCatalog\": {\n      \"@id\": \"schema:hasOfferCatalog\"\n    },\n    \"hasPOS\": {\n      \"@id\": \"schema:hasPOS\"\n    },\n    \"hasPart\": {\n      \"@id\": \"schema:hasPart\"\n    },\n    \"hasProductReturnPolicy\": {\n      \"@id\": \"schema:hasProductReturnPolicy\"\n    },\n    \"hasRepresentation\": {\n      \"@id\": \"schema:hasRepresentation\"\n    },\n    \"hasVariant\": {\n      \"@id\": \"schema:hasVariant\"\n    },\n    \"headline\": {\n      \"@id\": \"schema:headline\"\n    },\n    \"healthCondition\": {\n      \"@id\": \"schema:healthCondition\"\n    },\n    \"healthPlanCoinsuranceOption\": {\n      \"@id\": \"schema:healthPlanCoinsuranceOption\"\n    },\n    \"healthPlanCoinsuranceRate\": {\n      \"@id\": \"schema:healthPlanCoinsuranceRate\"\n    },\n    \"healthPlanCopay\": {\n      \"@id\": \"schema:healthPlanCopay\"\n    },\n    \"healthPlanCopayOption\": {\n      \"@id\": \"schema:healthPlanCopayOption\"\n    },\n    \"healthPlanCostSharing\": {\n      \"@id\": \"schema:healthPlanCostSharing\"\n    },\n    \"healthPlanDrugOption\": {\n      \"@id\": \"schema:healthPlanDrugOption\"\n    },\n    \"healthPlanDrugTier\": {\n      \"@id\": \"schema:healthPlanDrugTier\"\n    },\n    \"healthPlanId\": {\n      \"@id\": \"schema:healthPlanId\"\n    },\n    \"healthPlanMarketingUrl\": {\n      \"@id\": \"schema:healthPlanMarketingUrl\",\n      \"@type\": \"@id\"\n    },\n    \"healthPlanNetworkId\": {\n      \"@id\": \"schema:healthPlanNetworkId\"\n    },\n    \"healthPlanNetworkTier\": {\n      \"@id\": \"schema:healthPlanNetworkTier\"\n    },\n    \"healthPlanPharmacyCategory\": {\n      \"@id\": \"schema:healthPlanPharmacyCategory\"\n    },\n    \"healthcareReportingData\": {\n      \"@id\": \"schema:healthcareReportingData\"\n    },\n    \"height\": {\n      \"@id\": \"schema:height\"\n    },\n    \"highPrice\": {\n      \"@id\": \"schema:highPrice\"\n    },\n    \"hiringOrganization\": {\n      \"@id\": \"schema:hiringOrganization\"\n    },\n    \"holdingArchive\": {\n      \"@id\": \"schema:holdingArchive\"\n    },\n    \"homeLocation\": {\n      \"@id\": \"schema:homeLocation\"\n    },\n    \"homeTeam\": {\n      \"@id\": \"schema:homeTeam\"\n    },\n    \"honorificPrefix\": {\n      \"@id\": \"schema:honorificPrefix\"\n    },\n    \"honorificSuffix\": {\n      \"@id\": \"schema:honorificSuffix\"\n    },\n    \"hospitalAffiliation\": {\n      \"@id\": \"schema:hospitalAffiliation\"\n    },\n    \"hostingOrganization\": {\n      \"@id\": \"schema:hostingOrganization\"\n    },\n    \"hoursAvailable\": {\n      \"@id\": \"schema:hoursAvailable\"\n    },\n    \"howPerformed\": {\n      \"@id\": \"schema:howPerformed\"\n    },\n    \"httpMethod\": {\n      \"@id\": \"schema:httpMethod\"\n    },\n    \"iataCode\": {\n      \"@id\": \"schema:iataCode\"\n    },\n    \"icaoCode\": {\n      \"@id\": \"schema:icaoCode\"\n    },\n    \"identifier\": {\n      \"@id\": \"schema:identifier\"\n    },\n    \"identifyingExam\": {\n      \"@id\": \"schema:identifyingExam\"\n    },\n    \"identifyingTest\": {\n      \"@id\": \"schema:identifyingTest\"\n    },\n    \"illustrator\": {\n      \"@id\": \"schema:illustrator\"\n    },\n    \"image\": {\n      \"@id\": \"schema:image\",\n      \"@type\": \"@id\"\n    },\n    \"imagingTechnique\": {\n      \"@id\": \"schema:imagingTechnique\"\n    },\n    \"inAlbum\": {\n      \"@id\": \"schema:inAlbum\"\n    },\n    \"inBroadcastLineup\": {\n      \"@id\": \"schema:inBroadcastLineup\"\n    },\n    \"inChI\": {\n      \"@id\": \"schema:inChI\"\n    },\n    \"inChIKey\": {\n      \"@id\": \"schema:inChIKey\"\n    },\n    \"inCodeSet\": {\n      \"@id\": \"schema:inCodeSet\",\n      \"@type\": \"@id\"\n    },\n    \"inDefinedTermSet\": {\n      \"@id\": \"schema:inDefinedTermSet\",\n      \"@type\": \"@id\"\n    },\n    \"inLanguage\": {\n      \"@id\": \"schema:inLanguage\"\n    },\n    \"inPlaylist\": {\n      \"@id\": \"schema:inPlaylist\"\n    },\n    \"inProductGroupWithID\": {\n      \"@id\": \"schema:inProductGroupWithID\"\n    },\n    \"inStoreReturnsOffered\": {\n      \"@id\": \"schema:inStoreReturnsOffered\"\n    },\n    \"inSupportOf\": {\n      \"@id\": \"schema:inSupportOf\"\n    },\n    \"incentiveCompensation\": {\n      \"@id\": \"schema:incentiveCompensation\"\n    },\n    \"incentives\": {\n      \"@id\": \"schema:incentives\"\n    },\n    \"includedComposition\": {\n      \"@id\": \"schema:includedComposition\"\n    },\n    \"includedDataCatalog\": {\n      \"@id\": \"schema:includedDataCatalog\"\n    },\n    \"includedInDataCatalog\": {\n      \"@id\": \"schema:includedInDataCatalog\"\n    },\n    \"includedInHealthInsurancePlan\": {\n      \"@id\": \"schema:includedInHealthInsurancePlan\"\n    },\n    \"includedRiskFactor\": {\n      \"@id\": \"schema:includedRiskFactor\"\n    },\n    \"includesAttraction\": {\n      \"@id\": \"schema:includesAttraction\"\n    },\n    \"includesHealthPlanFormulary\": {\n      \"@id\": \"schema:includesHealthPlanFormulary\"\n    },\n    \"includesHealthPlanNetwork\": {\n      \"@id\": \"schema:includesHealthPlanNetwork\"\n    },\n    \"includesObject\": {\n      \"@id\": \"schema:includesObject\"\n    },\n    \"increasesRiskOf\": {\n      \"@id\": \"schema:increasesRiskOf\"\n    },\n    \"industry\": {\n      \"@id\": \"schema:industry\"\n    },\n    \"ineligibleRegion\": {\n      \"@id\": \"schema:ineligibleRegion\"\n    },\n    \"infectiousAgent\": {\n      \"@id\": \"schema:infectiousAgent\"\n    },\n    \"infectiousAgentClass\": {\n      \"@id\": \"schema:infectiousAgentClass\"\n    },\n    \"ingredients\": {\n      \"@id\": \"schema:ingredients\"\n    },\n    \"inker\": {\n      \"@id\": \"schema:inker\"\n    },\n    \"insertion\": {\n      \"@id\": \"schema:insertion\"\n    },\n    \"installUrl\": {\n      \"@id\": \"schema:installUrl\",\n      \"@type\": \"@id\"\n    },\n    \"instructor\": {\n      \"@id\": \"schema:instructor\"\n    },\n    \"instrument\": {\n      \"@id\": \"schema:instrument\"\n    },\n    \"intensity\": {\n      \"@id\": \"schema:intensity\"\n    },\n    \"interactingDrug\": {\n      \"@id\": \"schema:interactingDrug\"\n    },\n    \"interactionCount\": {\n      \"@id\": \"schema:interactionCount\"\n    },\n    \"interactionService\": {\n      \"@id\": \"schema:interactionService\"\n    },\n    \"interactionStatistic\": {\n      \"@id\": \"schema:interactionStatistic\"\n    },\n    \"interactionType\": {\n      \"@id\": \"schema:interactionType\"\n    },\n    \"interactivityType\": {\n      \"@id\": \"schema:interactivityType\"\n    },\n    \"interestRate\": {\n      \"@id\": \"schema:interestRate\"\n    },\n    \"interpretedAsClaim\": {\n      \"@id\": \"schema:interpretedAsClaim\"\n    },\n    \"inventoryLevel\": {\n      \"@id\": \"schema:inventoryLevel\"\n    },\n    \"inverseOf\": {\n      \"@id\": \"schema:inverseOf\"\n    },\n    \"isAcceptingNewPatients\": {\n      \"@id\": \"schema:isAcceptingNewPatients\"\n    },\n    \"isAccessibleForFree\": {\n      \"@id\": \"schema:isAccessibleForFree\"\n    },\n    \"isAccessoryOrSparePartFor\": {\n      \"@id\": \"schema:isAccessoryOrSparePartFor\"\n    },\n    \"isAvailableGenerically\": {\n      \"@id\": \"schema:isAvailableGenerically\"\n    },\n    \"isBasedOn\": {\n      \"@id\": \"schema:isBasedOn\",\n      \"@type\": \"@id\"\n    },\n    \"isBasedOnUrl\": {\n      \"@id\": \"schema:isBasedOnUrl\",\n      \"@type\": \"@id\"\n    },\n    \"isConsumableFor\": {\n      \"@id\": \"schema:isConsumableFor\"\n    },\n    \"isEncodedByBioChemEntity\": {\n      \"@id\": \"schema:isEncodedByBioChemEntity\"\n    },\n    \"isFamilyFriendly\": {\n      \"@id\": \"schema:isFamilyFriendly\"\n    },\n    \"isGift\": {\n      \"@id\": \"schema:isGift\"\n    },\n    \"isInvolvedInBiologicalProcess\": {\n      \"@id\": \"schema:isInvolvedInBiologicalProcess\",\n      \"@type\": \"@id\"\n    },\n    \"isLiveBroadcast\": {\n      \"@id\": \"schema:isLiveBroadcast\"\n    },\n    \"isLocatedInSubcellularLocation\": {\n      \"@id\": \"schema:isLocatedInSubcellularLocation\",\n      \"@type\": \"@id\"\n    },\n    \"isPartOf\": {\n      \"@id\": \"schema:isPartOf\",\n      \"@type\": \"@id\"\n    },\n    \"isPartOfBioChemEntity\": {\n      \"@id\": \"schema:isPartOfBioChemEntity\"\n    },\n    \"isPlanForApartment\": {\n      \"@id\": \"schema:isPlanForApartment\"\n    },\n    \"isProprietary\": {\n      \"@id\": \"schema:isProprietary\"\n    },\n    \"isRelatedTo\": {\n      \"@id\": \"schema:isRelatedTo\"\n    },\n    \"isResizable\": {\n      \"@id\": \"schema:isResizable\"\n    },\n    \"isSimilarTo\": {\n      \"@id\": \"schema:isSimilarTo\"\n    },\n    \"isUnlabelledFallback\": {\n      \"@id\": \"schema:isUnlabelledFallback\"\n    },\n    \"isVariantOf\": {\n      \"@id\": \"schema:isVariantOf\"\n    },\n    \"isbn\": {\n      \"@id\": \"schema:isbn\"\n    },\n    \"isicV4\": {\n      \"@id\": \"schema:isicV4\"\n    },\n    \"iso6523Code\": {\n      \"@id\": \"schema:iso6523Code\"\n    },\n    \"isrcCode\": {\n      \"@id\": \"schema:isrcCode\"\n    },\n    \"issn\": {\n      \"@id\": \"schema:issn\"\n    },\n    \"issueNumber\": {\n      \"@id\": \"schema:issueNumber\"\n    },\n    \"issuedBy\": {\n      \"@id\": \"schema:issuedBy\"\n    },\n    \"issuedThrough\": {\n      \"@id\": \"schema:issuedThrough\"\n    },\n    \"iswcCode\": {\n      \"@id\": \"schema:iswcCode\"\n    },\n    \"item\": {\n      \"@id\": \"schema:item\"\n    },\n    \"itemCondition\": {\n      \"@id\": \"schema:itemCondition\"\n    },\n    \"itemDefectReturnFees\": {\n      \"@id\": \"schema:itemDefectReturnFees\"\n    },\n    \"itemDefectReturnLabelSource\": {\n      \"@id\": \"schema:itemDefectReturnLabelSource\"\n    },\n    \"itemDefectReturnShippingFeesAmount\": {\n      \"@id\": \"schema:itemDefectReturnShippingFeesAmount\"\n    },\n    \"itemListElement\": {\n      \"@id\": \"schema:itemListElement\"\n    },\n    \"itemListOrder\": {\n      \"@id\": \"schema:itemListOrder\"\n    },\n    \"itemLocation\": {\n      \"@id\": \"schema:itemLocation\"\n    },\n    \"itemOffered\": {\n      \"@id\": \"schema:itemOffered\"\n    },\n    \"itemReviewed\": {\n      \"@id\": \"schema:itemReviewed\"\n    },\n    \"itemShipped\": {\n      \"@id\": \"schema:itemShipped\"\n    },\n    \"itinerary\": {\n      \"@id\": \"schema:itinerary\"\n    },\n    \"iupacName\": {\n      \"@id\": \"schema:iupacName\"\n    },\n    \"jobBenefits\": {\n      \"@id\": \"schema:jobBenefits\"\n    },\n    \"jobImmediateStart\": {\n      \"@id\": \"schema:jobImmediateStart\"\n    },\n    \"jobLocation\": {\n      \"@id\": \"schema:jobLocation\"\n    },\n    \"jobLocationType\": {\n      \"@id\": \"schema:jobLocationType\"\n    },\n    \"jobStartDate\": {\n      \"@id\": \"schema:jobStartDate\"\n    },\n    \"jobTitle\": {\n      \"@id\": \"schema:jobTitle\"\n    },\n    \"jurisdiction\": {\n      \"@id\": \"schema:jurisdiction\"\n    },\n    \"keywords\": {\n      \"@id\": \"schema:keywords\"\n    },\n    \"knownVehicleDamages\": {\n      \"@id\": \"schema:knownVehicleDamages\"\n    },\n    \"knows\": {\n      \"@id\": \"schema:knows\"\n    },\n    \"knowsAbout\": {\n      \"@id\": \"schema:knowsAbout\"\n    },\n    \"knowsLanguage\": {\n      \"@id\": \"schema:knowsLanguage\"\n    },\n    \"labelDetails\": {\n      \"@id\": \"schema:labelDetails\",\n      \"@type\": \"@id\"\n    },\n    \"landlord\": {\n      \"@id\": \"schema:landlord\"\n    },\n    \"language\": {\n      \"@id\": \"schema:language\"\n    },\n    \"lastReviewed\": {\n      \"@id\": \"schema:lastReviewed\",\n      \"@type\": \"Date\"\n    },\n    \"latitude\": {\n      \"@id\": \"schema:latitude\"\n    },\n    \"layoutImage\": {\n      \"@id\": \"schema:layoutImage\",\n      \"@type\": \"@id\"\n    },\n    \"learningResourceType\": {\n      \"@id\": \"schema:learningResourceType\"\n    },\n    \"leaseLength\": {\n      \"@id\": \"schema:leaseLength\"\n    },\n    \"legalName\": {\n      \"@id\": \"schema:legalName\"\n    },\n    \"legalStatus\": {\n      \"@id\": \"schema:legalStatus\"\n    },\n    \"legislationApplies\": {\n      \"@id\": \"schema:legislationApplies\"\n    },\n    \"legislationChanges\": {\n      \"@id\": \"schema:legislationChanges\"\n    },\n    \"legislationConsolidates\": {\n      \"@id\": \"schema:legislationConsolidates\"\n    },\n    \"legislationDate\": {\n      \"@id\": \"schema:legislationDate\",\n      \"@type\": \"Date\"\n    },\n    \"legislationDateVersion\": {\n      \"@id\": \"schema:legislationDateVersion\",\n      \"@type\": \"Date\"\n    },\n    \"legislationIdentifier\": {\n      \"@id\": \"schema:legislationIdentifier\"\n    },\n    \"legislationJurisdiction\": {\n      \"@id\": \"schema:legislationJurisdiction\"\n    },\n    \"legislationLegalForce\": {\n      \"@id\": \"schema:legislationLegalForce\"\n    },\n    \"legislationLegalValue\": {\n      \"@id\": \"schema:legislationLegalValue\"\n    },\n    \"legislationPassedBy\": {\n      \"@id\": \"schema:legislationPassedBy\"\n    },\n    \"legislationResponsible\": {\n      \"@id\": \"schema:legislationResponsible\"\n    },\n    \"legislationTransposes\": {\n      \"@id\": \"schema:legislationTransposes\"\n    },\n    \"legislationType\": {\n      \"@id\": \"schema:legislationType\"\n    },\n    \"leiCode\": {\n      \"@id\": \"schema:leiCode\"\n    },\n    \"lender\": {\n      \"@id\": \"schema:lender\"\n    },\n    \"lesser\": {\n      \"@id\": \"schema:lesser\"\n    },\n    \"lesserOrEqual\": {\n      \"@id\": \"schema:lesserOrEqual\"\n    },\n    \"letterer\": {\n      \"@id\": \"schema:letterer\"\n    },\n    \"license\": {\n      \"@id\": \"schema:license\",\n      \"@type\": \"@id\"\n    },\n    \"line\": {\n      \"@id\": \"schema:line\"\n    },\n    \"linkRelationship\": {\n      \"@id\": \"schema:linkRelationship\"\n    },\n    \"liveBlogUpdate\": {\n      \"@id\": \"schema:liveBlogUpdate\"\n    },\n    \"loanMortgageMandateAmount\": {\n      \"@id\": \"schema:loanMortgageMandateAmount\"\n    },\n    \"loanPaymentAmount\": {\n      \"@id\": \"schema:loanPaymentAmount\"\n    },\n    \"loanPaymentFrequency\": {\n      \"@id\": \"schema:loanPaymentFrequency\"\n    },\n    \"loanRepaymentForm\": {\n      \"@id\": \"schema:loanRepaymentForm\"\n    },\n    \"loanTerm\": {\n      \"@id\": \"schema:loanTerm\"\n    },\n    \"loanType\": {\n      \"@id\": \"schema:loanType\"\n    },\n    \"location\": {\n      \"@id\": \"schema:location\"\n    },\n    \"locationCreated\": {\n      \"@id\": \"schema:locationCreated\"\n    },\n    \"lodgingUnitDescription\": {\n      \"@id\": \"schema:lodgingUnitDescription\"\n    },\n    \"lodgingUnitType\": {\n      \"@id\": \"schema:lodgingUnitType\"\n    },\n    \"logo\": {\n      \"@id\": \"schema:logo\",\n      \"@type\": \"@id\"\n    },\n    \"longitude\": {\n      \"@id\": \"schema:longitude\"\n    },\n    \"loser\": {\n      \"@id\": \"schema:loser\"\n    },\n    \"lowPrice\": {\n      \"@id\": \"schema:lowPrice\"\n    },\n    \"lyricist\": {\n      \"@id\": \"schema:lyricist\"\n    },\n    \"lyrics\": {\n      \"@id\": \"schema:lyrics\"\n    },\n    \"mainContentOfPage\": {\n      \"@id\": \"schema:mainContentOfPage\"\n    },\n    \"mainEntity\": {\n      \"@id\": \"schema:mainEntity\"\n    },\n    \"mainEntityOfPage\": {\n      \"@id\": \"schema:mainEntityOfPage\",\n      \"@type\": \"@id\"\n    },\n    \"maintainer\": {\n      \"@id\": \"schema:maintainer\"\n    },\n    \"makesOffer\": {\n      \"@id\": \"schema:makesOffer\"\n    },\n    \"manufacturer\": {\n      \"@id\": \"schema:manufacturer\"\n    },\n    \"map\": {\n      \"@id\": \"schema:map\",\n      \"@type\": \"@id\"\n    },\n    \"mapType\": {\n      \"@id\": \"schema:mapType\"\n    },\n    \"maps\": {\n      \"@id\": \"schema:maps\",\n      \"@type\": \"@id\"\n    },\n    \"marginOfError\": {\n      \"@id\": \"schema:marginOfError\"\n    },\n    \"masthead\": {\n      \"@id\": \"schema:masthead\",\n      \"@type\": \"@id\"\n    },\n    \"material\": {\n      \"@id\": \"schema:material\"\n    },\n    \"materialExtent\": {\n      \"@id\": \"schema:materialExtent\"\n    },\n    \"mathExpression\": {\n      \"@id\": \"schema:mathExpression\"\n    },\n    \"maxPrice\": {\n      \"@id\": \"schema:maxPrice\"\n    },\n    \"maxValue\": {\n      \"@id\": \"schema:maxValue\"\n    },\n    \"maximumAttendeeCapacity\": {\n      \"@id\": \"schema:maximumAttendeeCapacity\"\n    },\n    \"maximumEnrollment\": {\n      \"@id\": \"schema:maximumEnrollment\"\n    },\n    \"maximumIntake\": {\n      \"@id\": \"schema:maximumIntake\"\n    },\n    \"maximumPhysicalAttendeeCapacity\": {\n      \"@id\": \"schema:maximumPhysicalAttendeeCapacity\"\n    },\n    \"maximumVirtualAttendeeCapacity\": {\n      \"@id\": \"schema:maximumVirtualAttendeeCapacity\"\n    },\n    \"mealService\": {\n      \"@id\": \"schema:mealService\"\n    },\n    \"measuredProperty\": {\n      \"@id\": \"schema:measuredProperty\"\n    },\n    \"measuredValue\": {\n      \"@id\": \"schema:measuredValue\"\n    },\n    \"measurementTechnique\": {\n      \"@id\": \"schema:measurementTechnique\"\n    },\n    \"mechanismOfAction\": {\n      \"@id\": \"schema:mechanismOfAction\"\n    },\n    \"mediaAuthenticityCategory\": {\n      \"@id\": \"schema:mediaAuthenticityCategory\"\n    },\n    \"mediaItemAppearance\": {\n      \"@id\": \"schema:mediaItemAppearance\"\n    },\n    \"median\": {\n      \"@id\": \"schema:median\"\n    },\n    \"medicalAudience\": {\n      \"@id\": \"schema:medicalAudience\"\n    },\n    \"medicalSpecialty\": {\n      \"@id\": \"schema:medicalSpecialty\"\n    },\n    \"medicineSystem\": {\n      \"@id\": \"schema:medicineSystem\"\n    },\n    \"meetsEmissionStandard\": {\n      \"@id\": \"schema:meetsEmissionStandard\"\n    },\n    \"member\": {\n      \"@id\": \"schema:member\"\n    },\n    \"memberOf\": {\n      \"@id\": \"schema:memberOf\"\n    },\n    \"members\": {\n      \"@id\": \"schema:members\"\n    },\n    \"membershipNumber\": {\n      \"@id\": \"schema:membershipNumber\"\n    },\n    \"membershipPointsEarned\": {\n      \"@id\": \"schema:membershipPointsEarned\"\n    },\n    \"memoryRequirements\": {\n      \"@id\": \"schema:memoryRequirements\"\n    },\n    \"mentions\": {\n      \"@id\": \"schema:mentions\"\n    },\n    \"menu\": {\n      \"@id\": \"schema:menu\"\n    },\n    \"menuAddOn\": {\n      \"@id\": \"schema:menuAddOn\"\n    },\n    \"merchant\": {\n      \"@id\": \"schema:merchant\"\n    },\n    \"merchantReturnDays\": {\n      \"@id\": \"schema:merchantReturnDays\",\n      \"@type\": \"Date\"\n    },\n    \"merchantReturnLink\": {\n      \"@id\": \"schema:merchantReturnLink\",\n      \"@type\": \"@id\"\n    },\n    \"messageAttachment\": {\n      \"@id\": \"schema:messageAttachment\"\n    },\n    \"mileageFromOdometer\": {\n      \"@id\": \"schema:mileageFromOdometer\"\n    },\n    \"minPrice\": {\n      \"@id\": \"schema:minPrice\"\n    },\n    \"minValue\": {\n      \"@id\": \"schema:minValue\"\n    },\n    \"minimumPaymentDue\": {\n      \"@id\": \"schema:minimumPaymentDue\"\n    },\n    \"missionCoveragePrioritiesPolicy\": {\n      \"@id\": \"schema:missionCoveragePrioritiesPolicy\",\n      \"@type\": \"@id\"\n    },\n    \"mobileUrl\": {\n      \"@id\": \"schema:mobileUrl\"\n    },\n    \"model\": {\n      \"@id\": \"schema:model\"\n    },\n    \"modelDate\": {\n      \"@id\": \"schema:modelDate\",\n      \"@type\": \"Date\"\n    },\n    \"modifiedTime\": {\n      \"@id\": \"schema:modifiedTime\"\n    },\n    \"molecularFormula\": {\n      \"@id\": \"schema:molecularFormula\"\n    },\n    \"molecularWeight\": {\n      \"@id\": \"schema:molecularWeight\"\n    },\n    \"monoisotopicMolecularWeight\": {\n      \"@id\": \"schema:monoisotopicMolecularWeight\"\n    },\n    \"monthlyMinimumRepaymentAmount\": {\n      \"@id\": \"schema:monthlyMinimumRepaymentAmount\"\n    },\n    \"monthsOfExperience\": {\n      \"@id\": \"schema:monthsOfExperience\"\n    },\n    \"mpn\": {\n      \"@id\": \"schema:mpn\"\n    },\n    \"multipleValues\": {\n      \"@id\": \"schema:multipleValues\"\n    },\n    \"muscleAction\": {\n      \"@id\": \"schema:muscleAction\"\n    },\n    \"musicArrangement\": {\n      \"@id\": \"schema:musicArrangement\"\n    },\n    \"musicBy\": {\n      \"@id\": \"schema:musicBy\"\n    },\n    \"musicCompositionForm\": {\n      \"@id\": \"schema:musicCompositionForm\"\n    },\n    \"musicGroupMember\": {\n      \"@id\": \"schema:musicGroupMember\"\n    },\n    \"musicReleaseFormat\": {\n      \"@id\": \"schema:musicReleaseFormat\"\n    },\n    \"musicalKey\": {\n      \"@id\": \"schema:musicalKey\"\n    },\n    \"naics\": {\n      \"@id\": \"schema:naics\"\n    },\n    \"name\": {\n      \"@id\": \"schema:name\"\n    },\n    \"namedPosition\": {\n      \"@id\": \"schema:namedPosition\"\n    },\n    \"nationality\": {\n      \"@id\": \"schema:nationality\"\n    },\n    \"naturalProgression\": {\n      \"@id\": \"schema:naturalProgression\"\n    },\n    \"negativeNotes\": {\n      \"@id\": \"schema:negativeNotes\"\n    },\n    \"nerve\": {\n      \"@id\": \"schema:nerve\"\n    },\n    \"nerveMotor\": {\n      \"@id\": \"schema:nerveMotor\"\n    },\n    \"netWorth\": {\n      \"@id\": \"schema:netWorth\"\n    },\n    \"newsUpdatesAndGuidelines\": {\n      \"@id\": \"schema:newsUpdatesAndGuidelines\",\n      \"@type\": \"@id\"\n    },\n    \"nextItem\": {\n      \"@id\": \"schema:nextItem\"\n    },\n    \"noBylinesPolicy\": {\n      \"@id\": \"schema:noBylinesPolicy\",\n      \"@type\": \"@id\"\n    },\n    \"nonEqual\": {\n      \"@id\": \"schema:nonEqual\"\n    },\n    \"nonProprietaryName\": {\n      \"@id\": \"schema:nonProprietaryName\"\n    },\n    \"nonprofitStatus\": {\n      \"@id\": \"schema:nonprofitStatus\"\n    },\n    \"normalRange\": {\n      \"@id\": \"schema:normalRange\"\n    },\n    \"nsn\": {\n      \"@id\": \"schema:nsn\"\n    },\n    \"numAdults\": {\n      \"@id\": \"schema:numAdults\"\n    },\n    \"numChildren\": {\n      \"@id\": \"schema:numChildren\"\n    },\n    \"numConstraints\": {\n      \"@id\": \"schema:numConstraints\"\n    },\n    \"numTracks\": {\n      \"@id\": \"schema:numTracks\"\n    },\n    \"numberOfAccommodationUnits\": {\n      \"@id\": \"schema:numberOfAccommodationUnits\"\n    },\n    \"numberOfAirbags\": {\n      \"@id\": \"schema:numberOfAirbags\"\n    },\n    \"numberOfAvailableAccommodationUnits\": {\n      \"@id\": \"schema:numberOfAvailableAccommodationUnits\"\n    },\n    \"numberOfAxles\": {\n      \"@id\": \"schema:numberOfAxles\"\n    },\n    \"numberOfBathroomsTotal\": {\n      \"@id\": \"schema:numberOfBathroomsTotal\"\n    },\n    \"numberOfBedrooms\": {\n      \"@id\": \"schema:numberOfBedrooms\"\n    },\n    \"numberOfBeds\": {\n      \"@id\": \"schema:numberOfBeds\"\n    },\n    \"numberOfCredits\": {\n      \"@id\": \"schema:numberOfCredits\"\n    },\n    \"numberOfDoors\": {\n      \"@id\": \"schema:numberOfDoors\"\n    },\n    \"numberOfEmployees\": {\n      \"@id\": \"schema:numberOfEmployees\"\n    },\n    \"numberOfEpisodes\": {\n      \"@id\": \"schema:numberOfEpisodes\"\n    },\n    \"numberOfForwardGears\": {\n      \"@id\": \"schema:numberOfForwardGears\"\n    },\n    \"numberOfFullBathrooms\": {\n      \"@id\": \"schema:numberOfFullBathrooms\"\n    },\n    \"numberOfItems\": {\n      \"@id\": \"schema:numberOfItems\"\n    },\n    \"numberOfLoanPayments\": {\n      \"@id\": \"schema:numberOfLoanPayments\"\n    },\n    \"numberOfPages\": {\n      \"@id\": \"schema:numberOfPages\"\n    },\n    \"numberOfPartialBathrooms\": {\n      \"@id\": \"schema:numberOfPartialBathrooms\"\n    },\n    \"numberOfPlayers\": {\n      \"@id\": \"schema:numberOfPlayers\"\n    },\n    \"numberOfPreviousOwners\": {\n      \"@id\": \"schema:numberOfPreviousOwners\"\n    },\n    \"numberOfRooms\": {\n      \"@id\": \"schema:numberOfRooms\"\n    },\n    \"numberOfSeasons\": {\n      \"@id\": \"schema:numberOfSeasons\"\n    },\n    \"numberedPosition\": {\n      \"@id\": \"schema:numberedPosition\"\n    },\n    \"nutrition\": {\n      \"@id\": \"schema:nutrition\"\n    },\n    \"object\": {\n      \"@id\": \"schema:object\"\n    },\n    \"observationDate\": {\n      \"@id\": \"schema:observationDate\"\n    },\n    \"observedNode\": {\n      \"@id\": \"schema:observedNode\"\n    },\n    \"occupancy\": {\n      \"@id\": \"schema:occupancy\"\n    },\n    \"occupationLocation\": {\n      \"@id\": \"schema:occupationLocation\"\n    },\n    \"occupationalCategory\": {\n      \"@id\": \"schema:occupationalCategory\"\n    },\n    \"occupationalCredentialAwarded\": {\n      \"@id\": \"schema:occupationalCredentialAwarded\"\n    },\n    \"offerCount\": {\n      \"@id\": \"schema:offerCount\"\n    },\n    \"offeredBy\": {\n      \"@id\": \"schema:offeredBy\"\n    },\n    \"offers\": {\n      \"@id\": \"schema:offers\"\n    },\n    \"offersPrescriptionByMail\": {\n      \"@id\": \"schema:offersPrescriptionByMail\"\n    },\n    \"openingHours\": {\n      \"@id\": \"schema:openingHours\"\n    },\n    \"openingHoursSpecification\": {\n      \"@id\": \"schema:openingHoursSpecification\"\n    },\n    \"opens\": {\n      \"@id\": \"schema:opens\"\n    },\n    \"operatingSystem\": {\n      \"@id\": \"schema:operatingSystem\"\n    },\n    \"opponent\": {\n      \"@id\": \"schema:opponent\"\n    },\n    \"option\": {\n      \"@id\": \"schema:option\"\n    },\n    \"orderDate\": {\n      \"@id\": \"schema:orderDate\",\n      \"@type\": \"Date\"\n    },\n    \"orderDelivery\": {\n      \"@id\": \"schema:orderDelivery\"\n    },\n    \"orderItemNumber\": {\n      \"@id\": \"schema:orderItemNumber\"\n    },\n    \"orderItemStatus\": {\n      \"@id\": \"schema:orderItemStatus\"\n    },\n    \"orderNumber\": {\n      \"@id\": \"schema:orderNumber\"\n    },\n    \"orderQuantity\": {\n      \"@id\": \"schema:orderQuantity\"\n    },\n    \"orderStatus\": {\n      \"@id\": \"schema:orderStatus\"\n    },\n    \"orderedItem\": {\n      \"@id\": \"schema:orderedItem\"\n    },\n    \"organizer\": {\n      \"@id\": \"schema:organizer\"\n    },\n    \"originAddress\": {\n      \"@id\": \"schema:originAddress\"\n    },\n    \"originalMediaContextDescription\": {\n      \"@id\": \"schema:originalMediaContextDescription\"\n    },\n    \"originalMediaLink\": {\n      \"@id\": \"schema:originalMediaLink\",\n      \"@type\": \"@id\"\n    },\n    \"originatesFrom\": {\n      \"@id\": \"schema:originatesFrom\"\n    },\n    \"overdosage\": {\n      \"@id\": \"schema:overdosage\"\n    },\n    \"ownedFrom\": {\n      \"@id\": \"schema:ownedFrom\"\n    },\n    \"ownedThrough\": {\n      \"@id\": \"schema:ownedThrough\"\n    },\n    \"ownershipFundingInfo\": {\n      \"@id\": \"schema:ownershipFundingInfo\"\n    },\n    \"owns\": {\n      \"@id\": \"schema:owns\"\n    },\n    \"pageEnd\": {\n      \"@id\": \"schema:pageEnd\"\n    },\n    \"pageStart\": {\n      \"@id\": \"schema:pageStart\"\n    },\n    \"pagination\": {\n      \"@id\": \"schema:pagination\"\n    },\n    \"parent\": {\n      \"@id\": \"schema:parent\"\n    },\n    \"parentItem\": {\n      \"@id\": \"schema:parentItem\"\n    },\n    \"parentOrganization\": {\n      \"@id\": \"schema:parentOrganization\"\n    },\n    \"parentService\": {\n      \"@id\": \"schema:parentService\"\n    },\n    \"parentTaxon\": {\n      \"@id\": \"schema:parentTaxon\"\n    },\n    \"parents\": {\n      \"@id\": \"schema:parents\"\n    },\n    \"partOfEpisode\": {\n      \"@id\": \"schema:partOfEpisode\"\n    },\n    \"partOfInvoice\": {\n      \"@id\": \"schema:partOfInvoice\"\n    },\n    \"partOfOrder\": {\n      \"@id\": \"schema:partOfOrder\"\n    },\n    \"partOfSeason\": {\n      \"@id\": \"schema:partOfSeason\"\n    },\n    \"partOfSeries\": {\n      \"@id\": \"schema:partOfSeries\"\n    },\n    \"partOfSystem\": {\n      \"@id\": \"schema:partOfSystem\"\n    },\n    \"partOfTVSeries\": {\n      \"@id\": \"schema:partOfTVSeries\"\n    },\n    \"partOfTrip\": {\n      \"@id\": \"schema:partOfTrip\"\n    },\n    \"participant\": {\n      \"@id\": \"schema:participant\"\n    },\n    \"partySize\": {\n      \"@id\": \"schema:partySize\"\n    },\n    \"passengerPriorityStatus\": {\n      \"@id\": \"schema:passengerPriorityStatus\"\n    },\n    \"passengerSequenceNumber\": {\n      \"@id\": \"schema:passengerSequenceNumber\"\n    },\n    \"pathophysiology\": {\n      \"@id\": \"schema:pathophysiology\"\n    },\n    \"pattern\": {\n      \"@id\": \"schema:pattern\"\n    },\n    \"payload\": {\n      \"@id\": \"schema:payload\"\n    },\n    \"paymentAccepted\": {\n      \"@id\": \"schema:paymentAccepted\"\n    },\n    \"paymentDue\": {\n      \"@id\": \"schema:paymentDue\"\n    },\n    \"paymentDueDate\": {\n      \"@id\": \"schema:paymentDueDate\",\n      \"@type\": \"Date\"\n    },\n    \"paymentMethod\": {\n      \"@id\": \"schema:paymentMethod\"\n    },\n    \"paymentMethodId\": {\n      \"@id\": \"schema:paymentMethodId\"\n    },\n    \"paymentStatus\": {\n      \"@id\": \"schema:paymentStatus\"\n    },\n    \"paymentUrl\": {\n      \"@id\": \"schema:paymentUrl\",\n      \"@type\": \"@id\"\n    },\n    \"penciler\": {\n      \"@id\": \"schema:penciler\"\n    },\n    \"percentile10\": {\n      \"@id\": \"schema:percentile10\"\n    },\n    \"percentile25\": {\n      \"@id\": \"schema:percentile25\"\n    },\n    \"percentile75\": {\n      \"@id\": \"schema:percentile75\"\n    },\n    \"percentile90\": {\n      \"@id\": \"schema:percentile90\"\n    },\n    \"performTime\": {\n      \"@id\": \"schema:performTime\"\n    },\n    \"performer\": {\n      \"@id\": \"schema:performer\"\n    },\n    \"performerIn\": {\n      \"@id\": \"schema:performerIn\"\n    },\n    \"performers\": {\n      \"@id\": \"schema:performers\"\n    },\n    \"permissionType\": {\n      \"@id\": \"schema:permissionType\"\n    },\n    \"permissions\": {\n      \"@id\": \"schema:permissions\"\n    },\n    \"permitAudience\": {\n      \"@id\": \"schema:permitAudience\"\n    },\n    \"permittedUsage\": {\n      \"@id\": \"schema:permittedUsage\"\n    },\n    \"petsAllowed\": {\n      \"@id\": \"schema:petsAllowed\"\n    },\n    \"phoneticText\": {\n      \"@id\": \"schema:phoneticText\"\n    },\n    \"photo\": {\n      \"@id\": \"schema:photo\"\n    },\n    \"photos\": {\n      \"@id\": \"schema:photos\"\n    },\n    \"physicalRequirement\": {\n      \"@id\": \"schema:physicalRequirement\"\n    },\n    \"physiologicalBenefits\": {\n      \"@id\": \"schema:physiologicalBenefits\"\n    },\n    \"pickupLocation\": {\n      \"@id\": \"schema:pickupLocation\"\n    },\n    \"pickupTime\": {\n      \"@id\": \"schema:pickupTime\"\n    },\n    \"playMode\": {\n      \"@id\": \"schema:playMode\"\n    },\n    \"playerType\": {\n      \"@id\": \"schema:playerType\"\n    },\n    \"playersOnline\": {\n      \"@id\": \"schema:playersOnline\"\n    },\n    \"polygon\": {\n      \"@id\": \"schema:polygon\"\n    },\n    \"populationType\": {\n      \"@id\": \"schema:populationType\"\n    },\n    \"position\": {\n      \"@id\": \"schema:position\"\n    },\n    \"positiveNotes\": {\n      \"@id\": \"schema:positiveNotes\"\n    },\n    \"possibleComplication\": {\n      \"@id\": \"schema:possibleComplication\"\n    },\n    \"possibleTreatment\": {\n      \"@id\": \"schema:possibleTreatment\"\n    },\n    \"postOfficeBoxNumber\": {\n      \"@id\": \"schema:postOfficeBoxNumber\"\n    },\n    \"postOp\": {\n      \"@id\": \"schema:postOp\"\n    },\n    \"postalCode\": {\n      \"@id\": \"schema:postalCode\"\n    },\n    \"postalCodeBegin\": {\n      \"@id\": \"schema:postalCodeBegin\"\n    },\n    \"postalCodeEnd\": {\n      \"@id\": \"schema:postalCodeEnd\"\n    },\n    \"postalCodePrefix\": {\n      \"@id\": \"schema:postalCodePrefix\"\n    },\n    \"postalCodeRange\": {\n      \"@id\": \"schema:postalCodeRange\"\n    },\n    \"potentialAction\": {\n      \"@id\": \"schema:potentialAction\"\n    },\n    \"potentialUse\": {\n      \"@id\": \"schema:potentialUse\"\n    },\n    \"preOp\": {\n      \"@id\": \"schema:preOp\"\n    },\n    \"predecessorOf\": {\n      \"@id\": \"schema:predecessorOf\"\n    },\n    \"pregnancyCategory\": {\n      \"@id\": \"schema:pregnancyCategory\"\n    },\n    \"pregnancyWarning\": {\n      \"@id\": \"schema:pregnancyWarning\"\n    },\n    \"prepTime\": {\n      \"@id\": \"schema:prepTime\"\n    },\n    \"preparation\": {\n      \"@id\": \"schema:preparation\"\n    },\n    \"prescribingInfo\": {\n      \"@id\": \"schema:prescribingInfo\",\n      \"@type\": \"@id\"\n    },\n    \"prescriptionStatus\": {\n      \"@id\": \"schema:prescriptionStatus\"\n    },\n    \"previousItem\": {\n      \"@id\": \"schema:previousItem\"\n    },\n    \"previousStartDate\": {\n      \"@id\": \"schema:previousStartDate\",\n      \"@type\": \"Date\"\n    },\n    \"price\": {\n      \"@id\": \"schema:price\"\n    },\n    \"priceComponent\": {\n      \"@id\": \"schema:priceComponent\"\n    },\n    \"priceComponentType\": {\n      \"@id\": \"schema:priceComponentType\"\n    },\n    \"priceCurrency\": {\n      \"@id\": \"schema:priceCurrency\"\n    },\n    \"priceRange\": {\n      \"@id\": \"schema:priceRange\"\n    },\n    \"priceSpecification\": {\n      \"@id\": \"schema:priceSpecification\"\n    },\n    \"priceType\": {\n      \"@id\": \"schema:priceType\"\n    },\n    \"priceValidUntil\": {\n      \"@id\": \"schema:priceValidUntil\",\n      \"@type\": \"Date\"\n    },\n    \"primaryImageOfPage\": {\n      \"@id\": \"schema:primaryImageOfPage\"\n    },\n    \"primaryPrevention\": {\n      \"@id\": \"schema:primaryPrevention\"\n    },\n    \"printColumn\": {\n      \"@id\": \"schema:printColumn\"\n    },\n    \"printEdition\": {\n      \"@id\": \"schema:printEdition\"\n    },\n    \"printPage\": {\n      \"@id\": \"schema:printPage\"\n    },\n    \"printSection\": {\n      \"@id\": \"schema:printSection\"\n    },\n    \"procedure\": {\n      \"@id\": \"schema:procedure\"\n    },\n    \"procedureType\": {\n      \"@id\": \"schema:procedureType\"\n    },\n    \"processingTime\": {\n      \"@id\": \"schema:processingTime\"\n    },\n    \"processorRequirements\": {\n      \"@id\": \"schema:processorRequirements\"\n    },\n    \"producer\": {\n      \"@id\": \"schema:producer\"\n    },\n    \"produces\": {\n      \"@id\": \"schema:produces\"\n    },\n    \"productGroupID\": {\n      \"@id\": \"schema:productGroupID\"\n    },\n    \"productID\": {\n      \"@id\": \"schema:productID\"\n    },\n    \"productReturnDays\": {\n      \"@id\": \"schema:productReturnDays\"\n    },\n    \"productReturnLink\": {\n      \"@id\": \"schema:productReturnLink\",\n      \"@type\": \"@id\"\n    },\n    \"productSupported\": {\n      \"@id\": \"schema:productSupported\"\n    },\n    \"productionCompany\": {\n      \"@id\": \"schema:productionCompany\"\n    },\n    \"productionDate\": {\n      \"@id\": \"schema:productionDate\",\n      \"@type\": \"Date\"\n    },\n    \"proficiencyLevel\": {\n      \"@id\": \"schema:proficiencyLevel\"\n    },\n    \"programMembershipUsed\": {\n      \"@id\": \"schema:programMembershipUsed\"\n    },\n    \"programName\": {\n      \"@id\": \"schema:programName\"\n    },\n    \"programPrerequisites\": {\n      \"@id\": \"schema:programPrerequisites\"\n    },\n    \"programType\": {\n      \"@id\": \"schema:programType\"\n    },\n    \"programmingLanguage\": {\n      \"@id\": \"schema:programmingLanguage\"\n    },\n    \"programmingModel\": {\n      \"@id\": \"schema:programmingModel\"\n    },\n    \"propertyID\": {\n      \"@id\": \"schema:propertyID\"\n    },\n    \"proprietaryName\": {\n      \"@id\": \"schema:proprietaryName\"\n    },\n    \"proteinContent\": {\n      \"@id\": \"schema:proteinContent\"\n    },\n    \"provider\": {\n      \"@id\": \"schema:provider\"\n    },\n    \"providerMobility\": {\n      \"@id\": \"schema:providerMobility\"\n    },\n    \"providesBroadcastService\": {\n      \"@id\": \"schema:providesBroadcastService\"\n    },\n    \"providesService\": {\n      \"@id\": \"schema:providesService\"\n    },\n    \"publicAccess\": {\n      \"@id\": \"schema:publicAccess\"\n    },\n    \"publicTransportClosuresInfo\": {\n      \"@id\": \"schema:publicTransportClosuresInfo\",\n      \"@type\": \"@id\"\n    },\n    \"publication\": {\n      \"@id\": \"schema:publication\"\n    },\n    \"publicationType\": {\n      \"@id\": \"schema:publicationType\"\n    },\n    \"publishedBy\": {\n      \"@id\": \"schema:publishedBy\"\n    },\n    \"publishedOn\": {\n      \"@id\": \"schema:publishedOn\"\n    },\n    \"publisher\": {\n      \"@id\": \"schema:publisher\"\n    },\n    \"publisherImprint\": {\n      \"@id\": \"schema:publisherImprint\"\n    },\n    \"publishingPrinciples\": {\n      \"@id\": \"schema:publishingPrinciples\",\n      \"@type\": \"@id\"\n    },\n    \"purchaseDate\": {\n      \"@id\": \"schema:purchaseDate\",\n      \"@type\": \"Date\"\n    },\n    \"qualifications\": {\n      \"@id\": \"schema:qualifications\"\n    },\n    \"quarantineGuidelines\": {\n      \"@id\": \"schema:quarantineGuidelines\",\n      \"@type\": \"@id\"\n    },\n    \"query\": {\n      \"@id\": \"schema:query\"\n    },\n    \"quest\": {\n      \"@id\": \"schema:quest\"\n    },\n    \"question\": {\n      \"@id\": \"schema:question\"\n    },\n    \"rangeIncludes\": {\n      \"@id\": \"schema:rangeIncludes\"\n    },\n    \"ratingCount\": {\n      \"@id\": \"schema:ratingCount\"\n    },\n    \"ratingExplanation\": {\n      \"@id\": \"schema:ratingExplanation\"\n    },\n    \"ratingValue\": {\n      \"@id\": \"schema:ratingValue\"\n    },\n    \"readBy\": {\n      \"@id\": \"schema:readBy\"\n    },\n    \"readonlyValue\": {\n      \"@id\": \"schema:readonlyValue\"\n    },\n    \"realEstateAgent\": {\n      \"@id\": \"schema:realEstateAgent\"\n    },\n    \"recipe\": {\n      \"@id\": \"schema:recipe\"\n    },\n    \"recipeCategory\": {\n      \"@id\": \"schema:recipeCategory\"\n    },\n    \"recipeCuisine\": {\n      \"@id\": \"schema:recipeCuisine\"\n    },\n    \"recipeIngredient\": {\n      \"@id\": \"schema:recipeIngredient\"\n    },\n    \"recipeInstructions\": {\n      \"@id\": \"schema:recipeInstructions\"\n    },\n    \"recipeYield\": {\n      \"@id\": \"schema:recipeYield\"\n    },\n    \"recipient\": {\n      \"@id\": \"schema:recipient\"\n    },\n    \"recognizedBy\": {\n      \"@id\": \"schema:recognizedBy\"\n    },\n    \"recognizingAuthority\": {\n      \"@id\": \"schema:recognizingAuthority\"\n    },\n    \"recommendationStrength\": {\n      \"@id\": \"schema:recommendationStrength\"\n    },\n    \"recommendedIntake\": {\n      \"@id\": \"schema:recommendedIntake\"\n    },\n    \"recordLabel\": {\n      \"@id\": \"schema:recordLabel\"\n    },\n    \"recordedAs\": {\n      \"@id\": \"schema:recordedAs\"\n    },\n    \"recordedAt\": {\n      \"@id\": \"schema:recordedAt\"\n    },\n    \"recordedIn\": {\n      \"@id\": \"schema:recordedIn\"\n    },\n    \"recordingOf\": {\n      \"@id\": \"schema:recordingOf\"\n    },\n    \"recourseLoan\": {\n      \"@id\": \"schema:recourseLoan\"\n    },\n    \"referenceQuantity\": {\n      \"@id\": \"schema:referenceQuantity\"\n    },\n    \"referencesOrder\": {\n      \"@id\": \"schema:referencesOrder\"\n    },\n    \"refundType\": {\n      \"@id\": \"schema:refundType\"\n    },\n    \"regionDrained\": {\n      \"@id\": \"schema:regionDrained\"\n    },\n    \"regionsAllowed\": {\n      \"@id\": \"schema:regionsAllowed\"\n    },\n    \"relatedAnatomy\": {\n      \"@id\": \"schema:relatedAnatomy\"\n    },\n    \"relatedCondition\": {\n      \"@id\": \"schema:relatedCondition\"\n    },\n    \"relatedDrug\": {\n      \"@id\": \"schema:relatedDrug\"\n    },\n    \"relatedLink\": {\n      \"@id\": \"schema:relatedLink\",\n      \"@type\": \"@id\"\n    },\n    \"relatedStructure\": {\n      \"@id\": \"schema:relatedStructure\"\n    },\n    \"relatedTherapy\": {\n      \"@id\": \"schema:relatedTherapy\"\n    },\n    \"relatedTo\": {\n      \"@id\": \"schema:relatedTo\"\n    },\n    \"releaseDate\": {\n      \"@id\": \"schema:releaseDate\",\n      \"@type\": \"Date\"\n    },\n    \"releaseNotes\": {\n      \"@id\": \"schema:releaseNotes\"\n    },\n    \"releaseOf\": {\n      \"@id\": \"schema:releaseOf\"\n    },\n    \"releasedEvent\": {\n      \"@id\": \"schema:releasedEvent\"\n    },\n    \"relevantOccupation\": {\n      \"@id\": \"schema:relevantOccupation\"\n    },\n    \"relevantSpecialty\": {\n      \"@id\": \"schema:relevantSpecialty\"\n    },\n    \"remainingAttendeeCapacity\": {\n      \"@id\": \"schema:remainingAttendeeCapacity\"\n    },\n    \"renegotiableLoan\": {\n      \"@id\": \"schema:renegotiableLoan\"\n    },\n    \"repeatCount\": {\n      \"@id\": \"schema:repeatCount\"\n    },\n    \"repeatFrequency\": {\n      \"@id\": \"schema:repeatFrequency\"\n    },\n    \"repetitions\": {\n      \"@id\": \"schema:repetitions\"\n    },\n    \"replacee\": {\n      \"@id\": \"schema:replacee\"\n    },\n    \"replacer\": {\n      \"@id\": \"schema:replacer\"\n    },\n    \"replyToUrl\": {\n      \"@id\": \"schema:replyToUrl\",\n      \"@type\": \"@id\"\n    },\n    \"reportNumber\": {\n      \"@id\": \"schema:reportNumber\"\n    },\n    \"representativeOfPage\": {\n      \"@id\": \"schema:representativeOfPage\"\n    },\n    \"requiredCollateral\": {\n      \"@id\": \"schema:requiredCollateral\"\n    },\n    \"requiredGender\": {\n      \"@id\": \"schema:requiredGender\"\n    },\n    \"requiredMaxAge\": {\n      \"@id\": \"schema:requiredMaxAge\"\n    },\n    \"requiredMinAge\": {\n      \"@id\": \"schema:requiredMinAge\"\n    },\n    \"requiredQuantity\": {\n      \"@id\": \"schema:requiredQuantity\"\n    },\n    \"requirements\": {\n      \"@id\": \"schema:requirements\"\n    },\n    \"requiresSubscription\": {\n      \"@id\": \"schema:requiresSubscription\"\n    },\n    \"reservationFor\": {\n      \"@id\": \"schema:reservationFor\"\n    },\n    \"reservationId\": {\n      \"@id\": \"schema:reservationId\"\n    },\n    \"reservationStatus\": {\n      \"@id\": \"schema:reservationStatus\"\n    },\n    \"reservedTicket\": {\n      \"@id\": \"schema:reservedTicket\"\n    },\n    \"responsibilities\": {\n      \"@id\": \"schema:responsibilities\"\n    },\n    \"restPeriods\": {\n      \"@id\": \"schema:restPeriods\"\n    },\n    \"restockingFee\": {\n      \"@id\": \"schema:restockingFee\"\n    },\n    \"result\": {\n      \"@id\": \"schema:result\"\n    },\n    \"resultComment\": {\n      \"@id\": \"schema:resultComment\"\n    },\n    \"resultReview\": {\n      \"@id\": \"schema:resultReview\"\n    },\n    \"returnFees\": {\n      \"@id\": \"schema:returnFees\"\n    },\n    \"returnLabelSource\": {\n      \"@id\": \"schema:returnLabelSource\"\n    },\n    \"returnMethod\": {\n      \"@id\": \"schema:returnMethod\"\n    },\n    \"returnPolicyCategory\": {\n      \"@id\": \"schema:returnPolicyCategory\"\n    },\n    \"returnPolicyCountry\": {\n      \"@id\": \"schema:returnPolicyCountry\"\n    },\n    \"returnPolicySeasonalOverride\": {\n      \"@id\": \"schema:returnPolicySeasonalOverride\"\n    },\n    \"returnShippingFeesAmount\": {\n      \"@id\": \"schema:returnShippingFeesAmount\"\n    },\n    \"review\": {\n      \"@id\": \"schema:review\"\n    },\n    \"reviewAspect\": {\n      \"@id\": \"schema:reviewAspect\"\n    },\n    \"reviewBody\": {\n      \"@id\": \"schema:reviewBody\"\n    },\n    \"reviewCount\": {\n      \"@id\": \"schema:reviewCount\"\n    },\n    \"reviewRating\": {\n      \"@id\": \"schema:reviewRating\"\n    },\n    \"reviewedBy\": {\n      \"@id\": \"schema:reviewedBy\"\n    },\n    \"reviews\": {\n      \"@id\": \"schema:reviews\"\n    },\n    \"riskFactor\": {\n      \"@id\": \"schema:riskFactor\"\n    },\n    \"risks\": {\n      \"@id\": \"schema:risks\"\n    },\n    \"roleName\": {\n      \"@id\": \"schema:roleName\"\n    },\n    \"roofLoad\": {\n      \"@id\": \"schema:roofLoad\"\n    },\n    \"rsvpResponse\": {\n      \"@id\": \"schema:rsvpResponse\"\n    },\n    \"runsTo\": {\n      \"@id\": \"schema:runsTo\"\n    },\n    \"runtime\": {\n      \"@id\": \"schema:runtime\"\n    },\n    \"runtimePlatform\": {\n      \"@id\": \"schema:runtimePlatform\"\n    },\n    \"rxcui\": {\n      \"@id\": \"schema:rxcui\"\n    },\n    \"safetyConsideration\": {\n      \"@id\": \"schema:safetyConsideration\"\n    },\n    \"salaryCurrency\": {\n      \"@id\": \"schema:salaryCurrency\"\n    },\n    \"salaryUponCompletion\": {\n      \"@id\": \"schema:salaryUponCompletion\"\n    },\n    \"sameAs\": {\n      \"@id\": \"schema:sameAs\",\n      \"@type\": \"@id\"\n    },\n    \"sampleType\": {\n      \"@id\": \"schema:sampleType\"\n    },\n    \"saturatedFatContent\": {\n      \"@id\": \"schema:saturatedFatContent\"\n    },\n    \"scheduleTimezone\": {\n      \"@id\": \"schema:scheduleTimezone\"\n    },\n    \"scheduledPaymentDate\": {\n      \"@id\": \"schema:scheduledPaymentDate\",\n      \"@type\": \"Date\"\n    },\n    \"scheduledTime\": {\n      \"@id\": \"schema:scheduledTime\"\n    },\n    \"schemaVersion\": {\n      \"@id\": \"schema:schemaVersion\"\n    },\n    \"schoolClosuresInfo\": {\n      \"@id\": \"schema:schoolClosuresInfo\",\n      \"@type\": \"@id\"\n    },\n    \"screenCount\": {\n      \"@id\": \"schema:screenCount\"\n    },\n    \"screenshot\": {\n      \"@id\": \"schema:screenshot\",\n      \"@type\": \"@id\"\n    },\n    \"sdDatePublished\": {\n      \"@id\": \"schema:sdDatePublished\",\n      \"@type\": \"Date\"\n    },\n    \"sdLicense\": {\n      \"@id\": \"schema:sdLicense\",\n      \"@type\": \"@id\"\n    },\n    \"sdPublisher\": {\n      \"@id\": \"schema:sdPublisher\"\n    },\n    \"season\": {\n      \"@id\": \"schema:season\",\n      \"@type\": \"@id\"\n    },\n    \"seasonNumber\": {\n      \"@id\": \"schema:seasonNumber\"\n    },\n    \"seasons\": {\n      \"@id\": \"schema:seasons\"\n    },\n    \"seatNumber\": {\n      \"@id\": \"schema:seatNumber\"\n    },\n    \"seatRow\": {\n      \"@id\": \"schema:seatRow\"\n    },\n    \"seatSection\": {\n      \"@id\": \"schema:seatSection\"\n    },\n    \"seatingCapacity\": {\n      \"@id\": \"schema:seatingCapacity\"\n    },\n    \"seatingType\": {\n      \"@id\": \"schema:seatingType\"\n    },\n    \"secondaryPrevention\": {\n      \"@id\": \"schema:secondaryPrevention\"\n    },\n    \"securityClearanceRequirement\": {\n      \"@id\": \"schema:securityClearanceRequirement\"\n    },\n    \"securityScreening\": {\n      \"@id\": \"schema:securityScreening\"\n    },\n    \"seeks\": {\n      \"@id\": \"schema:seeks\"\n    },\n    \"seller\": {\n      \"@id\": \"schema:seller\"\n    },\n    \"sender\": {\n      \"@id\": \"schema:sender\"\n    },\n    \"sensoryRequirement\": {\n      \"@id\": \"schema:sensoryRequirement\"\n    },\n    \"sensoryUnit\": {\n      \"@id\": \"schema:sensoryUnit\"\n    },\n    \"serialNumber\": {\n      \"@id\": \"schema:serialNumber\"\n    },\n    \"seriousAdverseOutcome\": {\n      \"@id\": \"schema:seriousAdverseOutcome\"\n    },\n    \"serverStatus\": {\n      \"@id\": \"schema:serverStatus\"\n    },\n    \"servesCuisine\": {\n      \"@id\": \"schema:servesCuisine\"\n    },\n    \"serviceArea\": {\n      \"@id\": \"schema:serviceArea\"\n    },\n    \"serviceAudience\": {\n      \"@id\": \"schema:serviceAudience\"\n    },\n    \"serviceLocation\": {\n      \"@id\": \"schema:serviceLocation\"\n    },\n    \"serviceOperator\": {\n      \"@id\": \"schema:serviceOperator\"\n    },\n    \"serviceOutput\": {\n      \"@id\": \"schema:serviceOutput\"\n    },\n    \"servicePhone\": {\n      \"@id\": \"schema:servicePhone\"\n    },\n    \"servicePostalAddress\": {\n      \"@id\": \"schema:servicePostalAddress\"\n    },\n    \"serviceSmsNumber\": {\n      \"@id\": \"schema:serviceSmsNumber\"\n    },\n    \"serviceType\": {\n      \"@id\": \"schema:serviceType\"\n    },\n    \"serviceUrl\": {\n      \"@id\": \"schema:serviceUrl\",\n      \"@type\": \"@id\"\n    },\n    \"servingSize\": {\n      \"@id\": \"schema:servingSize\"\n    },\n    \"sha256\": {\n      \"@id\": \"schema:sha256\"\n    },\n    \"sharedContent\": {\n      \"@id\": \"schema:sharedContent\"\n    },\n    \"shippingDestination\": {\n      \"@id\": \"schema:shippingDestination\"\n    },\n    \"shippingDetails\": {\n      \"@id\": \"schema:shippingDetails\"\n    },\n    \"shippingLabel\": {\n      \"@id\": \"schema:shippingLabel\"\n    },\n    \"shippingOrigin\": {\n      \"@id\": \"schema:shippingOrigin\"\n    },\n    \"shippingRate\": {\n      \"@id\": \"schema:shippingRate\"\n    },\n    \"shippingSettingsLink\": {\n      \"@id\": \"schema:shippingSettingsLink\",\n      \"@type\": \"@id\"\n    },\n    \"sibling\": {\n      \"@id\": \"schema:sibling\"\n    },\n    \"siblings\": {\n      \"@id\": \"schema:siblings\"\n    },\n    \"signDetected\": {\n      \"@id\": \"schema:signDetected\"\n    },\n    \"signOrSymptom\": {\n      \"@id\": \"schema:signOrSymptom\"\n    },\n    \"significance\": {\n      \"@id\": \"schema:significance\"\n    },\n    \"significantLink\": {\n      \"@id\": \"schema:significantLink\",\n      \"@type\": \"@id\"\n    },\n    \"significantLinks\": {\n      \"@id\": \"schema:significantLinks\",\n      \"@type\": \"@id\"\n    },\n    \"size\": {\n      \"@id\": \"schema:size\"\n    },\n    \"sizeGroup\": {\n      \"@id\": \"schema:sizeGroup\"\n    },\n    \"sizeSystem\": {\n      \"@id\": \"schema:sizeSystem\"\n    },\n    \"skills\": {\n      \"@id\": \"schema:skills\"\n    },\n    \"sku\": {\n      \"@id\": \"schema:sku\"\n    },\n    \"slogan\": {\n      \"@id\": \"schema:slogan\"\n    },\n    \"smiles\": {\n      \"@id\": \"schema:smiles\"\n    },\n    \"smokingAllowed\": {\n      \"@id\": \"schema:smokingAllowed\"\n    },\n    \"sodiumContent\": {\n      \"@id\": \"schema:sodiumContent\"\n    },\n    \"softwareAddOn\": {\n      \"@id\": \"schema:softwareAddOn\"\n    },\n    \"softwareHelp\": {\n      \"@id\": \"schema:softwareHelp\"\n    },\n    \"softwareRequirements\": {\n      \"@id\": \"schema:softwareRequirements\"\n    },\n    \"softwareVersion\": {\n      \"@id\": \"schema:softwareVersion\"\n    },\n    \"sourceOrganization\": {\n      \"@id\": \"schema:sourceOrganization\"\n    },\n    \"sourcedFrom\": {\n      \"@id\": \"schema:sourcedFrom\"\n    },\n    \"spatial\": {\n      \"@id\": \"schema:spatial\"\n    },\n    \"spatialCoverage\": {\n      \"@id\": \"schema:spatialCoverage\"\n    },\n    \"speakable\": {\n      \"@id\": \"schema:speakable\",\n      \"@type\": \"@id\"\n    },\n    \"specialCommitments\": {\n      \"@id\": \"schema:specialCommitments\"\n    },\n    \"specialOpeningHoursSpecification\": {\n      \"@id\": \"schema:specialOpeningHoursSpecification\"\n    },\n    \"specialty\": {\n      \"@id\": \"schema:specialty\"\n    },\n    \"speechToTextMarkup\": {\n      \"@id\": \"schema:speechToTextMarkup\"\n    },\n    \"speed\": {\n      \"@id\": \"schema:speed\"\n    },\n    \"spokenByCharacter\": {\n      \"@id\": \"schema:spokenByCharacter\"\n    },\n    \"sponsor\": {\n      \"@id\": \"schema:sponsor\"\n    },\n    \"sport\": {\n      \"@id\": \"schema:sport\"\n    },\n    \"sportsActivityLocation\": {\n      \"@id\": \"schema:sportsActivityLocation\"\n    },\n    \"sportsEvent\": {\n      \"@id\": \"schema:sportsEvent\"\n    },\n    \"sportsTeam\": {\n      \"@id\": \"schema:sportsTeam\"\n    },\n    \"spouse\": {\n      \"@id\": \"schema:spouse\"\n    },\n    \"stage\": {\n      \"@id\": \"schema:stage\"\n    },\n    \"stageAsNumber\": {\n      \"@id\": \"schema:stageAsNumber\"\n    },\n    \"starRating\": {\n      \"@id\": \"schema:starRating\"\n    },\n    \"startDate\": {\n      \"@id\": \"schema:startDate\",\n      \"@type\": \"Date\"\n    },\n    \"startOffset\": {\n      \"@id\": \"schema:startOffset\"\n    },\n    \"startTime\": {\n      \"@id\": \"schema:startTime\"\n    },\n    \"status\": {\n      \"@id\": \"schema:status\"\n    },\n    \"steeringPosition\": {\n      \"@id\": \"schema:steeringPosition\"\n    },\n    \"step\": {\n      \"@id\": \"schema:step\"\n    },\n    \"stepValue\": {\n      \"@id\": \"schema:stepValue\"\n    },\n    \"steps\": {\n      \"@id\": \"schema:steps\"\n    },\n    \"storageRequirements\": {\n      \"@id\": \"schema:storageRequirements\"\n    },\n    \"streetAddress\": {\n      \"@id\": \"schema:streetAddress\"\n    },\n    \"strengthUnit\": {\n      \"@id\": \"schema:strengthUnit\"\n    },\n    \"strengthValue\": {\n      \"@id\": \"schema:strengthValue\"\n    },\n    \"structuralClass\": {\n      \"@id\": \"schema:structuralClass\"\n    },\n    \"study\": {\n      \"@id\": \"schema:study\"\n    },\n    \"studyDesign\": {\n      \"@id\": \"schema:studyDesign\"\n    },\n    \"studyLocation\": {\n      \"@id\": \"schema:studyLocation\"\n    },\n    \"studySubject\": {\n      \"@id\": \"schema:studySubject\"\n    },\n    \"stupidProperty\": {\n      \"@id\": \"schema:stupidProperty\"\n    },\n    \"subEvent\": {\n      \"@id\": \"schema:subEvent\"\n    },\n    \"subEvents\": {\n      \"@id\": \"schema:subEvents\"\n    },\n    \"subOrganization\": {\n      \"@id\": \"schema:subOrganization\"\n    },\n    \"subReservation\": {\n      \"@id\": \"schema:subReservation\"\n    },\n    \"subStageSuffix\": {\n      \"@id\": \"schema:subStageSuffix\"\n    },\n    \"subStructure\": {\n      \"@id\": \"schema:subStructure\"\n    },\n    \"subTest\": {\n      \"@id\": \"schema:subTest\"\n    },\n    \"subTrip\": {\n      \"@id\": \"schema:subTrip\"\n    },\n    \"subjectOf\": {\n      \"@id\": \"schema:subjectOf\"\n    },\n    \"subtitleLanguage\": {\n      \"@id\": \"schema:subtitleLanguage\"\n    },\n    \"successorOf\": {\n      \"@id\": \"schema:successorOf\"\n    },\n    \"sugarContent\": {\n      \"@id\": \"schema:sugarContent\"\n    },\n    \"suggestedAge\": {\n      \"@id\": \"schema:suggestedAge\"\n    },\n    \"suggestedAnswer\": {\n      \"@id\": \"schema:suggestedAnswer\"\n    },\n    \"suggestedGender\": {\n      \"@id\": \"schema:suggestedGender\"\n    },\n    \"suggestedMaxAge\": {\n      \"@id\": \"schema:suggestedMaxAge\"\n    },\n    \"suggestedMeasurement\": {\n      \"@id\": \"schema:suggestedMeasurement\"\n    },\n    \"suggestedMinAge\": {\n      \"@id\": \"schema:suggestedMinAge\"\n    },\n    \"suitableForDiet\": {\n      \"@id\": \"schema:suitableForDiet\"\n    },\n    \"superEvent\": {\n      \"@id\": \"schema:superEvent\"\n    },\n    \"supersededBy\": {\n      \"@id\": \"schema:supersededBy\"\n    },\n    \"supply\": {\n      \"@id\": \"schema:supply\"\n    },\n    \"supplyTo\": {\n      \"@id\": \"schema:supplyTo\"\n    },\n    \"supportingData\": {\n      \"@id\": \"schema:supportingData\"\n    },\n    \"surface\": {\n      \"@id\": \"schema:surface\"\n    },\n    \"target\": {\n      \"@id\": \"schema:target\",\n      \"@type\": \"@id\"\n    },\n    \"targetCollection\": {\n      \"@id\": \"schema:targetCollection\"\n    },\n    \"targetDescription\": {\n      \"@id\": \"schema:targetDescription\"\n    },\n    \"targetName\": {\n      \"@id\": \"schema:targetName\"\n    },\n    \"targetPlatform\": {\n      \"@id\": \"schema:targetPlatform\"\n    },\n    \"targetPopulation\": {\n      \"@id\": \"schema:targetPopulation\"\n    },\n    \"targetProduct\": {\n      \"@id\": \"schema:targetProduct\"\n    },\n    \"targetUrl\": {\n      \"@id\": \"schema:targetUrl\",\n      \"@type\": \"@id\"\n    },\n    \"taxID\": {\n      \"@id\": \"schema:taxID\"\n    },\n    \"taxonRank\": {\n      \"@id\": \"schema:taxonRank\"\n    },\n    \"taxonomicRange\": {\n      \"@id\": \"schema:taxonomicRange\"\n    },\n    \"teaches\": {\n      \"@id\": \"schema:teaches\"\n    },\n    \"telephone\": {\n      \"@id\": \"schema:telephone\"\n    },\n    \"temporal\": {\n      \"@id\": \"schema:temporal\"\n    },\n    \"temporalCoverage\": {\n      \"@id\": \"schema:temporalCoverage\"\n    },\n    \"termCode\": {\n      \"@id\": \"schema:termCode\"\n    },\n    \"termDuration\": {\n      \"@id\": \"schema:termDuration\"\n    },\n    \"termsOfService\": {\n      \"@id\": \"schema:termsOfService\"\n    },\n    \"termsPerYear\": {\n      \"@id\": \"schema:termsPerYear\"\n    },\n    \"text\": {\n      \"@id\": \"schema:text\"\n    },\n    \"textValue\": {\n      \"@id\": \"schema:textValue\"\n    },\n    \"thumbnail\": {\n      \"@id\": \"schema:thumbnail\"\n    },\n    \"thumbnailUrl\": {\n      \"@id\": \"schema:thumbnailUrl\",\n      \"@type\": \"@id\"\n    },\n    \"tickerSymbol\": {\n      \"@id\": \"schema:tickerSymbol\"\n    },\n    \"ticketNumber\": {\n      \"@id\": \"schema:ticketNumber\"\n    },\n    \"ticketToken\": {\n      \"@id\": \"schema:ticketToken\"\n    },\n    \"ticketedSeat\": {\n      \"@id\": \"schema:ticketedSeat\"\n    },\n    \"timeOfDay\": {\n      \"@id\": \"schema:timeOfDay\"\n    },\n    \"timeRequired\": {\n      \"@id\": \"schema:timeRequired\"\n    },\n    \"timeToComplete\": {\n      \"@id\": \"schema:timeToComplete\"\n    },\n    \"tissueSample\": {\n      \"@id\": \"schema:tissueSample\"\n    },\n    \"title\": {\n      \"@id\": \"schema:title\"\n    },\n    \"titleEIDR\": {\n      \"@id\": \"schema:titleEIDR\"\n    },\n    \"toLocation\": {\n      \"@id\": \"schema:toLocation\"\n    },\n    \"toRecipient\": {\n      \"@id\": \"schema:toRecipient\"\n    },\n    \"tocContinuation\": {\n      \"@id\": \"schema:tocContinuation\"\n    },\n    \"tocEntry\": {\n      \"@id\": \"schema:tocEntry\"\n    },\n    \"tongueWeight\": {\n      \"@id\": \"schema:tongueWeight\"\n    },\n    \"tool\": {\n      \"@id\": \"schema:tool\"\n    },\n    \"torque\": {\n      \"@id\": \"schema:torque\"\n    },\n    \"totalJobOpenings\": {\n      \"@id\": \"schema:totalJobOpenings\"\n    },\n    \"totalPaymentDue\": {\n      \"@id\": \"schema:totalPaymentDue\"\n    },\n    \"totalPrice\": {\n      \"@id\": \"schema:totalPrice\"\n    },\n    \"totalTime\": {\n      \"@id\": \"schema:totalTime\"\n    },\n    \"tourBookingPage\": {\n      \"@id\": \"schema:tourBookingPage\",\n      \"@type\": \"@id\"\n    },\n    \"touristType\": {\n      \"@id\": \"schema:touristType\"\n    },\n    \"track\": {\n      \"@id\": \"schema:track\"\n    },\n    \"trackingNumber\": {\n      \"@id\": \"schema:trackingNumber\"\n    },\n    \"trackingUrl\": {\n      \"@id\": \"schema:trackingUrl\",\n      \"@type\": \"@id\"\n    },\n    \"tracks\": {\n      \"@id\": \"schema:tracks\"\n    },\n    \"trailer\": {\n      \"@id\": \"schema:trailer\"\n    },\n    \"trailerWeight\": {\n      \"@id\": \"schema:trailerWeight\"\n    },\n    \"trainName\": {\n      \"@id\": \"schema:trainName\"\n    },\n    \"trainNumber\": {\n      \"@id\": \"schema:trainNumber\"\n    },\n    \"trainingSalary\": {\n      \"@id\": \"schema:trainingSalary\"\n    },\n    \"transFatContent\": {\n      \"@id\": \"schema:transFatContent\"\n    },\n    \"transcript\": {\n      \"@id\": \"schema:transcript\"\n    },\n    \"transitTime\": {\n      \"@id\": \"schema:transitTime\"\n    },\n    \"transitTimeLabel\": {\n      \"@id\": \"schema:transitTimeLabel\"\n    },\n    \"translationOfWork\": {\n      \"@id\": \"schema:translationOfWork\"\n    },\n    \"translator\": {\n      \"@id\": \"schema:translator\"\n    },\n    \"transmissionMethod\": {\n      \"@id\": \"schema:transmissionMethod\"\n    },\n    \"travelBans\": {\n      \"@id\": \"schema:travelBans\",\n      \"@type\": \"@id\"\n    },\n    \"trialDesign\": {\n      \"@id\": \"schema:trialDesign\"\n    },\n    \"tributary\": {\n      \"@id\": \"schema:tributary\"\n    },\n    \"typeOfBed\": {\n      \"@id\": \"schema:typeOfBed\"\n    },\n    \"typeOfGood\": {\n      \"@id\": \"schema:typeOfGood\"\n    },\n    \"typicalAgeRange\": {\n      \"@id\": \"schema:typicalAgeRange\"\n    },\n    \"typicalCreditsPerTerm\": {\n      \"@id\": \"schema:typicalCreditsPerTerm\"\n    },\n    \"typicalTest\": {\n      \"@id\": \"schema:typicalTest\"\n    },\n    \"underName\": {\n      \"@id\": \"schema:underName\"\n    },\n    \"unitCode\": {\n      \"@id\": \"schema:unitCode\"\n    },\n    \"unitText\": {\n      \"@id\": \"schema:unitText\"\n    },\n    \"unnamedSourcesPolicy\": {\n      \"@id\": \"schema:unnamedSourcesPolicy\",\n      \"@type\": \"@id\"\n    },\n    \"unsaturatedFatContent\": {\n      \"@id\": \"schema:unsaturatedFatContent\"\n    },\n    \"uploadDate\": {\n      \"@id\": \"schema:uploadDate\",\n      \"@type\": \"Date\"\n    },\n    \"upvoteCount\": {\n      \"@id\": \"schema:upvoteCount\"\n    },\n    \"url\": {\n      \"@id\": \"schema:url\",\n      \"@type\": \"@id\"\n    },\n    \"urlTemplate\": {\n      \"@id\": \"schema:urlTemplate\"\n    },\n    \"usageInfo\": {\n      \"@id\": \"schema:usageInfo\",\n      \"@type\": \"@id\"\n    },\n    \"usedToDiagnose\": {\n      \"@id\": \"schema:usedToDiagnose\"\n    },\n    \"userInteractionCount\": {\n      \"@id\": \"schema:userInteractionCount\"\n    },\n    \"usesDevice\": {\n      \"@id\": \"schema:usesDevice\"\n    },\n    \"usesHealthPlanIdStandard\": {\n      \"@id\": \"schema:usesHealthPlanIdStandard\"\n    },\n    \"utterances\": {\n      \"@id\": \"schema:utterances\"\n    },\n    \"validFor\": {\n      \"@id\": \"schema:validFor\"\n    },\n    \"validFrom\": {\n      \"@id\": \"schema:validFrom\",\n      \"@type\": \"Date\"\n    },\n    \"validIn\": {\n      \"@id\": \"schema:validIn\"\n    },\n    \"validThrough\": {\n      \"@id\": \"schema:validThrough\",\n      \"@type\": \"Date\"\n    },\n    \"validUntil\": {\n      \"@id\": \"schema:validUntil\",\n      \"@type\": \"Date\"\n    },\n    \"value\": {\n      \"@id\": \"schema:value\"\n    },\n    \"valueAddedTaxIncluded\": {\n      \"@id\": \"schema:valueAddedTaxIncluded\"\n    },\n    \"valueMaxLength\": {\n      \"@id\": \"schema:valueMaxLength\"\n    },\n    \"valueMinLength\": {\n      \"@id\": \"schema:valueMinLength\"\n    },\n    \"valueName\": {\n      \"@id\": \"schema:valueName\"\n    },\n    \"valuePattern\": {\n      \"@id\": \"schema:valuePattern\"\n    },\n    \"valueReference\": {\n      \"@id\": \"schema:valueReference\"\n    },\n    \"valueRequired\": {\n      \"@id\": \"schema:valueRequired\"\n    },\n    \"variableMeasured\": {\n      \"@id\": \"schema:variableMeasured\"\n    },\n    \"variablesMeasured\": {\n      \"@id\": \"schema:variablesMeasured\"\n    },\n    \"variantCover\": {\n      \"@id\": \"schema:variantCover\"\n    },\n    \"variesBy\": {\n      \"@id\": \"schema:variesBy\"\n    },\n    \"vatID\": {\n      \"@id\": \"schema:vatID\"\n    },\n    \"vehicleConfiguration\": {\n      \"@id\": \"schema:vehicleConfiguration\"\n    },\n    \"vehicleEngine\": {\n      \"@id\": \"schema:vehicleEngine\"\n    },\n    \"vehicleIdentificationNumber\": {\n      \"@id\": \"schema:vehicleIdentificationNumber\"\n    },\n    \"vehicleInteriorColor\": {\n      \"@id\": \"schema:vehicleInteriorColor\"\n    },\n    \"vehicleInteriorType\": {\n      \"@id\": \"schema:vehicleInteriorType\"\n    },\n    \"vehicleModelDate\": {\n      \"@id\": \"schema:vehicleModelDate\",\n      \"@type\": \"Date\"\n    },\n    \"vehicleSeatingCapacity\": {\n      \"@id\": \"schema:vehicleSeatingCapacity\"\n    },\n    \"vehicleSpecialUsage\": {\n      \"@id\": \"schema:vehicleSpecialUsage\"\n    },\n    \"vehicleTransmission\": {\n      \"@id\": \"schema:vehicleTransmission\"\n    },\n    \"vendor\": {\n      \"@id\": \"schema:vendor\"\n    },\n    \"verificationFactCheckingPolicy\": {\n      \"@id\": \"schema:verificationFactCheckingPolicy\",\n      \"@type\": \"@id\"\n    },\n    \"version\": {\n      \"@id\": \"schema:version\"\n    },\n    \"video\": {\n      \"@id\": \"schema:video\"\n    },\n    \"videoFormat\": {\n      \"@id\": \"schema:videoFormat\"\n    },\n    \"videoFrameSize\": {\n      \"@id\": \"schema:videoFrameSize\"\n    },\n    \"videoQuality\": {\n      \"@id\": \"schema:videoQuality\"\n    },\n    \"volumeNumber\": {\n      \"@id\": \"schema:volumeNumber\"\n    },\n    \"warning\": {\n      \"@id\": \"schema:warning\"\n    },\n    \"warranty\": {\n      \"@id\": \"schema:warranty\"\n    },\n    \"warrantyPromise\": {\n      \"@id\": \"schema:warrantyPromise\"\n    },\n    \"warrantyScope\": {\n      \"@id\": \"schema:warrantyScope\"\n    },\n    \"webCheckinTime\": {\n      \"@id\": \"schema:webCheckinTime\"\n    },\n    \"webFeed\": {\n      \"@id\": \"schema:webFeed\",\n      \"@type\": \"@id\"\n    },\n    \"weight\": {\n      \"@id\": \"schema:weight\"\n    },\n    \"weightTotal\": {\n      \"@id\": \"schema:weightTotal\"\n    },\n    \"wheelbase\": {\n      \"@id\": \"schema:wheelbase\"\n    },\n    \"width\": {\n      \"@id\": \"schema:width\"\n    },\n    \"winner\": {\n      \"@id\": \"schema:winner\"\n    },\n    \"wordCount\": {\n      \"@id\": \"schema:wordCount\"\n    },\n    \"workExample\": {\n      \"@id\": \"schema:workExample\"\n    },\n    \"workFeatured\": {\n      \"@id\": \"schema:workFeatured\"\n    },\n    \"workHours\": {\n      \"@id\": \"schema:workHours\"\n    },\n    \"workLocation\": {\n      \"@id\": \"schema:workLocation\"\n    },\n    \"workPerformed\": {\n      \"@id\": \"schema:workPerformed\"\n    },\n    \"workPresented\": {\n      \"@id\": \"schema:workPresented\"\n    },\n    \"workTranslation\": {\n      \"@id\": \"schema:workTranslation\"\n    },\n    \"workload\": {\n      \"@id\": \"schema:workload\"\n    },\n    \"worksFor\": {\n      \"@id\": \"schema:worksFor\"\n    },\n    \"worstRating\": {\n      \"@id\": \"schema:worstRating\"\n    },\n    \"xpath\": {\n      \"@id\": \"schema:xpath\"\n    },\n    \"yearBuilt\": {\n      \"@id\": \"schema:yearBuilt\"\n    },\n    \"yearlyRevenue\": {\n      \"@id\": \"schema:yearlyRevenue\"\n    },\n    \"yearsInOperation\": {\n      \"@id\": \"schema:yearsInOperation\"\n    },\n    \"yield\": {\n      \"@id\": \"schema:yield\"\n    }\n  }\n}\n"
  },
  {
    "path": "packages/credential-ld/src/contexts/veramo.io_contexts_profile_v1.json",
    "content": "{\n  \"@context\": {\n    \"@version\": 1.1,\n    \"@protected\": true,\n    \"Profile\": \"https://veramo.io/contexts/profile#Profile\",\n    \"name\": \"https://schema.org/name\"\n  }\n}\n"
  },
  {
    "path": "packages/credential-ld/src/contexts/w3id.org_security_bbs_v1.json",
    "content": "{\n  \"@context\": {\n    \"@version\": 1.1,\n    \"id\": \"@id\",\n    \"type\": \"@type\",\n    \"BbsBlsSignature2020\": {\n      \"@id\": \"https://w3id.org/security#BbsBlsSignature2020\",\n      \"@context\": {\n        \"@version\": 1.1,\n        \"@protected\": true,\n        \"id\": \"@id\",\n        \"type\": \"@type\",\n        \"challenge\": \"https://w3id.org/security#challenge\",\n        \"created\": {\n          \"@id\": \"http://purl.org/dc/terms/created\",\n          \"@type\": \"http://www.w3.org/2001/XMLSchema#dateTime\"\n        },\n        \"domain\": \"https://w3id.org/security#domain\",\n        \"proofValue\": \"https://w3id.org/security#proofValue\",\n        \"nonce\": \"https://w3id.org/security#nonce\",\n        \"proofPurpose\": {\n          \"@id\": \"https://w3id.org/security#proofPurpose\",\n          \"@type\": \"@vocab\",\n          \"@context\": {\n            \"@version\": 1.1,\n            \"@protected\": true,\n            \"id\": \"@id\",\n            \"type\": \"@type\",\n            \"assertionMethod\": {\n              \"@id\": \"https://w3id.org/security#assertionMethod\",\n              \"@type\": \"@id\",\n              \"@container\": \"@set\"\n            },\n            \"authentication\": {\n              \"@id\": \"https://w3id.org/security#authenticationMethod\",\n              \"@type\": \"@id\",\n              \"@container\": \"@set\"\n            }\n          }\n        },\n        \"verificationMethod\": {\n          \"@id\": \"https://w3id.org/security#verificationMethod\",\n          \"@type\": \"@id\"\n        }\n      }\n    },\n    \"BbsBlsSignatureProof2020\": {\n      \"@id\": \"https://w3id.org/security#BbsBlsSignatureProof2020\",\n      \"@context\": {\n        \"@version\": 1.1,\n        \"@protected\": true,\n        \"id\": \"@id\",\n        \"type\": \"@type\",\n        \"challenge\": \"https://w3id.org/security#challenge\",\n        \"created\": {\n          \"@id\": \"http://purl.org/dc/terms/created\",\n          \"@type\": \"http://www.w3.org/2001/XMLSchema#dateTime\"\n        },\n        \"domain\": \"https://w3id.org/security#domain\",\n        \"nonce\": \"https://w3id.org/security#nonce\",\n        \"proofPurpose\": {\n          \"@id\": \"https://w3id.org/security#proofPurpose\",\n          \"@type\": \"@vocab\",\n          \"@context\": {\n            \"@version\": 1.1,\n            \"@protected\": true,\n            \"id\": \"@id\",\n            \"type\": \"@type\",\n            \"sec\": \"https://w3id.org/security#\",\n            \"assertionMethod\": {\n              \"@id\": \"https://w3id.org/security#assertionMethod\",\n              \"@type\": \"@id\",\n              \"@container\": \"@set\"\n            },\n            \"authentication\": {\n              \"@id\": \"https://w3id.org/security#authenticationMethod\",\n              \"@type\": \"@id\",\n              \"@container\": \"@set\"\n            }\n          }\n        },\n        \"proofValue\": \"https://w3id.org/security#proofValue\",\n        \"verificationMethod\": {\n          \"@id\": \"https://w3id.org/security#verificationMethod\",\n          \"@type\": \"@id\"\n        }\n      }\n    },\n    \"Bls12381G1Key2020\": {\n      \"@id\": \"https://w3id.org/security#Bls12381G1Key2020\",\n      \"@context\": {\n        \"@protected\": true,\n        \"id\": \"@id\",\n        \"type\": \"@type\",\n        \"controller\": {\n          \"@id\": \"https://w3id.org/security#controller\",\n          \"@type\": \"@id\"\n        },\n        \"revoked\": {\n          \"@id\": \"https://w3id.org/security#revoked\",\n          \"@type\": \"http://www.w3.org/2001/XMLSchema#dateTime\"\n        },\n        \"publicKeyBase58\": {\n          \"@id\": \"https://w3id.org/security#publicKeyBase58\"\n        }\n      }\n    },\n    \"Bls12381G2Key2020\": {\n      \"@id\": \"https://w3id.org/security#Bls12381G2Key2020\",\n      \"@context\": {\n        \"@protected\": true,\n        \"id\": \"@id\",\n        \"type\": \"@type\",\n        \"controller\": {\n          \"@id\": \"https://w3id.org/security#controller\",\n          \"@type\": \"@id\"\n        },\n        \"revoked\": {\n          \"@id\": \"https://w3id.org/security#revoked\",\n          \"@type\": \"http://www.w3.org/2001/XMLSchema#dateTime\"\n        },\n        \"publicKeyBase58\": {\n          \"@id\": \"https://w3id.org/security#publicKeyBase58\"\n        }\n      }\n    }\n  }\n}\n"
  },
  {
    "path": "packages/credential-ld/src/contexts/w3id.org_security_suites_ed25519-2018_v1.json",
    "content": "{\n  \"@context\": {\n    \"id\": \"@id\",\n    \"type\": \"@type\",\n    \"@protected\": true,\n    \"proof\": {\n      \"@id\": \"https://w3id.org/security#proof\",\n      \"@type\": \"@id\",\n      \"@container\": \"@graph\"\n    },\n    \"Ed25519VerificationKey2018\": {\n      \"@id\": \"https://w3id.org/security#Ed25519VerificationKey2018\",\n      \"@context\": {\n        \"@protected\": true,\n        \"id\": \"@id\",\n        \"type\": \"@type\",\n        \"controller\": {\n          \"@id\": \"https://w3id.org/security#controller\",\n          \"@type\": \"@id\"\n        },\n        \"revoked\": {\n          \"@id\": \"https://w3id.org/security#revoked\",\n          \"@type\": \"http://www.w3.org/2001/XMLSchema#dateTime\"\n        },\n        \"publicKeyBase58\": {\n          \"@id\": \"https://w3id.org/security#publicKeyBase58\"\n        }\n      }\n    },\n    \"Ed25519Signature2018\": {\n      \"@id\": \"https://w3id.org/security#Ed25519Signature2018\",\n      \"@context\": {\n        \"@protected\": true,\n        \"id\": \"@id\",\n        \"type\": \"@type\",\n        \"challenge\": \"https://w3id.org/security#challenge\",\n        \"created\": {\n          \"@id\": \"http://purl.org/dc/terms/created\",\n          \"@type\": \"http://www.w3.org/2001/XMLSchema#dateTime\"\n        },\n        \"domain\": \"https://w3id.org/security#domain\",\n        \"expires\": {\n          \"@id\": \"https://w3id.org/security#expiration\",\n          \"@type\": \"http://www.w3.org/2001/XMLSchema#dateTime\"\n        },\n        \"nonce\": \"https://w3id.org/security#nonce\",\n        \"proofPurpose\": {\n          \"@id\": \"https://w3id.org/security#proofPurpose\",\n          \"@type\": \"@vocab\",\n          \"@context\": {\n            \"@protected\": true,\n            \"id\": \"@id\",\n            \"type\": \"@type\",\n            \"assertionMethod\": {\n              \"@id\": \"https://w3id.org/security#assertionMethod\",\n              \"@type\": \"@id\",\n              \"@container\": \"@set\"\n            },\n            \"authentication\": {\n              \"@id\": \"https://w3id.org/security#authenticationMethod\",\n              \"@type\": \"@id\",\n              \"@container\": \"@set\"\n            },\n            \"capabilityInvocation\": {\n              \"@id\": \"https://w3id.org/security#capabilityInvocationMethod\",\n              \"@type\": \"@id\",\n              \"@container\": \"@set\"\n            },\n            \"capabilityDelegation\": {\n              \"@id\": \"https://w3id.org/security#capabilityDelegationMethod\",\n              \"@type\": \"@id\",\n              \"@container\": \"@set\"\n            },\n            \"keyAgreement\": {\n              \"@id\": \"https://w3id.org/security#keyAgreementMethod\",\n              \"@type\": \"@id\",\n              \"@container\": \"@set\"\n            }\n          }\n        },\n        \"jws\": {\n          \"@id\": \"https://w3id.org/security#jws\"\n        },\n        \"verificationMethod\": {\n          \"@id\": \"https://w3id.org/security#verificationMethod\",\n          \"@type\": \"@id\"\n        }\n      }\n    }\n  }\n}\n"
  },
  {
    "path": "packages/credential-ld/src/contexts/w3id.org_security_suites_ed25519-2020-v1.json",
    "content": "{\n  \"@context\": {\n    \"id\": \"@id\",\n    \"type\": \"@type\",\n    \"@protected\": true,\n    \"proof\": {\n      \"@id\": \"https://w3id.org/security#proof\",\n      \"@type\": \"@id\",\n      \"@container\": \"@graph\"\n    },\n    \"Ed25519VerificationKey2020\": {\n      \"@id\": \"https://w3id.org/security#Ed25519VerificationKey2020\",\n      \"@context\": {\n        \"@protected\": true,\n        \"id\": \"@id\",\n        \"type\": \"@type\",\n        \"controller\": {\n          \"@id\": \"https://w3id.org/security#controller\",\n          \"@type\": \"@id\"\n        },\n        \"revoked\": {\n          \"@id\": \"https://w3id.org/security#revoked\",\n          \"@type\": \"http://www.w3.org/2001/XMLSchema#dateTime\"\n        },\n        \"publicKeyMultibase\": {\n          \"@id\": \"https://w3id.org/security#publicKeyMultibase\",\n          \"@type\": \"https://w3id.org/security#multibase\"\n        }\n      }\n    },\n    \"Ed25519Signature2020\": {\n      \"@id\": \"https://w3id.org/security#Ed25519Signature2020\",\n      \"@context\": {\n        \"@protected\": true,\n        \"id\": \"@id\",\n        \"type\": \"@type\",\n        \"challenge\": \"https://w3id.org/security#challenge\",\n        \"created\": {\n          \"@id\": \"http://purl.org/dc/terms/created\",\n          \"@type\": \"http://www.w3.org/2001/XMLSchema#dateTime\"\n        },\n        \"domain\": \"https://w3id.org/security#domain\",\n        \"expires\": {\n          \"@id\": \"https://w3id.org/security#expiration\",\n          \"@type\": \"http://www.w3.org/2001/XMLSchema#dateTime\"\n        },\n        \"nonce\": \"https://w3id.org/security#nonce\",\n        \"proofPurpose\": {\n          \"@id\": \"https://w3id.org/security#proofPurpose\",\n          \"@type\": \"@vocab\",\n          \"@context\": {\n            \"@protected\": true,\n            \"id\": \"@id\",\n            \"type\": \"@type\",\n            \"assertionMethod\": {\n              \"@id\": \"https://w3id.org/security#assertionMethod\",\n              \"@type\": \"@id\",\n              \"@container\": \"@set\"\n            },\n            \"authentication\": {\n              \"@id\": \"https://w3id.org/security#authenticationMethod\",\n              \"@type\": \"@id\",\n              \"@container\": \"@set\"\n            },\n            \"capabilityInvocation\": {\n              \"@id\": \"https://w3id.org/security#capabilityInvocationMethod\",\n              \"@type\": \"@id\",\n              \"@container\": \"@set\"\n            },\n            \"capabilityDelegation\": {\n              \"@id\": \"https://w3id.org/security#capabilityDelegationMethod\",\n              \"@type\": \"@id\",\n              \"@container\": \"@set\"\n            },\n            \"keyAgreement\": {\n              \"@id\": \"https://w3id.org/security#keyAgreementMethod\",\n              \"@type\": \"@id\",\n              \"@container\": \"@set\"\n            }\n          }\n        },\n        \"proofValue\": {\n          \"@id\": \"https://w3id.org/security#proofValue\",\n          \"@type\": \"https://w3id.org/security#multibase\"\n        },\n        \"verificationMethod\": {\n          \"@id\": \"https://w3id.org/security#verificationMethod\",\n          \"@type\": \"@id\"\n        }\n      }\n    }\n  }\n}\n"
  },
  {
    "path": "packages/credential-ld/src/contexts/w3id.org_security_suites_eip712sig-2021_v1.json",
    "content": "{\n  \"@context\": {\n    \"@version\": 1.1,\n    \"@protected\": true,\n    \"Eip712SchemaValidator2021\": \"https://w3id.org/security#Eip712SchemaValidator2021\",\n    \"EthereumEip712Signature2021\": {\n      \"@id\": \"https://w3id.org/security#EthereumEip712Signature2021\",\n      \"@context\": {\n        \"@version\": 1.1,\n        \"@protected\": true,\n        \"id\": \"@id\",\n        \"type\": \"@type\",\n        \"created\": {\n          \"@id\": \"http://purl.org/dc/terms/created\",\n          \"@type\": \"http://www.w3.org/2001/XMLSchema#dateTime\"\n        },\n        \"domain\": \"https://w3id.org/security#domain\",\n        \"proofPurpose\": {\n          \"@id\": \"https://w3id.org/security#proofPurpose\",\n          \"@type\": \"@vocab\",\n          \"@context\": {\n            \"@version\": 1.1,\n            \"@protected\": true,\n            \"id\": \"@id\",\n            \"type\": \"@type\",\n            \"assertionMethod\": {\n              \"@id\": \"https://w3id.org/security#assertionMethod\",\n              \"@type\": \"@id\",\n              \"@container\": \"@set\"\n            },\n            \"authentication\": {\n              \"@id\": \"https://w3id.org/security#authenticationMethod\",\n              \"@type\": \"@id\",\n              \"@container\": \"@set\"\n            },\n            \"capabilityInvocation\": {\n              \"@id\": \"https://w3id.org/security#capabilityInvocationMethod\",\n              \"@type\": \"@id\",\n              \"@container\": \"@set\"\n            },\n            \"capabilityDelegation\": {\n              \"@id\": \"https://w3id.org/security#capabilityDelegationMethod\",\n              \"@type\": \"@id\",\n              \"@container\": \"@set\"\n            }\n          }\n        },\n        \"eip712Domain\": {\n          \"@id\": \"https://w3c-ccg.github.io/ethereum-eip712-signature-2021-spec/#eip712-domain\",\n          \"@context\": {\n            \"@version\": 1.1,\n            \"@protected\": true,\n            \"id\": \"@id\",\n            \"type\": \"@type\",\n            \"messageSchema\": {\n              \"@id\": \"https://w3c-ccg.github.io/ethereum-eip712-signature-2021-spec/#message-schema\",\n              \"@type\": \"@json\"\n            },\n            \"primaryType\": \"https://w3c-ccg.github.io/ethereum-eip712-signature-2021-spec/#primary-type\",\n            \"domain\": {\n              \"@id\": \"https://w3c-ccg.github.io/ethereum-eip712-signature-2021-spec/#domain\",\n              \"@type\": \"@json\"\n            }\n          }\n        },\n        \"eip712\": {\n          \"@id\": \"https://w3c-ccg.github.io/ethereum-eip712-signature-2021-spec/#eip712-domain\",\n          \"@context\": {\n            \"@version\": 1.1,\n            \"@protected\": true,\n            \"id\": \"@id\",\n            \"type\": \"@type\",\n            \"types\": {\n              \"@id\": \"https://w3c-ccg.github.io/ethereum-eip712-signature-2021-spec/#message-schema\",\n              \"@type\": \"@json\"\n            },\n            \"primaryType\": \"https://w3c-ccg.github.io/ethereum-eip712-signature-2021-spec/#primary-type\",\n            \"domain\": {\n              \"@id\": \"https://w3c-ccg.github.io/ethereum-eip712-signature-2021-spec/#domain\",\n              \"@type\": \"@json\"\n            }\n          }\n        },\n        \"proofValue\": \"https://w3id.org/security#proofValue\",\n        \"verificationMethod\": {\n          \"@id\": \"https://w3id.org/security#verificationMethod\",\n          \"@type\": \"@id\"\n        },\n        \"canonicalizationHash\": \"https://w3id.org/security/suites/eip712sig-2021#canonicalizationHash\"\n      }\n    }\n  }\n}\n"
  },
  {
    "path": "packages/credential-ld/src/contexts/w3id.org_security_suites_jws-2020_v1.json",
    "content": "{\n  \"@context\": {\n    \"privateKeyJwk\": {\n      \"@id\": \"https://w3id.org/security#privateKeyJwk\",\n      \"@type\": \"@json\"\n    },\n    \"JsonWebKey2020\": {\n      \"@id\": \"https://w3id.org/security#JsonWebKey2020\",\n      \"@context\": {\n        \"@protected\": true,\n        \"id\": \"@id\",\n        \"type\": \"@type\",\n        \"publicKeyJwk\": {\n          \"@id\": \"https://w3id.org/security#publicKeyJwk\",\n          \"@type\": \"@json\"\n        }\n      }\n    },\n    \"JsonWebSignature2020\": {\n      \"@id\": \"https://w3id.org/security#JsonWebSignature2020\",\n      \"@context\": {\n        \"@protected\": true,\n        \"id\": \"@id\",\n        \"type\": \"@type\",\n        \"challenge\": \"https://w3id.org/security#challenge\",\n        \"created\": {\n          \"@id\": \"http://purl.org/dc/terms/created\",\n          \"@type\": \"http://www.w3.org/2001/XMLSchema#dateTime\"\n        },\n        \"domain\": \"https://w3id.org/security#domain\",\n        \"expires\": {\n          \"@id\": \"https://w3id.org/security#expiration\",\n          \"@type\": \"http://www.w3.org/2001/XMLSchema#dateTime\"\n        },\n        \"jws\": \"https://w3id.org/security#jws\",\n        \"nonce\": \"https://w3id.org/security#nonce\",\n        \"proofPurpose\": {\n          \"@id\": \"https://w3id.org/security#proofPurpose\",\n          \"@type\": \"@vocab\",\n          \"@context\": {\n            \"@protected\": true,\n            \"id\": \"@id\",\n            \"type\": \"@type\",\n            \"assertionMethod\": {\n              \"@id\": \"https://w3id.org/security#assertionMethod\",\n              \"@type\": \"@id\",\n              \"@container\": \"@set\"\n            },\n            \"authentication\": {\n              \"@id\": \"https://w3id.org/security#authenticationMethod\",\n              \"@type\": \"@id\",\n              \"@container\": \"@set\"\n            },\n            \"capabilityInvocation\": {\n              \"@id\": \"https://w3id.org/security#capabilityInvocationMethod\",\n              \"@type\": \"@id\",\n              \"@container\": \"@set\"\n            },\n            \"capabilityDelegation\": {\n              \"@id\": \"https://w3id.org/security#capabilityDelegationMethod\",\n              \"@type\": \"@id\",\n              \"@container\": \"@set\"\n            },\n            \"keyAgreement\": {\n              \"@id\": \"https://w3id.org/security#keyAgreementMethod\",\n              \"@type\": \"@id\",\n              \"@container\": \"@set\"\n            }\n          }\n        },\n        \"verificationMethod\": {\n          \"@id\": \"https://w3id.org/security#verificationMethod\",\n          \"@type\": \"@id\"\n        }\n      }\n    }\n  }\n}\n"
  },
  {
    "path": "packages/credential-ld/src/contexts/w3id.org_security_suites_secp256k1recovery-2020_v2.json",
    "content": "{\n  \"@context\": {\n    \"id\": \"@id\",\n    \"type\": \"@type\",\n    \"@protected\": true,\n    \"proof\": {\n      \"@id\": \"https://w3id.org/security#proof\",\n      \"@type\": \"@id\",\n      \"@container\": \"@graph\"\n    },\n    \"EcdsaSecp256k1RecoveryMethod2020\": {\n      \"@id\": \"https://identity.foundation/EcdsaSecp256k1RecoverySignature2020#EcdsaSecp256k1RecoveryMethod2020\",\n      \"@context\": {\n        \"@protected\": true,\n        \"id\": \"@id\",\n        \"type\": \"@type\",\n        \"controller\": {\n          \"@id\": \"https://w3id.org/security#controller\",\n          \"@type\": \"@id\"\n        },\n        \"blockchainAccountId\": \"https://w3id.org/security#blockchainAccountId\",\n        \"publicKeyJwk\": {\n          \"@id\": \"https://w3id.org/security#publicKeyJwk\",\n          \"@type\": \"@json\"\n        }\n      }\n    },\n    \"EcdsaSecp256k1RecoverySignature2020\": {\n      \"@id\": \"https://identity.foundation/EcdsaSecp256k1RecoverySignature2020#EcdsaSecp256k1RecoverySignature2020\",\n      \"@context\": {\n        \"@protected\": true,\n        \"id\": \"@id\",\n        \"type\": \"@type\",\n        \"challenge\": \"https://w3id.org/security#challenge\",\n        \"created\": {\n          \"@id\": \"http://purl.org/dc/terms/created\",\n          \"@type\": \"http://www.w3.org/2001/XMLSchema#dateTime\"\n        },\n        \"domain\": \"https://w3id.org/security#domain\",\n        \"expires\": {\n          \"@id\": \"https://w3id.org/security#expiration\",\n          \"@type\": \"http://www.w3.org/2001/XMLSchema#dateTime\"\n        },\n        \"jws\": \"https://w3id.org/security#jws\",\n        \"nonce\": \"https://w3id.org/security#nonce\",\n        \"proofPurpose\": {\n          \"@id\": \"https://w3id.org/security#proofPurpose\",\n          \"@type\": \"@vocab\",\n          \"@context\": {\n            \"@protected\": true,\n            \"id\": \"@id\",\n            \"type\": \"@type\",\n            \"assertionMethod\": {\n              \"@id\": \"https://w3id.org/security#assertionMethod\",\n              \"@type\": \"@id\",\n              \"@container\": \"@set\"\n            },\n            \"authentication\": {\n              \"@id\": \"https://w3id.org/security#authenticationMethod\",\n              \"@type\": \"@id\",\n              \"@container\": \"@set\"\n            },\n            \"capabilityInvocation\": {\n              \"@id\": \"https://w3id.org/security#capabilityInvocationMethod\",\n              \"@type\": \"@id\",\n              \"@container\": \"@set\"\n            },\n            \"capabilityDelegation\": {\n              \"@id\": \"https://w3id.org/security#capabilityDelegationMethod\",\n              \"@type\": \"@id\",\n              \"@container\": \"@set\"\n            },\n            \"keyAgreement\": {\n              \"@id\": \"https://w3id.org/security#keyAgreementMethod\",\n              \"@type\": \"@id\",\n              \"@container\": \"@set\"\n            }\n          }\n        },\n        \"verificationMethod\": {\n          \"@id\": \"https://w3id.org/security#verificationMethod\",\n          \"@type\": \"@id\"\n        }\n      }\n    }\n  }\n}\n"
  },
  {
    "path": "packages/credential-ld/src/contexts/w3id.org_security_suites_x25519-2019_v1.json",
    "content": "{\n  \"@context\": {\n    \"id\": \"@id\",\n    \"type\": \"@type\",\n    \"@protected\": true,\n    \"X25519KeyAgreementKey2019\": {\n      \"@id\": \"https://w3id.org/security#X25519KeyAgreementKey2019\",\n      \"@context\": {\n        \"@protected\": true,\n        \"id\": \"@id\",\n        \"type\": \"@type\",\n        \"controller\": {\n          \"@id\": \"https://w3id.org/security#controller\",\n          \"@type\": \"@id\"\n        },\n        \"revoked\": {\n          \"@id\": \"https://w3id.org/security#revoked\",\n          \"@type\": \"http://www.w3.org/2001/XMLSchema#dateTime\"\n        },\n        \"publicKeyBase58\": {\n          \"@id\": \"https://w3id.org/security#publicKeyBase58\"\n        }\n      }\n    }\n  }\n}\n"
  },
  {
    "path": "packages/credential-ld/src/contexts/w3id.org_security_suites_x25519-2020_v1.json",
    "content": "{\n  \"@context\": {\n    \"id\": \"@id\",\n    \"type\": \"@type\",\n    \"@protected\": true,\n    \"X25519KeyAgreementKey2020\": {\n      \"@id\": \"https://w3id.org/security#X25519KeyAgreementKey2020\",\n      \"@context\": {\n        \"@protected\": true,\n        \"id\": \"@id\",\n        \"type\": \"@type\",\n        \"controller\": {\n          \"@id\": \"https://w3id.org/security#controller\",\n          \"@type\": \"@id\"\n        },\n        \"revoked\": {\n          \"@id\": \"https://w3id.org/security#revoked\",\n          \"@type\": \"http://www.w3.org/2001/XMLSchema#dateTime\"\n        },\n        \"publicKeyMultibase\": {\n          \"@id\": \"https://w3id.org/security#publicKeyMultibase\",\n          \"@type\": \"https://w3id.org/security#multibase\"\n        }\n      }\n    }\n  }\n}\n"
  },
  {
    "path": "packages/credential-ld/src/contexts/w3id.org_security_v1.json",
    "content": "{\n  \"@context\": {\n    \"id\": \"@id\",\n    \"type\": \"@type\",\n    \"dc\": \"http://purl.org/dc/terms/\",\n    \"sec\": \"https://w3id.org/security#\",\n    \"xsd\": \"http://www.w3.org/2001/XMLSchema#\",\n    \"EcdsaKoblitzSignature2016\": \"sec:EcdsaKoblitzSignature2016\",\n    \"Ed25519Signature2018\": \"sec:Ed25519Signature2018\",\n    \"EncryptedMessage\": \"sec:EncryptedMessage\",\n    \"GraphSignature2012\": \"sec:GraphSignature2012\",\n    \"LinkedDataSignature2015\": \"sec:LinkedDataSignature2015\",\n    \"LinkedDataSignature2016\": \"sec:LinkedDataSignature2016\",\n    \"CryptographicKey\": \"sec:Key\",\n    \"authenticationTag\": \"sec:authenticationTag\",\n    \"canonicalizationAlgorithm\": \"sec:canonicalizationAlgorithm\",\n    \"cipherAlgorithm\": \"sec:cipherAlgorithm\",\n    \"cipherData\": \"sec:cipherData\",\n    \"cipherKey\": \"sec:cipherKey\",\n    \"created\": {\n      \"@id\": \"dc:created\",\n      \"@type\": \"xsd:dateTime\"\n    },\n    \"creator\": {\n      \"@id\": \"dc:creator\",\n      \"@type\": \"@id\"\n    },\n    \"digestAlgorithm\": \"sec:digestAlgorithm\",\n    \"digestValue\": \"sec:digestValue\",\n    \"domain\": \"sec:domain\",\n    \"encryptionKey\": \"sec:encryptionKey\",\n    \"expiration\": {\n      \"@id\": \"sec:expiration\",\n      \"@type\": \"xsd:dateTime\"\n    },\n    \"expires\": {\n      \"@id\": \"sec:expiration\",\n      \"@type\": \"xsd:dateTime\"\n    },\n    \"initializationVector\": \"sec:initializationVector\",\n    \"iterationCount\": \"sec:iterationCount\",\n    \"nonce\": \"sec:nonce\",\n    \"normalizationAlgorithm\": \"sec:normalizationAlgorithm\",\n    \"owner\": {\n      \"@id\": \"sec:owner\",\n      \"@type\": \"@id\"\n    },\n    \"password\": \"sec:password\",\n    \"privateKey\": {\n      \"@id\": \"sec:privateKey\",\n      \"@type\": \"@id\"\n    },\n    \"privateKeyPem\": \"sec:privateKeyPem\",\n    \"publicKey\": {\n      \"@id\": \"sec:publicKey\",\n      \"@type\": \"@id\"\n    },\n    \"publicKeyBase58\": \"sec:publicKeyBase58\",\n    \"publicKeyPem\": \"sec:publicKeyPem\",\n    \"publicKeyWif\": \"sec:publicKeyWif\",\n    \"publicKeyService\": {\n      \"@id\": \"sec:publicKeyService\",\n      \"@type\": \"@id\"\n    },\n    \"revoked\": {\n      \"@id\": \"sec:revoked\",\n      \"@type\": \"xsd:dateTime\"\n    },\n    \"salt\": \"sec:salt\",\n    \"signature\": \"sec:signature\",\n    \"signatureAlgorithm\": \"sec:signingAlgorithm\",\n    \"signatureValue\": \"sec:signatureValue\"\n  }\n}\n"
  },
  {
    "path": "packages/credential-ld/src/contexts/w3id.org_security_v2.json",
    "content": "{\n  \"@context\": [\n    {\n      \"@version\": 1.1\n    },\n    \"https://w3id.org/security/v1\",\n    {\n      \"AesKeyWrappingKey2019\": \"sec:AesKeyWrappingKey2019\",\n      \"DeleteKeyOperation\": \"sec:DeleteKeyOperation\",\n      \"DeriveSecretOperation\": \"sec:DeriveSecretOperation\",\n      \"EcdsaSecp256k1Signature2019\": \"sec:EcdsaSecp256k1Signature2019\",\n      \"EcdsaSecp256r1Signature2019\": \"sec:EcdsaSecp256r1Signature2019\",\n      \"EcdsaSecp256k1VerificationKey2019\": \"sec:EcdsaSecp256k1VerificationKey2019\",\n      \"EcdsaSecp256r1VerificationKey2019\": \"sec:EcdsaSecp256r1VerificationKey2019\",\n      \"Ed25519Signature2018\": \"sec:Ed25519Signature2018\",\n      \"Ed25519VerificationKey2018\": \"sec:Ed25519VerificationKey2018\",\n      \"EquihashProof2018\": \"sec:EquihashProof2018\",\n      \"ExportKeyOperation\": \"sec:ExportKeyOperation\",\n      \"GenerateKeyOperation\": \"sec:GenerateKeyOperation\",\n      \"KmsOperation\": \"sec:KmsOperation\",\n      \"RevokeKeyOperation\": \"sec:RevokeKeyOperation\",\n      \"RsaSignature2018\": \"sec:RsaSignature2018\",\n      \"RsaVerificationKey2018\": \"sec:RsaVerificationKey2018\",\n      \"Sha256HmacKey2019\": \"sec:Sha256HmacKey2019\",\n      \"SignOperation\": \"sec:SignOperation\",\n      \"UnwrapKeyOperation\": \"sec:UnwrapKeyOperation\",\n      \"VerifyOperation\": \"sec:VerifyOperation\",\n      \"WrapKeyOperation\": \"sec:WrapKeyOperation\",\n      \"X25519KeyAgreementKey2019\": \"sec:X25519KeyAgreementKey2019\",\n      \"allowedAction\": \"sec:allowedAction\",\n      \"assertionMethod\": {\n        \"@id\": \"sec:assertionMethod\",\n        \"@type\": \"@id\",\n        \"@container\": \"@set\"\n      },\n      \"authentication\": {\n        \"@id\": \"sec:authenticationMethod\",\n        \"@type\": \"@id\",\n        \"@container\": \"@set\"\n      },\n      \"capability\": {\n        \"@id\": \"sec:capability\",\n        \"@type\": \"@id\"\n      },\n      \"capabilityAction\": \"sec:capabilityAction\",\n      \"capabilityChain\": {\n        \"@id\": \"sec:capabilityChain\",\n        \"@type\": \"@id\",\n        \"@container\": \"@list\"\n      },\n      \"capabilityDelegation\": {\n        \"@id\": \"sec:capabilityDelegationMethod\",\n        \"@type\": \"@id\",\n        \"@container\": \"@set\"\n      },\n      \"capabilityInvocation\": {\n        \"@id\": \"sec:capabilityInvocationMethod\",\n        \"@type\": \"@id\",\n        \"@container\": \"@set\"\n      },\n      \"caveat\": {\n        \"@id\": \"sec:caveat\",\n        \"@type\": \"@id\",\n        \"@container\": \"@set\"\n      },\n      \"challenge\": \"sec:challenge\",\n      \"ciphertext\": \"sec:ciphertext\",\n      \"controller\": {\n        \"@id\": \"sec:controller\",\n        \"@type\": \"@id\"\n      },\n      \"delegator\": {\n        \"@id\": \"sec:delegator\",\n        \"@type\": \"@id\"\n      },\n      \"equihashParameterK\": {\n        \"@id\": \"sec:equihashParameterK\",\n        \"@type\": \"xsd:integer\"\n      },\n      \"equihashParameterN\": {\n        \"@id\": \"sec:equihashParameterN\",\n        \"@type\": \"xsd:integer\"\n      },\n      \"invocationTarget\": {\n        \"@id\": \"sec:invocationTarget\",\n        \"@type\": \"@id\"\n      },\n      \"invoker\": {\n        \"@id\": \"sec:invoker\",\n        \"@type\": \"@id\"\n      },\n      \"jws\": \"sec:jws\",\n      \"keyAgreement\": {\n        \"@id\": \"sec:keyAgreementMethod\",\n        \"@type\": \"@id\",\n        \"@container\": \"@set\"\n      },\n      \"kmsModule\": {\n        \"@id\": \"sec:kmsModule\"\n      },\n      \"parentCapability\": {\n        \"@id\": \"sec:parentCapability\",\n        \"@type\": \"@id\"\n      },\n      \"plaintext\": \"sec:plaintext\",\n      \"proof\": {\n        \"@id\": \"sec:proof\",\n        \"@type\": \"@id\",\n        \"@container\": \"@graph\"\n      },\n      \"proofPurpose\": {\n        \"@id\": \"sec:proofPurpose\",\n        \"@type\": \"@vocab\"\n      },\n      \"proofValue\": \"sec:proofValue\",\n      \"referenceId\": \"sec:referenceId\",\n      \"unwrappedKey\": \"sec:unwrappedKey\",\n      \"verificationMethod\": {\n        \"@id\": \"sec:verificationMethod\",\n        \"@type\": \"@id\"\n      },\n      \"verifyData\": \"sec:verifyData\",\n      \"wrappedKey\": \"sec:wrappedKey\"\n    }\n  ]\n}\n"
  },
  {
    "path": "packages/credential-ld/src/contexts/w3id.org_security_v3-unstable.json",
    "content": "{\n  \"@context\": [\n    {\n      \"@version\": 1.1,\n      \"id\": \"@id\",\n      \"type\": \"@type\",\n      \"@protected\": true,\n      \"JsonWebKey2020\": {\n        \"@id\": \"https://w3id.org/security#JsonWebKey2020\"\n      },\n      \"JsonWebSignature2020\": {\n        \"@id\": \"https://w3id.org/security#JsonWebSignature2020\",\n        \"@context\": {\n          \"@version\": 1.1,\n          \"id\": \"@id\",\n          \"type\": \"@type\",\n          \"@protected\": true,\n          \"challenge\": \"https://w3id.org/security#challenge\",\n          \"created\": {\n            \"@id\": \"http://purl.org/dc/terms/created\",\n            \"@type\": \"http://www.w3.org/2001/XMLSchema#dateTime\"\n          },\n          \"domain\": \"https://w3id.org/security#domain\",\n          \"expires\": {\n            \"@id\": \"https://w3id.org/security#expiration\",\n            \"@type\": \"http://www.w3.org/2001/XMLSchema#dateTime\"\n          },\n          \"jws\": \"https://w3id.org/security#jws\",\n          \"nonce\": \"https://w3id.org/security#nonce\",\n          \"proofPurpose\": {\n            \"@id\": \"https://w3id.org/security#proofPurpose\",\n            \"@type\": \"@vocab\",\n            \"@context\": {\n              \"@version\": 1.1,\n              \"@protected\": true,\n              \"id\": \"@id\",\n              \"type\": \"@type\",\n              \"assertionMethod\": {\n                \"@id\": \"https://w3id.org/security#assertionMethod\",\n                \"@type\": \"@id\",\n                \"@container\": \"@set\"\n              },\n              \"authentication\": {\n                \"@id\": \"https://w3id.org/security#authenticationMethod\",\n                \"@type\": \"@id\",\n                \"@container\": \"@set\"\n              },\n              \"capabilityInvocation\": {\n                \"@id\": \"https://w3id.org/security#capabilityInvocationMethod\",\n                \"@type\": \"@id\",\n                \"@container\": \"@set\"\n              },\n              \"capabilityDelegation\": {\n                \"@id\": \"https://w3id.org/security#capabilityDelegationMethod\",\n                \"@type\": \"@id\",\n                \"@container\": \"@set\"\n              },\n              \"keyAgreement\": {\n                \"@id\": \"https://w3id.org/security#keyAgreementMethod\",\n                \"@type\": \"@id\",\n                \"@container\": \"@set\"\n              }\n            }\n          },\n          \"verificationMethod\": {\n            \"@id\": \"https://w3id.org/security#verificationMethod\",\n            \"@type\": \"@id\"\n          }\n        }\n      },\n      \"Ed25519VerificationKey2020\": {\n        \"@id\": \"https://w3id.org/security#Ed25519VerificationKey2020\"\n      },\n      \"Ed25519Signature2020\": {\n        \"@id\": \"https://w3id.org/security#Ed25519Signature2020\",\n        \"@context\": {\n          \"@protected\": true,\n          \"id\": \"@id\",\n          \"type\": \"@type\",\n          \"challenge\": \"https://w3id.org/security#challenge\",\n          \"created\": {\n            \"@id\": \"http://purl.org/dc/terms/created\",\n            \"@type\": \"http://www.w3.org/2001/XMLSchema#dateTime\"\n          },\n          \"domain\": \"https://w3id.org/security#domain\",\n          \"expires\": {\n            \"@id\": \"https://w3id.org/security#expiration\",\n            \"@type\": \"http://www.w3.org/2001/XMLSchema#dateTime\"\n          },\n          \"nonce\": \"https://w3id.org/security#nonce\",\n          \"proofPurpose\": {\n            \"@id\": \"https://w3id.org/security#proofPurpose\",\n            \"@type\": \"@vocab\",\n            \"@context\": {\n              \"@version\": 1.1,\n              \"@protected\": true,\n              \"id\": \"@id\",\n              \"type\": \"@type\",\n              \"assertionMethod\": {\n                \"@id\": \"https://w3id.org/security#assertionMethod\",\n                \"@type\": \"@id\",\n                \"@container\": \"@set\"\n              },\n              \"authentication\": {\n                \"@id\": \"https://w3id.org/security#authenticationMethod\",\n                \"@type\": \"@id\",\n                \"@container\": \"@set\"\n              },\n              \"capabilityInvocation\": {\n                \"@id\": \"https://w3id.org/security#capabilityInvocationMethod\",\n                \"@type\": \"@id\",\n                \"@container\": \"@set\"\n              },\n              \"capabilityDelegation\": {\n                \"@id\": \"https://w3id.org/security#capabilityDelegationMethod\",\n                \"@type\": \"@id\",\n                \"@container\": \"@set\"\n              },\n              \"keyAgreement\": {\n                \"@id\": \"https://w3id.org/security#keyAgreementMethod\",\n                \"@type\": \"@id\",\n                \"@container\": \"@set\"\n              }\n            }\n          },\n          \"proofValue\": {\n            \"@id\": \"https://w3id.org/security#proofValue\",\n            \"@type\": \"https://w3id.org/security#multibase\"\n          },\n          \"verificationMethod\": {\n            \"@id\": \"https://w3id.org/security#verificationMethod\",\n            \"@type\": \"@id\"\n          }\n        }\n      },\n      \"publicKeyJwk\": {\n        \"@id\": \"https://w3id.org/security#publicKeyJwk\",\n        \"@type\": \"@json\"\n      },\n      \"ethereumAddress\": {\n        \"@id\": \"https://w3id.org/security#ethereumAddress\"\n      },\n      \"publicKeyHex\": {\n        \"@id\": \"https://w3id.org/security#publicKeyHex\"\n      },\n      \"blockchainAccountId\": {\n        \"@id\": \"https://w3id.org/security#blockchainAccountId\"\n      },\n      \"MerkleProof2019\": {\n        \"@id\": \"https://w3id.org/security#MerkleProof2019\"\n      },\n      \"Bls12381G1Key2020\": {\n        \"@id\": \"https://w3id.org/security#Bls12381G1Key2020\"\n      },\n      \"Bls12381G2Key2020\": {\n        \"@id\": \"https://w3id.org/security#Bls12381G2Key2020\"\n      },\n      \"BbsBlsSignature2020\": {\n        \"@id\": \"https://w3id.org/security#BbsBlsSignature2020\",\n        \"@context\": {\n          \"@protected\": true,\n          \"id\": \"@id\",\n          \"type\": \"@type\",\n          \"challenge\": \"https://w3id.org/security#challenge\",\n          \"created\": {\n            \"@id\": \"http://purl.org/dc/terms/created\",\n            \"@type\": \"http://www.w3.org/2001/XMLSchema#dateTime\"\n          },\n          \"domain\": \"https://w3id.org/security#domain\",\n          \"nonce\": \"https://w3id.org/security#nonce\",\n          \"proofPurpose\": {\n            \"@id\": \"https://w3id.org/security#proofPurpose\",\n            \"@type\": \"@vocab\",\n            \"@context\": {\n              \"@version\": 1.1,\n              \"@protected\": true,\n              \"id\": \"@id\",\n              \"type\": \"@type\",\n              \"assertionMethod\": {\n                \"@id\": \"https://w3id.org/security#assertionMethod\",\n                \"@type\": \"@id\",\n                \"@container\": \"@set\"\n              },\n              \"authentication\": {\n                \"@id\": \"https://w3id.org/security#authenticationMethod\",\n                \"@type\": \"@id\",\n                \"@container\": \"@set\"\n              },\n              \"capabilityInvocation\": {\n                \"@id\": \"https://w3id.org/security#capabilityInvocationMethod\",\n                \"@type\": \"@id\",\n                \"@container\": \"@set\"\n              },\n              \"capabilityDelegation\": {\n                \"@id\": \"https://w3id.org/security#capabilityDelegationMethod\",\n                \"@type\": \"@id\",\n                \"@container\": \"@set\"\n              },\n              \"keyAgreement\": {\n                \"@id\": \"https://w3id.org/security#keyAgreementMethod\",\n                \"@type\": \"@id\",\n                \"@container\": \"@set\"\n              }\n            }\n          },\n          \"proofValue\": \"https://w3id.org/security#proofValue\",\n          \"verificationMethod\": {\n            \"@id\": \"https://w3id.org/security#verificationMethod\",\n            \"@type\": \"@id\"\n          }\n        }\n      },\n      \"BbsBlsSignatureProof2020\": {\n        \"@id\": \"https://w3id.org/security#BbsBlsSignatureProof2020\",\n        \"@context\": {\n          \"@protected\": true,\n          \"id\": \"@id\",\n          \"type\": \"@type\",\n          \"challenge\": \"https://w3id.org/security#challenge\",\n          \"created\": {\n            \"@id\": \"http://purl.org/dc/terms/created\",\n            \"@type\": \"http://www.w3.org/2001/XMLSchema#dateTime\"\n          },\n          \"domain\": \"https://w3id.org/security#domain\",\n          \"nonce\": \"https://w3id.org/security#nonce\",\n          \"proofPurpose\": {\n            \"@id\": \"https://w3id.org/security#proofPurpose\",\n            \"@type\": \"@vocab\",\n            \"@context\": {\n              \"@version\": 1.1,\n              \"@protected\": true,\n              \"id\": \"@id\",\n              \"type\": \"@type\",\n              \"assertionMethod\": {\n                \"@id\": \"https://w3id.org/security#assertionMethod\",\n                \"@type\": \"@id\",\n                \"@container\": \"@set\"\n              },\n              \"authentication\": {\n                \"@id\": \"https://w3id.org/security#authenticationMethod\",\n                \"@type\": \"@id\",\n                \"@container\": \"@set\"\n              },\n              \"capabilityInvocation\": {\n                \"@id\": \"https://w3id.org/security#capabilityInvocationMethod\",\n                \"@type\": \"@id\",\n                \"@container\": \"@set\"\n              },\n              \"capabilityDelegation\": {\n                \"@id\": \"https://w3id.org/security#capabilityDelegationMethod\",\n                \"@type\": \"@id\",\n                \"@container\": \"@set\"\n              },\n              \"keyAgreement\": {\n                \"@id\": \"https://w3id.org/security#keyAgreementMethod\",\n                \"@type\": \"@id\",\n                \"@container\": \"@set\"\n              }\n            }\n          },\n          \"proofValue\": \"https://w3id.org/security#proofValue\",\n          \"verificationMethod\": {\n            \"@id\": \"https://w3id.org/security#verificationMethod\",\n            \"@type\": \"@id\"\n          }\n        }\n      },\n      \"EcdsaKoblitzSignature2016\": \"https://w3id.org/security#EcdsaKoblitzSignature2016\",\n      \"Ed25519Signature2018\": {\n        \"@id\": \"https://w3id.org/security#Ed25519Signature2018\",\n        \"@context\": {\n          \"@protected\": true,\n          \"id\": \"@id\",\n          \"type\": \"@type\",\n          \"challenge\": \"https://w3id.org/security#challenge\",\n          \"created\": {\n            \"@id\": \"http://purl.org/dc/terms/created\",\n            \"@type\": \"http://www.w3.org/2001/XMLSchema#dateTime\"\n          },\n          \"domain\": \"https://w3id.org/security#domain\",\n          \"expires\": {\n            \"@id\": \"https://w3id.org/security#expiration\",\n            \"@type\": \"http://www.w3.org/2001/XMLSchema#dateTime\"\n          },\n          \"jws\": \"https://w3id.org/security#jws\",\n          \"nonce\": \"https://w3id.org/security#nonce\",\n          \"proofPurpose\": {\n            \"@id\": \"https://w3id.org/security#proofPurpose\",\n            \"@type\": \"@vocab\",\n            \"@context\": {\n              \"@version\": 1.1,\n              \"@protected\": true,\n              \"id\": \"@id\",\n              \"type\": \"@type\",\n              \"assertionMethod\": {\n                \"@id\": \"https://w3id.org/security#assertionMethod\",\n                \"@type\": \"@id\",\n                \"@container\": \"@set\"\n              },\n              \"authentication\": {\n                \"@id\": \"https://w3id.org/security#authenticationMethod\",\n                \"@type\": \"@id\",\n                \"@container\": \"@set\"\n              },\n              \"capabilityInvocation\": {\n                \"@id\": \"https://w3id.org/security#capabilityInvocationMethod\",\n                \"@type\": \"@id\",\n                \"@container\": \"@set\"\n              },\n              \"capabilityDelegation\": {\n                \"@id\": \"https://w3id.org/security#capabilityDelegationMethod\",\n                \"@type\": \"@id\",\n                \"@container\": \"@set\"\n              },\n              \"keyAgreement\": {\n                \"@id\": \"https://w3id.org/security#keyAgreementMethod\",\n                \"@type\": \"@id\",\n                \"@container\": \"@set\"\n              }\n            }\n          },\n          \"proofValue\": \"https://w3id.org/security#proofValue\",\n          \"verificationMethod\": {\n            \"@id\": \"https://w3id.org/security#verificationMethod\",\n            \"@type\": \"@id\"\n          }\n        }\n      },\n      \"EncryptedMessage\": \"https://w3id.org/security#EncryptedMessage\",\n      \"GraphSignature2012\": \"https://w3id.org/security#GraphSignature2012\",\n      \"LinkedDataSignature2015\": \"https://w3id.org/security#LinkedDataSignature2015\",\n      \"LinkedDataSignature2016\": \"https://w3id.org/security#LinkedDataSignature2016\",\n      \"CryptographicKey\": \"https://w3id.org/security#Key\",\n      \"authenticationTag\": \"https://w3id.org/security#authenticationTag\",\n      \"canonicalizationAlgorithm\": \"https://w3id.org/security#canonicalizationAlgorithm\",\n      \"cipherAlgorithm\": \"https://w3id.org/security#cipherAlgorithm\",\n      \"cipherData\": \"https://w3id.org/security#cipherData\",\n      \"cipherKey\": \"https://w3id.org/security#cipherKey\",\n      \"created\": {\n        \"@id\": \"http://purl.org/dc/terms/created\",\n        \"@type\": \"http://www.w3.org/2001/XMLSchema#dateTime\"\n      },\n      \"creator\": {\n        \"@id\": \"http://purl.org/dc/terms/creator\",\n        \"@type\": \"@id\"\n      },\n      \"digestAlgorithm\": \"https://w3id.org/security#digestAlgorithm\",\n      \"digestValue\": \"https://w3id.org/security#digestValue\",\n      \"domain\": \"https://w3id.org/security#domain\",\n      \"encryptionKey\": \"https://w3id.org/security#encryptionKey\",\n      \"expiration\": {\n        \"@id\": \"https://w3id.org/security#expiration\",\n        \"@type\": \"http://www.w3.org/2001/XMLSchema#dateTime\"\n      },\n      \"expires\": {\n        \"@id\": \"https://w3id.org/security#expiration\",\n        \"@type\": \"http://www.w3.org/2001/XMLSchema#dateTime\"\n      },\n      \"initializationVector\": \"https://w3id.org/security#initializationVector\",\n      \"iterationCount\": \"https://w3id.org/security#iterationCount\",\n      \"nonce\": \"https://w3id.org/security#nonce\",\n      \"normalizationAlgorithm\": \"https://w3id.org/security#normalizationAlgorithm\",\n      \"owner\": \"https://w3id.org/security#owner\",\n      \"password\": \"https://w3id.org/security#password\",\n      \"privateKey\": \"https://w3id.org/security#privateKey\",\n      \"privateKeyPem\": \"https://w3id.org/security#privateKeyPem\",\n      \"publicKey\": \"https://w3id.org/security#publicKey\",\n      \"publicKeyBase58\": \"https://w3id.org/security#publicKeyBase58\",\n      \"publicKeyPem\": \"https://w3id.org/security#publicKeyPem\",\n      \"publicKeyWif\": \"https://w3id.org/security#publicKeyWif\",\n      \"publicKeyService\": \"https://w3id.org/security#publicKeyService\",\n      \"revoked\": {\n        \"@id\": \"https://w3id.org/security#revoked\",\n        \"@type\": \"http://www.w3.org/2001/XMLSchema#dateTime\"\n      },\n      \"salt\": \"https://w3id.org/security#salt\",\n      \"signature\": \"https://w3id.org/security#signature\",\n      \"signatureAlgorithm\": \"https://w3id.org/security#signingAlgorithm\",\n      \"signatureValue\": \"https://w3id.org/security#signatureValue\",\n      \"proofValue\": \"https://w3id.org/security#proofValue\",\n      \"AesKeyWrappingKey2019\": \"https://w3id.org/security#AesKeyWrappingKey2019\",\n      \"DeleteKeyOperation\": \"https://w3id.org/security#DeleteKeyOperation\",\n      \"DeriveSecretOperation\": \"https://w3id.org/security#DeriveSecretOperation\",\n      \"EcdsaSecp256k1Signature2019\": {\n        \"@id\": \"https://w3id.org/security#EcdsaSecp256k1Signature2019\",\n        \"@context\": {\n          \"@protected\": true,\n          \"id\": \"@id\",\n          \"type\": \"@type\",\n          \"challenge\": \"https://w3id.org/security#challenge\",\n          \"created\": {\n            \"@id\": \"http://purl.org/dc/terms/created\",\n            \"@type\": \"http://www.w3.org/2001/XMLSchema#dateTime\"\n          },\n          \"domain\": \"https://w3id.org/security#domain\",\n          \"expires\": {\n            \"@id\": \"https://w3id.org/security#expiration\",\n            \"@type\": \"http://www.w3.org/2001/XMLSchema#dateTime\"\n          },\n          \"jws\": \"https://w3id.org/security#jws\",\n          \"nonce\": \"https://w3id.org/security#nonce\",\n          \"proofPurpose\": {\n            \"@id\": \"https://w3id.org/security#proofPurpose\",\n            \"@type\": \"@vocab\",\n            \"@context\": {\n              \"@version\": 1.1,\n              \"@protected\": true,\n              \"id\": \"@id\",\n              \"type\": \"@type\",\n              \"assertionMethod\": {\n                \"@id\": \"https://w3id.org/security#assertionMethod\",\n                \"@type\": \"@id\",\n                \"@container\": \"@set\"\n              },\n              \"authentication\": {\n                \"@id\": \"https://w3id.org/security#authenticationMethod\",\n                \"@type\": \"@id\",\n                \"@container\": \"@set\"\n              },\n              \"capabilityInvocation\": {\n                \"@id\": \"https://w3id.org/security#capabilityInvocationMethod\",\n                \"@type\": \"@id\",\n                \"@container\": \"@set\"\n              },\n              \"capabilityDelegation\": {\n                \"@id\": \"https://w3id.org/security#capabilityDelegationMethod\",\n                \"@type\": \"@id\",\n                \"@container\": \"@set\"\n              },\n              \"keyAgreement\": {\n                \"@id\": \"https://w3id.org/security#keyAgreementMethod\",\n                \"@type\": \"@id\",\n                \"@container\": \"@set\"\n              }\n            }\n          },\n          \"proofValue\": \"https://w3id.org/security#proofValue\",\n          \"verificationMethod\": {\n            \"@id\": \"https://w3id.org/security#verificationMethod\",\n            \"@type\": \"@id\"\n          }\n        }\n      },\n      \"EcdsaSecp256r1Signature2019\": {\n        \"@id\": \"https://w3id.org/security#EcdsaSecp256r1Signature2019\",\n        \"@context\": {\n          \"@protected\": true,\n          \"id\": \"@id\",\n          \"type\": \"@type\",\n          \"challenge\": \"https://w3id.org/security#challenge\",\n          \"created\": {\n            \"@id\": \"http://purl.org/dc/terms/created\",\n            \"@type\": \"http://www.w3.org/2001/XMLSchema#dateTime\"\n          },\n          \"domain\": \"https://w3id.org/security#domain\",\n          \"expires\": {\n            \"@id\": \"https://w3id.org/security#expiration\",\n            \"@type\": \"http://www.w3.org/2001/XMLSchema#dateTime\"\n          },\n          \"jws\": \"https://w3id.org/security#jws\",\n          \"nonce\": \"https://w3id.org/security#nonce\",\n          \"proofPurpose\": {\n            \"@id\": \"https://w3id.org/security#proofPurpose\",\n            \"@type\": \"@vocab\",\n            \"@context\": {\n              \"@version\": 1.1,\n              \"@protected\": true,\n              \"id\": \"@id\",\n              \"type\": \"@type\",\n              \"assertionMethod\": {\n                \"@id\": \"https://w3id.org/security#assertionMethod\",\n                \"@type\": \"@id\",\n                \"@container\": \"@set\"\n              },\n              \"authentication\": {\n                \"@id\": \"https://w3id.org/security#authenticationMethod\",\n                \"@type\": \"@id\",\n                \"@container\": \"@set\"\n              },\n              \"capabilityInvocation\": {\n                \"@id\": \"https://w3id.org/security#capabilityInvocationMethod\",\n                \"@type\": \"@id\",\n                \"@container\": \"@set\"\n              },\n              \"capabilityDelegation\": {\n                \"@id\": \"https://w3id.org/security#capabilityDelegationMethod\",\n                \"@type\": \"@id\",\n                \"@container\": \"@set\"\n              },\n              \"keyAgreement\": {\n                \"@id\": \"https://w3id.org/security#keyAgreementMethod\",\n                \"@type\": \"@id\",\n                \"@container\": \"@set\"\n              }\n            }\n          },\n          \"proofValue\": \"https://w3id.org/security#proofValue\",\n          \"verificationMethod\": {\n            \"@id\": \"https://w3id.org/security#verificationMethod\",\n            \"@type\": \"@id\"\n          }\n        }\n      },\n      \"EcdsaSecp256k1VerificationKey2019\": \"https://w3id.org/security#EcdsaSecp256k1VerificationKey2019\",\n      \"EcdsaSecp256r1VerificationKey2019\": \"https://w3id.org/security#EcdsaSecp256r1VerificationKey2019\",\n      \"Ed25519VerificationKey2018\": \"https://w3id.org/security#Ed25519VerificationKey2018\",\n      \"EquihashProof2018\": \"https://w3id.org/security#EquihashProof2018\",\n      \"ExportKeyOperation\": \"https://w3id.org/security#ExportKeyOperation\",\n      \"GenerateKeyOperation\": \"https://w3id.org/security#GenerateKeyOperation\",\n      \"KmsOperation\": \"https://w3id.org/security#KmsOperation\",\n      \"RevokeKeyOperation\": \"https://w3id.org/security#RevokeKeyOperation\",\n      \"RsaSignature2018\": {\n        \"@id\": \"https://w3id.org/security#RsaSignature2018\",\n        \"@context\": {\n          \"@protected\": true,\n          \"challenge\": \"https://w3id.org/security#challenge\",\n          \"created\": {\n            \"@id\": \"http://purl.org/dc/terms/created\",\n            \"@type\": \"http://www.w3.org/2001/XMLSchema#dateTime\"\n          },\n          \"domain\": \"https://w3id.org/security#domain\",\n          \"expires\": {\n            \"@id\": \"https://w3id.org/security#expiration\",\n            \"@type\": \"http://www.w3.org/2001/XMLSchema#dateTime\"\n          },\n          \"jws\": \"https://w3id.org/security#jws\",\n          \"nonce\": \"https://w3id.org/security#nonce\",\n          \"proofPurpose\": {\n            \"@id\": \"https://w3id.org/security#proofPurpose\",\n            \"@type\": \"@vocab\",\n            \"@context\": {\n              \"@version\": 1.1,\n              \"@protected\": true,\n              \"id\": \"@id\",\n              \"type\": \"@type\",\n              \"assertionMethod\": {\n                \"@id\": \"https://w3id.org/security#assertionMethod\",\n                \"@type\": \"@id\",\n                \"@container\": \"@set\"\n              },\n              \"authentication\": {\n                \"@id\": \"https://w3id.org/security#authenticationMethod\",\n                \"@type\": \"@id\",\n                \"@container\": \"@set\"\n              },\n              \"capabilityInvocation\": {\n                \"@id\": \"https://w3id.org/security#capabilityInvocationMethod\",\n                \"@type\": \"@id\",\n                \"@container\": \"@set\"\n              },\n              \"capabilityDelegation\": {\n                \"@id\": \"https://w3id.org/security#capabilityDelegationMethod\",\n                \"@type\": \"@id\",\n                \"@container\": \"@set\"\n              },\n              \"keyAgreement\": {\n                \"@id\": \"https://w3id.org/security#keyAgreementMethod\",\n                \"@type\": \"@id\",\n                \"@container\": \"@set\"\n              }\n            }\n          },\n          \"proofValue\": \"https://w3id.org/security#proofValue\",\n          \"verificationMethod\": {\n            \"@id\": \"https://w3id.org/security#verificationMethod\",\n            \"@type\": \"@id\"\n          }\n        }\n      },\n      \"RsaVerificationKey2018\": \"https://w3id.org/security#RsaVerificationKey2018\",\n      \"Sha256HmacKey2019\": \"https://w3id.org/security#Sha256HmacKey2019\",\n      \"SignOperation\": \"https://w3id.org/security#SignOperation\",\n      \"UnwrapKeyOperation\": \"https://w3id.org/security#UnwrapKeyOperation\",\n      \"VerifyOperation\": \"https://w3id.org/security#VerifyOperation\",\n      \"WrapKeyOperation\": \"https://w3id.org/security#WrapKeyOperation\",\n      \"X25519KeyAgreementKey2019\": \"https://w3id.org/security#X25519KeyAgreementKey2019\",\n      \"allowedAction\": \"https://w3id.org/security#allowedAction\",\n      \"assertionMethod\": {\n        \"@id\": \"https://w3id.org/security#assertionMethod\",\n        \"@type\": \"@id\",\n        \"@container\": \"@set\"\n      },\n      \"authentication\": {\n        \"@id\": \"https://w3id.org/security#authenticationMethod\",\n        \"@type\": \"@id\",\n        \"@container\": \"@set\"\n      },\n      \"capability\": {\n        \"@id\": \"https://w3id.org/security#capability\",\n        \"@type\": \"@id\"\n      },\n      \"capabilityAction\": \"https://w3id.org/security#capabilityAction\",\n      \"capabilityChain\": {\n        \"@id\": \"https://w3id.org/security#capabilityChain\",\n        \"@type\": \"@id\",\n        \"@container\": \"@list\"\n      },\n      \"capabilityDelegation\": {\n        \"@id\": \"https://w3id.org/security#capabilityDelegationMethod\",\n        \"@type\": \"@id\",\n        \"@container\": \"@set\"\n      },\n      \"capabilityInvocation\": {\n        \"@id\": \"https://w3id.org/security#capabilityInvocationMethod\",\n        \"@type\": \"@id\",\n        \"@container\": \"@set\"\n      },\n      \"caveat\": {\n        \"@id\": \"https://w3id.org/security#caveat\",\n        \"@type\": \"@id\",\n        \"@container\": \"@set\"\n      },\n      \"challenge\": \"https://w3id.org/security#challenge\",\n      \"ciphertext\": \"https://w3id.org/security#ciphertext\",\n      \"controller\": {\n        \"@id\": \"https://w3id.org/security#controller\",\n        \"@type\": \"@id\"\n      },\n      \"delegator\": {\n        \"@id\": \"https://w3id.org/security#delegator\",\n        \"@type\": \"@id\"\n      },\n      \"equihashParameterK\": {\n        \"@id\": \"https://w3id.org/security#equihashParameterK\",\n        \"@type\": \"http://www.w3.org/2001/XMLSchema#:integer\"\n      },\n      \"equihashParameterN\": {\n        \"@id\": \"https://w3id.org/security#equihashParameterN\",\n        \"@type\": \"http://www.w3.org/2001/XMLSchema#:integer\"\n      },\n      \"invocationTarget\": {\n        \"@id\": \"https://w3id.org/security#invocationTarget\",\n        \"@type\": \"@id\"\n      },\n      \"invoker\": {\n        \"@id\": \"https://w3id.org/security#invoker\",\n        \"@type\": \"@id\"\n      },\n      \"jws\": \"https://w3id.org/security#jws\",\n      \"keyAgreement\": {\n        \"@id\": \"https://w3id.org/security#keyAgreementMethod\",\n        \"@type\": \"@id\",\n        \"@container\": \"@set\"\n      },\n      \"kmsModule\": {\n        \"@id\": \"https://w3id.org/security#kmsModule\"\n      },\n      \"parentCapability\": {\n        \"@id\": \"https://w3id.org/security#parentCapability\",\n        \"@type\": \"@id\"\n      },\n      \"plaintext\": \"https://w3id.org/security#plaintext\",\n      \"proof\": {\n        \"@id\": \"https://w3id.org/security#proof\",\n        \"@type\": \"@id\",\n        \"@container\": \"@graph\"\n      },\n      \"proofPurpose\": {\n        \"@id\": \"https://w3id.org/security#proofPurpose\",\n        \"@type\": \"@vocab\",\n        \"@context\": {\n          \"@version\": 1.1,\n          \"@protected\": true,\n          \"id\": \"@id\",\n          \"type\": \"@type\",\n          \"assertionMethod\": {\n            \"@id\": \"https://w3id.org/security#assertionMethod\",\n            \"@type\": \"@id\",\n            \"@container\": \"@set\"\n          },\n          \"authentication\": {\n            \"@id\": \"https://w3id.org/security#authenticationMethod\",\n            \"@type\": \"@id\",\n            \"@container\": \"@set\"\n          },\n          \"capabilityInvocation\": {\n            \"@id\": \"https://w3id.org/security#capabilityInvocationMethod\",\n            \"@type\": \"@id\",\n            \"@container\": \"@set\"\n          },\n          \"capabilityDelegation\": {\n            \"@id\": \"https://w3id.org/security#capabilityDelegationMethod\",\n            \"@type\": \"@id\",\n            \"@container\": \"@set\"\n          },\n          \"keyAgreement\": {\n            \"@id\": \"https://w3id.org/security#keyAgreementMethod\",\n            \"@type\": \"@id\",\n            \"@container\": \"@set\"\n          }\n        }\n      },\n      \"referenceId\": \"https://w3id.org/security#referenceId\",\n      \"unwrappedKey\": \"https://w3id.org/security#unwrappedKey\",\n      \"verificationMethod\": {\n        \"@id\": \"https://w3id.org/security#verificationMethod\",\n        \"@type\": \"@id\"\n      },\n      \"verifyData\": \"https://w3id.org/security#verifyData\",\n      \"wrappedKey\": \"https://w3id.org/security#wrappedKey\",\n      \"x509CertificateChain\": {\n        \"@id\": \"https://w3id.org/security#x509CertificateChain\",\n        \"@type\": \"https://w3id.org/security#multibase\",\n        \"@container\": \"@list\"\n      },\n      \"x509CertificateFingerprint\": {\n        \"@id\": \"https://w3id.org/security#x509CertificateFingerprint\",\n        \"@type\": \"https://w3id.org/security#multibase\"\n      }\n    }\n  ]\n}\n"
  },
  {
    "path": "packages/credential-ld/src/contexts/www.w3.org_2018_credentials_examples_v1.json",
    "content": "{\n  \"@context\": [\n    {\n      \"@version\": 1.1\n    },\n    \"https://www.w3.org/ns/odrl.jsonld\",\n    {\n      \"ex\": \"https://example.org/examples#\",\n      \"schema\": \"http://schema.org/\",\n      \"rdf\": \"http://www.w3.org/1999/02/22-rdf-syntax-ns#\",\n      \"3rdPartyCorrelation\": \"ex:3rdPartyCorrelation\",\n      \"AllVerifiers\": \"ex:AllVerifiers\",\n      \"Archival\": \"ex:Archival\",\n      \"BachelorDegree\": \"ex:BachelorDegree\",\n      \"Child\": \"ex:Child\",\n      \"CLCredentialDefinition2019\": \"ex:CLCredentialDefinition2019\",\n      \"CLSignature2019\": \"ex:CLSignature2019\",\n      \"IssuerPolicy\": \"ex:IssuerPolicy\",\n      \"HolderPolicy\": \"ex:HolderPolicy\",\n      \"Mother\": \"ex:Mother\",\n      \"RelationshipCredential\": \"ex:RelationshipCredential\",\n      \"UniversityDegreeCredential\": \"ex:UniversityDegreeCredential\",\n      \"AlumniCredential\": \"ex:AlumniCredential\",\n      \"DisputeCredential\": \"ex:DisputeCredential\",\n      \"PrescriptionCredential\": \"ex:PrescriptionCredential\",\n      \"ZkpExampleSchema2018\": \"ex:ZkpExampleSchema2018\",\n      \"issuerData\": \"ex:issuerData\",\n      \"attributes\": \"ex:attributes\",\n      \"signature\": \"ex:signature\",\n      \"signatureCorrectnessProof\": \"ex:signatureCorrectnessProof\",\n      \"primaryProof\": \"ex:primaryProof\",\n      \"nonRevocationProof\": \"ex:nonRevocationProof\",\n      \"alumniOf\": {\n        \"@id\": \"schema:alumniOf\",\n        \"@type\": \"rdf:HTML\"\n      },\n      \"child\": {\n        \"@id\": \"ex:child\",\n        \"@type\": \"@id\"\n      },\n      \"degree\": \"ex:degree\",\n      \"degreeType\": \"ex:degreeType\",\n      \"degreeSchool\": \"ex:degreeSchool\",\n      \"college\": \"ex:college\",\n      \"name\": {\n        \"@id\": \"schema:name\",\n        \"@type\": \"rdf:HTML\"\n      },\n      \"givenName\": \"schema:givenName\",\n      \"familyName\": \"schema:familyName\",\n      \"parent\": {\n        \"@id\": \"ex:parent\",\n        \"@type\": \"@id\"\n      },\n      \"referenceId\": \"ex:referenceId\",\n      \"documentPresence\": \"ex:documentPresence\",\n      \"evidenceDocument\": \"ex:evidenceDocument\",\n      \"spouse\": \"schema:spouse\",\n      \"subjectPresence\": \"ex:subjectPresence\",\n      \"verifier\": {\n        \"@id\": \"ex:verifier\",\n        \"@type\": \"@id\"\n      },\n      \"currentStatus\": \"ex:currentStatus\",\n      \"statusReason\": \"ex:statusReason\",\n      \"prescription\": \"ex:prescription\"\n    }\n  ]\n}\n"
  },
  {
    "path": "packages/credential-ld/src/contexts/www.w3.org_2018_credentials_v1.json",
    "content": "{\n  \"@context\": {\n    \"@version\": 1.1,\n    \"@protected\": true,\n    \"id\": \"@id\",\n    \"type\": \"@type\",\n    \"VerifiableCredential\": {\n      \"@id\": \"https://www.w3.org/2018/credentials#VerifiableCredential\",\n      \"@context\": {\n        \"@version\": 1.1,\n        \"@protected\": true,\n        \"id\": \"@id\",\n        \"type\": \"@type\",\n        \"cred\": \"https://www.w3.org/2018/credentials#\",\n        \"sec\": \"https://w3id.org/security#\",\n        \"xsd\": \"http://www.w3.org/2001/XMLSchema#\",\n        \"credentialSchema\": {\n          \"@id\": \"cred:credentialSchema\",\n          \"@type\": \"@id\",\n          \"@context\": {\n            \"@version\": 1.1,\n            \"@protected\": true,\n            \"id\": \"@id\",\n            \"type\": \"@type\",\n            \"cred\": \"https://www.w3.org/2018/credentials#\",\n            \"JsonSchemaValidator2018\": \"cred:JsonSchemaValidator2018\"\n          }\n        },\n        \"credentialStatus\": {\n          \"@id\": \"cred:credentialStatus\",\n          \"@type\": \"@id\"\n        },\n        \"credentialSubject\": {\n          \"@id\": \"cred:credentialSubject\",\n          \"@type\": \"@id\"\n        },\n        \"evidence\": {\n          \"@id\": \"cred:evidence\",\n          \"@type\": \"@id\"\n        },\n        \"expirationDate\": {\n          \"@id\": \"cred:expirationDate\",\n          \"@type\": \"xsd:dateTime\"\n        },\n        \"holder\": {\n          \"@id\": \"cred:holder\",\n          \"@type\": \"@id\"\n        },\n        \"issued\": {\n          \"@id\": \"cred:issued\",\n          \"@type\": \"xsd:dateTime\"\n        },\n        \"issuer\": {\n          \"@id\": \"cred:issuer\",\n          \"@type\": \"@id\"\n        },\n        \"issuanceDate\": {\n          \"@id\": \"cred:issuanceDate\",\n          \"@type\": \"xsd:dateTime\"\n        },\n        \"proof\": {\n          \"@id\": \"sec:proof\",\n          \"@type\": \"@id\",\n          \"@container\": \"@graph\"\n        },\n        \"refreshService\": {\n          \"@id\": \"cred:refreshService\",\n          \"@type\": \"@id\",\n          \"@context\": {\n            \"@version\": 1.1,\n            \"@protected\": true,\n            \"id\": \"@id\",\n            \"type\": \"@type\",\n            \"cred\": \"https://www.w3.org/2018/credentials#\",\n            \"ManualRefreshService2018\": \"cred:ManualRefreshService2018\"\n          }\n        },\n        \"termsOfUse\": {\n          \"@id\": \"cred:termsOfUse\",\n          \"@type\": \"@id\"\n        },\n        \"validFrom\": {\n          \"@id\": \"cred:validFrom\",\n          \"@type\": \"xsd:dateTime\"\n        },\n        \"validUntil\": {\n          \"@id\": \"cred:validUntil\",\n          \"@type\": \"xsd:dateTime\"\n        }\n      }\n    },\n    \"VerifiablePresentation\": {\n      \"@id\": \"https://www.w3.org/2018/credentials#VerifiablePresentation\",\n      \"@context\": {\n        \"@version\": 1.1,\n        \"@protected\": true,\n        \"id\": \"@id\",\n        \"type\": \"@type\",\n        \"cred\": \"https://www.w3.org/2018/credentials#\",\n        \"sec\": \"https://w3id.org/security#\",\n        \"holder\": {\n          \"@id\": \"cred:holder\",\n          \"@type\": \"@id\"\n        },\n        \"proof\": {\n          \"@id\": \"sec:proof\",\n          \"@type\": \"@id\",\n          \"@container\": \"@graph\"\n        },\n        \"verifiableCredential\": {\n          \"@id\": \"cred:verifiableCredential\",\n          \"@type\": \"@id\",\n          \"@container\": \"@graph\"\n        }\n      }\n    },\n    \"EcdsaSecp256k1Signature2019\": {\n      \"@id\": \"https://w3id.org/security#EcdsaSecp256k1Signature2019\",\n      \"@context\": {\n        \"@version\": 1.1,\n        \"@protected\": true,\n        \"id\": \"@id\",\n        \"type\": \"@type\",\n        \"sec\": \"https://w3id.org/security#\",\n        \"xsd\": \"http://www.w3.org/2001/XMLSchema#\",\n        \"challenge\": \"sec:challenge\",\n        \"created\": {\n          \"@id\": \"http://purl.org/dc/terms/created\",\n          \"@type\": \"xsd:dateTime\"\n        },\n        \"domain\": \"sec:domain\",\n        \"expires\": {\n          \"@id\": \"sec:expiration\",\n          \"@type\": \"xsd:dateTime\"\n        },\n        \"jws\": \"sec:jws\",\n        \"nonce\": \"sec:nonce\",\n        \"proofPurpose\": {\n          \"@id\": \"sec:proofPurpose\",\n          \"@type\": \"@vocab\",\n          \"@context\": {\n            \"@version\": 1.1,\n            \"@protected\": true,\n            \"id\": \"@id\",\n            \"type\": \"@type\",\n            \"sec\": \"https://w3id.org/security#\",\n            \"assertionMethod\": {\n              \"@id\": \"sec:assertionMethod\",\n              \"@type\": \"@id\",\n              \"@container\": \"@set\"\n            },\n            \"authentication\": {\n              \"@id\": \"sec:authenticationMethod\",\n              \"@type\": \"@id\",\n              \"@container\": \"@set\"\n            }\n          }\n        },\n        \"proofValue\": \"sec:proofValue\",\n        \"verificationMethod\": {\n          \"@id\": \"sec:verificationMethod\",\n          \"@type\": \"@id\"\n        }\n      }\n    },\n    \"EcdsaSecp256r1Signature2019\": {\n      \"@id\": \"https://w3id.org/security#EcdsaSecp256r1Signature2019\",\n      \"@context\": {\n        \"@version\": 1.1,\n        \"@protected\": true,\n        \"id\": \"@id\",\n        \"type\": \"@type\",\n        \"sec\": \"https://w3id.org/security#\",\n        \"xsd\": \"http://www.w3.org/2001/XMLSchema#\",\n        \"challenge\": \"sec:challenge\",\n        \"created\": {\n          \"@id\": \"http://purl.org/dc/terms/created\",\n          \"@type\": \"xsd:dateTime\"\n        },\n        \"domain\": \"sec:domain\",\n        \"expires\": {\n          \"@id\": \"sec:expiration\",\n          \"@type\": \"xsd:dateTime\"\n        },\n        \"jws\": \"sec:jws\",\n        \"nonce\": \"sec:nonce\",\n        \"proofPurpose\": {\n          \"@id\": \"sec:proofPurpose\",\n          \"@type\": \"@vocab\",\n          \"@context\": {\n            \"@version\": 1.1,\n            \"@protected\": true,\n            \"id\": \"@id\",\n            \"type\": \"@type\",\n            \"sec\": \"https://w3id.org/security#\",\n            \"assertionMethod\": {\n              \"@id\": \"sec:assertionMethod\",\n              \"@type\": \"@id\",\n              \"@container\": \"@set\"\n            },\n            \"authentication\": {\n              \"@id\": \"sec:authenticationMethod\",\n              \"@type\": \"@id\",\n              \"@container\": \"@set\"\n            }\n          }\n        },\n        \"proofValue\": \"sec:proofValue\",\n        \"verificationMethod\": {\n          \"@id\": \"sec:verificationMethod\",\n          \"@type\": \"@id\"\n        }\n      }\n    },\n    \"Ed25519Signature2018\": {\n      \"@id\": \"https://w3id.org/security#Ed25519Signature2018\",\n      \"@context\": {\n        \"@version\": 1.1,\n        \"@protected\": true,\n        \"id\": \"@id\",\n        \"type\": \"@type\",\n        \"sec\": \"https://w3id.org/security#\",\n        \"xsd\": \"http://www.w3.org/2001/XMLSchema#\",\n        \"challenge\": \"sec:challenge\",\n        \"created\": {\n          \"@id\": \"http://purl.org/dc/terms/created\",\n          \"@type\": \"xsd:dateTime\"\n        },\n        \"domain\": \"sec:domain\",\n        \"expires\": {\n          \"@id\": \"sec:expiration\",\n          \"@type\": \"xsd:dateTime\"\n        },\n        \"jws\": \"sec:jws\",\n        \"nonce\": \"sec:nonce\",\n        \"proofPurpose\": {\n          \"@id\": \"sec:proofPurpose\",\n          \"@type\": \"@vocab\",\n          \"@context\": {\n            \"@version\": 1.1,\n            \"@protected\": true,\n            \"id\": \"@id\",\n            \"type\": \"@type\",\n            \"sec\": \"https://w3id.org/security#\",\n            \"assertionMethod\": {\n              \"@id\": \"sec:assertionMethod\",\n              \"@type\": \"@id\",\n              \"@container\": \"@set\"\n            },\n            \"authentication\": {\n              \"@id\": \"sec:authenticationMethod\",\n              \"@type\": \"@id\",\n              \"@container\": \"@set\"\n            }\n          }\n        },\n        \"proofValue\": \"sec:proofValue\",\n        \"verificationMethod\": {\n          \"@id\": \"sec:verificationMethod\",\n          \"@type\": \"@id\"\n        }\n      }\n    },\n    \"RsaSignature2018\": {\n      \"@id\": \"https://w3id.org/security#RsaSignature2018\",\n      \"@context\": {\n        \"@version\": 1.1,\n        \"@protected\": true,\n        \"challenge\": \"sec:challenge\",\n        \"created\": {\n          \"@id\": \"http://purl.org/dc/terms/created\",\n          \"@type\": \"xsd:dateTime\"\n        },\n        \"domain\": \"sec:domain\",\n        \"expires\": {\n          \"@id\": \"sec:expiration\",\n          \"@type\": \"xsd:dateTime\"\n        },\n        \"jws\": \"sec:jws\",\n        \"nonce\": \"sec:nonce\",\n        \"proofPurpose\": {\n          \"@id\": \"sec:proofPurpose\",\n          \"@type\": \"@vocab\",\n          \"@context\": {\n            \"@version\": 1.1,\n            \"@protected\": true,\n            \"id\": \"@id\",\n            \"type\": \"@type\",\n            \"sec\": \"https://w3id.org/security#\",\n            \"assertionMethod\": {\n              \"@id\": \"sec:assertionMethod\",\n              \"@type\": \"@id\",\n              \"@container\": \"@set\"\n            },\n            \"authentication\": {\n              \"@id\": \"sec:authenticationMethod\",\n              \"@type\": \"@id\",\n              \"@container\": \"@set\"\n            }\n          }\n        },\n        \"proofValue\": \"sec:proofValue\",\n        \"verificationMethod\": {\n          \"@id\": \"sec:verificationMethod\",\n          \"@type\": \"@id\"\n        }\n      }\n    },\n    \"proof\": {\n      \"@id\": \"https://w3id.org/security#proof\",\n      \"@type\": \"@id\",\n      \"@container\": \"@graph\"\n    }\n  }\n}\n"
  },
  {
    "path": "packages/credential-ld/src/contexts/www.w3.org_ns_did_v1.json",
    "content": "{\n  \"@context\": {\n    \"@protected\": true,\n    \"id\": \"@id\",\n    \"type\": \"@type\",\n    \"alsoKnownAs\": {\n      \"@id\": \"https://www.w3.org/ns/activitystreams#alsoKnownAs\",\n      \"@type\": \"@id\"\n    },\n    \"assertionMethod\": {\n      \"@id\": \"https://w3id.org/security#assertionMethod\",\n      \"@type\": \"@id\",\n      \"@container\": \"@set\"\n    },\n    \"authentication\": {\n      \"@id\": \"https://w3id.org/security#authenticationMethod\",\n      \"@type\": \"@id\",\n      \"@container\": \"@set\"\n    },\n    \"capabilityDelegation\": {\n      \"@id\": \"https://w3id.org/security#capabilityDelegationMethod\",\n      \"@type\": \"@id\",\n      \"@container\": \"@set\"\n    },\n    \"capabilityInvocation\": {\n      \"@id\": \"https://w3id.org/security#capabilityInvocationMethod\",\n      \"@type\": \"@id\",\n      \"@container\": \"@set\"\n    },\n    \"controller\": {\n      \"@id\": \"https://w3id.org/security#controller\",\n      \"@type\": \"@id\"\n    },\n    \"keyAgreement\": {\n      \"@id\": \"https://w3id.org/security#keyAgreementMethod\",\n      \"@type\": \"@id\",\n      \"@container\": \"@set\"\n    },\n    \"service\": {\n      \"@id\": \"https://www.w3.org/ns/did#service\",\n      \"@type\": \"@id\",\n      \"@context\": {\n        \"@protected\": true,\n        \"id\": \"@id\",\n        \"type\": \"@type\",\n        \"serviceEndpoint\": {\n          \"@id\": \"https://www.w3.org/ns/did#serviceEndpoint\",\n          \"@type\": \"@id\"\n        }\n      }\n    },\n    \"verificationMethod\": {\n      \"@id\": \"https://w3id.org/security#verificationMethod\",\n      \"@type\": \"@id\"\n    }\n  }\n}\n"
  },
  {
    "path": "packages/credential-ld/src/index.ts",
    "content": "/**\n * Provides a {@link @veramo/credential-ld#CredentialProviderLD | handler} for the {@link @veramo/credential-w3c#CredentialPlugin} that\n * implements\n * {@link @veramo/core-types#AbstractCredentialProvider} interface.\n *\n * This plugin adds support for working with JSON-LD credentials.\n * When installed, this plugin will be automatically used by\n * {@link @veramo/credential-w3c#CredentialPlugin | CredentialPlugin} if the user requests the credential to be signed\n * by one of the installed signature suites.\n *\n * @packageDocumentation\n */\nexport { CredentialProviderLD } from './CredentialProviderLD.js'\nexport * from './types.js'\nexport { LdDefaultContexts } from './ld-default-contexts.js'\nexport { VeramoLdSignature } from './ld-suites.js'\nexport * from './suites/EcdsaSecp256k1RecoverySignature2020.js'\nexport * from './suites/Ed25519Signature2018.js'\nexport * from './suites/Ed25519Signature2020.js'\nexport * from './suites/JsonWebSignature2020.js'\n"
  },
  {
    "path": "packages/credential-ld/src/ld-context-loader.ts",
    "content": "/**\n * The LdContextLoader is initialized with a List of Map<string, ContextDoc | Promise<ContextDoc>>\n * that it unifies into a single Map to provide to the documentLoader within\n * the w3c credential module.\n */\nimport { isIterable, OrPromise, RecordLike } from '@veramo/utils'\nimport { ContextDoc } from './types.js'\n\nexport class LdContextLoader {\n  private readonly contexts: Record<string, OrPromise<ContextDoc>>\n\n  constructor(options: { contextsPaths: RecordLike<OrPromise<ContextDoc>>[] }) {\n    this.contexts = {}\n    Array.from(options.contextsPaths, (mapItem) => {\n      const map = isIterable(mapItem) ? mapItem : Object.entries(mapItem)\n      // generate-plugin-schema is failing unless we use the cast to `any[]`\n      for (const [key, value] of map as any[]) {\n        this.contexts[key] = value\n      }\n    })\n  }\n\n  has(url: string): boolean {\n    return this.contexts[url] !== null && typeof this.contexts[url] !== 'undefined'\n  }\n\n  async get(url: string): Promise<ContextDoc> {\n    return this.contexts[url]\n  }\n}\n"
  },
  {
    "path": "packages/credential-ld/src/ld-credential-module.ts",
    "content": "import {\n  CredentialPayload,\n  IAgentContext,\n  IKey,\n  IResolver,\n  IVerifyResult,\n  PresentationPayload,\n  UsingResolutionOptions,\n  VerifiableCredential,\n  VerifiablePresentation,\n} from '@veramo/core-types'\nimport fetch from 'cross-fetch'\nimport Debug from 'debug'\nimport jsonldSignatures from '@digitalcredentials/jsonld-signatures'\n\nconst { extendContextLoader } = jsonldSignatures\nimport * as vc from '@digitalcredentials/vc'\nimport { LdContextLoader } from './ld-context-loader.js'\nimport { LdSuiteLoader } from './ld-suite-loader.js'\nimport { RequiredAgentMethods } from './ld-suites.js'\n\nconst debug = Debug('veramo:w3c:ld-credential-module')\n\ntype ForwardedOptions = UsingResolutionOptions & {\n  fetchRemoteContexts?: boolean // defaults to false\n  now?: Date // defaults to Date.now()\n}\n\nexport class LdCredentialModule {\n  /**\n   * TODO: General Implementation Notes\n   * - (SOLVED) EcdsaSecp256k1Signature2019 (Signature) and EcdsaSecp256k1VerificationKey2019 (Key)\n   * are not useable right now, since they are not able to work with blockChainId and ECRecover.\n   * - DID Fragment Resolution.\n   * - Key Manager and Verification Methods: Veramo currently implements no link between those.\n   */\n\n  private ldContextLoader: LdContextLoader\n  ldSuiteLoader: LdSuiteLoader\n\n  constructor(options: { ldContextLoader: LdContextLoader; ldSuiteLoader: LdSuiteLoader }) {\n    this.ldContextLoader = options.ldContextLoader\n    this.ldSuiteLoader = options.ldSuiteLoader\n  }\n\n  getDocumentLoader(context: IAgentContext<IResolver>, options?: ForwardedOptions) {\n    return extendContextLoader(async (url: string) => {\n      const resolutionOptions = { accept: 'application/did+ld+json', ...options?.resolutionOptions }\n      const attemptToFetchContexts = options?.fetchRemoteContexts ?? false\n\n      // did resolution\n      if (url.toLowerCase().startsWith('did:')) {\n        const resolutionResult = await context.agent.resolveDid({ didUrl: url, options: resolutionOptions })\n        const didDoc = resolutionResult.didDocument\n\n        if (!didDoc) return\n\n        let result: any = didDoc\n\n        // currently, Veramo LD suites can modify the resolution response for DIDs from\n        // the document Loader. This allows us to fix incompatibilities between DID Documents\n        // and LD suites to be fixed specifically within the Veramo LD Suites definition\n        // TODO: every suite takes turns modifying the result, potentially leading to overwrites and incompatibilities\n        // between concurrent suites. Ideally, this should be performed by each suite only before it interacts with the\n        // document loader, to allow each suite to massage the verification methods into formats it knows about.\n        for (const x of this.ldSuiteLoader.getAllSignatureSuites()) {\n          result = (await x.preDidResolutionModification(url, result, context)) || result\n        }\n\n        // console.log(`Returning from Documentloader: ${JSON.stringify(returnDocument)}`)\n        return {\n          contextUrl: null,\n          documentUrl: url,\n          document: result,\n        }\n      }\n\n      if (this.ldContextLoader.has(url)) {\n        const contextDoc = await this.ldContextLoader.get(url)\n        return {\n          contextUrl: null,\n          documentUrl: url,\n          document: contextDoc,\n        }\n      } else {\n        if (attemptToFetchContexts) {\n          // attempt to fetch the remote context!!!! MEGA FAIL for JSON-LD.\n          debug('WARNING: attempting to fetch the doc directly for ', url)\n          try {\n            const response = await fetch(url)\n            if (response.status === 200) {\n              const document = await response.json()\n              return {\n                contextUrl: null,\n                documentUrl: url,\n                document,\n              }\n            }\n          } catch (e) {\n            debug('WARNING: unable to fetch the doc or interpret it as JSON', e)\n          }\n        }\n      }\n\n      debug(\n        `WARNING: Possible unknown context/identifier for ${url} \\n falling back to default documentLoader`,\n      )\n\n      return vc.defaultDocumentLoader(url)\n    })\n  }\n\n  async issueLDVerifiableCredential(\n    credential: CredentialPayload,\n    issuerDid: string,\n    key: IKey,\n    verificationMethodId: string,\n    options: ForwardedOptions,\n    context: IAgentContext<RequiredAgentMethods>,\n  ): Promise<VerifiableCredential> {\n    // TODO: try multiple matching suites until one works or list is exhausted\n    const suite = this.ldSuiteLoader.getSignatureSuiteForKeyType(\n      key.type,\n      key.meta?.verificationMethod?.type ?? '',\n    )[0]\n    const documentLoader = this.getDocumentLoader(context, options)\n\n    // some suites can modify the incoming credential (e.g. add required contexts)\n    suite.preSigningCredModification(credential)\n\n    return await vc.issue({\n      ...options,\n      credential,\n      suite: await suite.getSuiteForSigning(key, issuerDid, verificationMethodId, context),\n      documentLoader,\n      compactProof: false,\n    })\n  }\n\n  async signLDVerifiablePresentation(\n    presentation: PresentationPayload,\n    holderDid: string,\n    key: IKey,\n    verificationMethodId: string,\n    challenge: string | undefined,\n    domain: string | undefined,\n    options: ForwardedOptions,\n    context: IAgentContext<RequiredAgentMethods>,\n  ): Promise<VerifiablePresentation> {\n    // TODO: try multiple matching suites until one works or list is exhausted\n    const suite = this.ldSuiteLoader.getSignatureSuiteForKeyType(\n      key.type,\n      key.meta?.verificationMethod?.type ?? '',\n    )[0]\n    const documentLoader = this.getDocumentLoader(context, options)\n\n    suite.preSigningPresModification(presentation)\n\n    return await vc.signPresentation({\n      ...options,\n      presentation,\n      suite: await suite.getSuiteForSigning(key, holderDid, verificationMethodId, context),\n      challenge,\n      domain,\n      documentLoader,\n      compactProof: false,\n    })\n  }\n\n  async verifyCredential(\n    credential: VerifiableCredential,\n    options: ForwardedOptions,\n    context: IAgentContext<IResolver>,\n  ): Promise<IVerifyResult> {\n    const fetchRemoteContexts = options.fetchRemoteContexts ?? false\n    const result = await vc.verifyCredential({\n      ...options,\n      credential,\n      suite: this.ldSuiteLoader.getAllSignatureSuites().map((x) => x.getSuiteForVerification()),\n      documentLoader: this.getDocumentLoader(context, { ...options, fetchRemoteContexts }),\n      compactProof: false,\n      checkStatus: async () => Promise.resolve({ verified: true }), // Fake method\n    })\n\n    if (!result.verified) {\n      // result can include raw Error\n      debug(`Error verifying LD Credential: ${JSON.stringify(result, null, 2)}`)\n    }\n\n    return result\n  }\n\n  async verifyPresentation(\n    presentation: VerifiablePresentation,\n    challenge: string | undefined,\n    domain: string | undefined,\n    options: ForwardedOptions,\n    context: IAgentContext<IResolver>,\n  ): Promise<IVerifyResult> {\n    const fetchRemoteContexts = options.fetchRemoteContexts ?? false\n    const result = await vc.verify({\n      ...options,\n      presentation,\n      suite: this.ldSuiteLoader.getAllSignatureSuites().map((x) => x.getSuiteForVerification()),\n      documentLoader: this.getDocumentLoader(context, { ...options, fetchRemoteContexts }),\n      challenge,\n      domain,\n      compactProof: false,\n    })\n\n    if (!result.verified) {\n      // result can include raw Error\n      debug(`Error verifying LD Presentation: ${JSON.stringify(result, null, 2)}`)\n    }\n    return result\n  }\n}\n"
  },
  {
    "path": "packages/credential-ld/src/ld-default-contexts.ts",
    "content": "import contextCredentialV1 from './contexts/www.w3.org_2018_credentials_v1.json' with { type: 'json' }\nimport contextCredentialExamplesV1 from './contexts/www.w3.org_2018_credentials_examples_v1.json' with { type: 'json' }\nimport contextDidV1 from './contexts/www.w3.org_ns_did_v1.json' with { type: 'json' }\nimport contextSecurityV1 from './contexts/w3id.org_security_v1.json' with { type: 'json' }\nimport contextSecurityV2 from './contexts/w3id.org_security_v2.json' with { type: 'json' }\nimport contextSecurityV3 from './contexts/w3id.org_security_v3-unstable.json' with { type: 'json' }\nimport contextSecurityBBSV1 from './contexts/w3id.org_security_bbs_v1.json' with { type: 'json' }\nimport contextSuitesEd25519 from './contexts/w3id.org_security_suites_ed25519-2018_v1.json' with { type: 'json' }\nimport contextSuitesX25519 from './contexts/w3id.org_security_suites_x25519-2019_v1.json' with { type: 'json' }\nimport contextVeramoProfile from './contexts/veramo.io_contexts_profile_v1.json' with { type: 'json' }\nimport contextLdsEcdsaSecpRecovery2020_0 from './contexts/lds-ecdsa-secp256k1-recovery2020-0.0.json' with { type: 'json' }\nimport contextSuitesSecp256k1Recovery2020 from './contexts/w3id.org_security_suites_secp256k1recovery-2020_v2.json' with { type: 'json' }\nimport contextSuitesEd25519_2020 from './contexts/w3id.org_security_suites_ed25519-2020-v1.json' with { type: 'json' }\nimport contextSuitesX25519_2020 from './contexts/w3id.org_security_suites_x25519-2020_v1.json' with { type: 'json' }\nimport contextSuitesJws_2020 from './contexts/w3id.org_security_suites_jws-2020_v1.json' with { type: 'json' }\nimport contextSuiteEip712 from './contexts/w3id.org_security_suites_eip712sig-2021_v1.json' with { type: 'json' }\nimport schema_org from './contexts/schema.org.json' with { type: 'json' }\n\n/**\n * Provides a hardcoded map of common Linked Data `@context` definitions.\n *\n * You can use this to bootstrap the `@context` definitions used by\n * {@link @veramo/credential-ld#CredentialProviderLD | CredentialProviderLD} with these common context definitions.\n *\n * @beta This API may change without a BREAKING CHANGE notice.\n */\n// @ts-ignore\nexport const LdDefaultContexts = new Map([\n  ['https://www.w3.org/2018/credentials/v1', contextCredentialV1],\n  ['https://www.w3.org/2018/credentials/examples/v1', contextCredentialExamplesV1],\n  ['https://www.w3.org/ns/did/v1', contextDidV1],\n  ['https://w3id.org/did/v1', contextDidV1], //legacy\n  ['https://w3id.org/security/v1', contextSecurityV1],\n  ['https://w3id.org/security/v2', contextSecurityV2],\n  ['https://w3id.org/security/v3-unstable', contextSecurityV3],\n  ['https://w3id.org/security/bbs/v1', contextSecurityBBSV1],\n  ['https://w3id.org/security/suites/ed25519-2018/v1', contextSuitesEd25519],\n  ['https://w3id.org/security/suites/x25519-2019/v1', contextSuitesX25519],\n  ['https://w3id.org/security/suites/ed25519-2020/v1', contextSuitesEd25519_2020],\n  ['https://w3id.org/security/suites/x25519-2020/v1', contextSuitesX25519_2020],\n  ['https://w3id.org/security/suites/jws-2020/v1', contextSuitesJws_2020],\n  ['https://veramo.io/contexts/profile/v1', contextVeramoProfile],\n  [\n    'https://identity.foundation/EcdsaSecp256k1RecoverySignature2020/lds-ecdsa-secp256k1-recovery2020-0.0.jsonld', //legacy\n    contextLdsEcdsaSecpRecovery2020_0,\n  ],\n  [\n    'https://identity.foundation/EcdsaSecp256k1RecoverySignature2020/lds-ecdsa-secp256k1-recovery2020-2.0.jsonld',\n    contextSuitesSecp256k1Recovery2020,\n  ],\n  ['https://w3id.org/security/suites/secp256k1recovery-2020/v2', contextSuitesSecp256k1Recovery2020],\n  ['https://w3id.org/security/suites/eip712sig-2021', contextSuiteEip712],\n  ['https://w3c-ccg.github.io/ethereum-eip712-signature-2021-spec/', contextSuiteEip712],\n  ['https://w3id.org/security/suites/eip712sig-2021/v1', contextSuiteEip712],\n  ['https://schema.org', schema_org],\n])\n"
  },
  {
    "path": "packages/credential-ld/src/ld-suite-loader.ts",
    "content": "import { VeramoLdSignature } from './ld-suites.js'\nimport { TKeyType } from '@veramo/core-types'\nimport { asArray } from '@veramo/utils'\n\n/**\n * Initializes a list of Veramo-wrapped LD Signature suites and exposes those to the Agent Module\n */\nexport class LdSuiteLoader {\n  constructor(options: { veramoLdSignatures: VeramoLdSignature[] }) {\n    options.veramoLdSignatures.forEach((ldSuite) => {\n      const keyType = ldSuite.getSupportedVeramoKeyType()\n      let verifierMapping = this.signatureMap[keyType] ?? {}\n      asArray(ldSuite.getSupportedVerificationType()).forEach((verificationType) => {\n        verifierMapping[verificationType] = [...(verifierMapping[verificationType] ?? []), ldSuite]\n      })\n      return (this.signatureMap[keyType] = { ...this.signatureMap[keyType], ...verifierMapping })\n    })\n  }\n\n  private signatureMap: Record<string, Record<string, VeramoLdSignature[]>> = {}\n\n  getSignatureSuiteForKeyType(type: TKeyType, verificationType: string) {\n    const suite = this.signatureMap[type]?.[verificationType]\n    if (suite) return suite\n\n    throw new Error('No Veramo LD Signature Suite for ' + type)\n  }\n\n  getAllSignatureSuites(): VeramoLdSignature[] {\n    return Object.values(this.signatureMap)\n      .map((x) => Object.values(x))\n      .flat(2)\n  }\n\n  getAllSignatureSuiteTypes() {\n    return Object.values(this.signatureMap)\n      .map((x) => Object.keys(x))\n      .flat()\n  }\n}\n"
  },
  {
    "path": "packages/credential-ld/src/ld-suites.ts",
    "content": "import {\n  CredentialPayload,\n  DIDDocComponent,\n  IAgentContext,\n  IKey,\n  IKeyManager,\n  IResolver,\n  PresentationPayload,\n  TKeyType,\n} from '@veramo/core-types'\nimport { DIDDocument } from 'did-resolver'\n\nexport type RequiredAgentMethods = IResolver & Pick<IKeyManager, 'keyManagerGet' | 'keyManagerSign'>\n\n/**\n * Base class for Veramo adapters of LinkedDataSignature suites.\n *\n * @alpha This API is experimental and is very likely to change or disappear in future releases without notice.\n */\nexport abstract class VeramoLdSignature {\n  // LinkedDataSignature Suites according to\n  // https://github.com/digitalbazaar/jsonld-signatures/blob/main/lib/suites/LinkedDataSignature.js\n  // Add type definition as soon as https://github.com/digitalbazaar/jsonld-signatures\n  // supports those.\n\n  abstract getSupportedVerificationType(): string | string[]\n\n  abstract getSupportedProofType(): string\n\n  abstract getSupportedVeramoKeyType(): TKeyType\n\n  abstract getSuiteForSigning(\n    key: IKey,\n    issuerDid: string,\n    verificationMethodId: string,\n    context: IAgentContext<RequiredAgentMethods>,\n  ): any\n\n  abstract getSuiteForVerification(): any\n\n  abstract preDidResolutionModification(didUrl: string, didDoc: DIDDocument | DIDDocComponent, context: IAgentContext<IResolver>): Promise<DIDDocument | DIDDocComponent>\n\n  abstract preSigningCredModification(credential: CredentialPayload): void\n\n  preSigningPresModification(presentation: PresentationPayload): void {\n    // TODO: Remove invalid field 'verifiers' from Presentation. Needs to be adapted for LD credentials\n    // Only remove empty array (vc.signPresentation will throw then)\n    const sanitizedPresentation = presentation as any\n    if (sanitizedPresentation?.verifier?.length == 0) {\n      delete sanitizedPresentation.verifier\n    }\n  }\n}\n"
  },
  {
    "path": "packages/credential-ld/src/module-types/jsonld/index.d.ts",
    "content": "declare module '@digitalcredentials/jsonld'\ndeclare module '@digitalcredentials/jsonld-signatures'\ndeclare module '@digitalcredentials/vc'\ndeclare module '@digitalcredentials/ed25519-signature-2020'\ndeclare module '@veramo-community/lds-ecdsa-secp256k1-recovery2020'\n\ndeclare module \"*.json\" {\n  const content: any;\n  export default content;\n}\n"
  },
  {
    "path": "packages/credential-ld/src/suites/EcdsaSecp256k1RecoverySignature2020.ts",
    "content": "import { RequiredAgentMethods, VeramoLdSignature } from '../ld-suites.js'\nimport { CredentialPayload, DIDDocument, IAgentContext, IKey, TKeyType } from '@veramo/core-types'\nimport ldsEcdsa from '@veramo-community/lds-ecdsa-secp256k1-recovery2020'\nimport { asArray, bytesToBase64, concat, encodeJoseBlob, intersect, stringToUtf8Bytes } from '@veramo/utils'\n\nconst { EcdsaSecp256k1RecoveryMethod2020, EcdsaSecp256k1RecoverySignature2020 } = ldsEcdsa\n\n/**\n * Veramo wrapper for the EcdsaSecp256k1RecoverySignature2020 suite by Transmute Industries\n *\n * @alpha This API is experimental and is very likely to change or disappear in future releases without notice.\n */\nexport class VeramoEcdsaSecp256k1RecoverySignature2020 extends VeramoLdSignature {\n  getSupportedVerificationType(): string {\n    return 'EcdsaSecp256k1RecoveryMethod2020'\n    // TODO: add support for ['EcdsaSecp256k1VerificationKey2020', 'EcdsaSecp256k1VerificationKey2019',\n    // 'JsonWebKey2020', 'Multikey']\n  }\n\n  getSupportedProofType(): string {\n    return 'EcdsaSecp256k1RecoverySignature2020'\n  }\n\n\n  getSupportedVeramoKeyType(): TKeyType {\n    return 'Secp256k1'\n  }\n\n  getSuiteForSigning(\n    key: IKey,\n    did: string,\n    verifiableMethodId: string,\n    context: IAgentContext<RequiredAgentMethods>,\n  ): any {\n    const controller = did\n    const signer = {\n      //returns a JWS detached\n      sign: async (args: { data: Uint8Array }): Promise<string> => {\n        const header = {\n          alg: 'ES256K-R',\n          b64: false,\n          crit: ['b64'],\n        }\n        const headerString = encodeJoseBlob(header)\n        const messageBuffer = concat([stringToUtf8Bytes(`${headerString}.`), args.data])\n        const messageString = bytesToBase64(messageBuffer)\n        const signature = await context.agent.keyManagerSign({\n          keyRef: key.kid,\n          algorithm: 'ES256K-R',\n          data: messageString,\n          encoding: 'base64',\n        })\n        return `${headerString}..${signature}`\n      },\n    }\n\n    const suite = new EcdsaSecp256k1RecoverySignature2020({\n      // signer,\n      key: new EcdsaSecp256k1RecoveryMethod2020({\n        publicKeyHex: key.publicKeyHex,\n        signer: () => signer,\n        type: 'EcdsaSecp256k1RecoveryMethod2020',\n        controller,\n        id: verifiableMethodId,\n      }),\n    })\n\n    suite.ensureSuiteContext = ({ document }: { document: any; addSuiteContext: boolean }) => {\n      document['@context'] = [...asArray(document['@context'] || []), this.getContext()]\n    }\n\n    return suite\n  }\n\n  getSuiteForVerification(): any {\n    return new EcdsaSecp256k1RecoverySignature2020()\n  }\n\n  preSigningCredModification(credential: CredentialPayload): void { }\n\n  async preDidResolutionModification(didUrl: string, didDoc: DIDDocument): Promise<DIDDocument> {\n    const ctx = asArray(didDoc['@context'])\n    const legacyContext =\n      'https://identity.foundation/EcdsaSecp256k1RecoverySignature2020/lds-ecdsa-secp256k1-recovery2020-0.0.jsonld'\n    const unstableContext = 'https://w3id.org/security/v3-unstable'\n\n    //  Old did:ethr resolvers would return a broken context link\n    const idx = ctx.indexOf(legacyContext)\n    if (idx !== -1) {\n      ctx[idx] = this.getContext()\n    }\n\n    // this verification suite does not support both https://w3id.org/security/suites/secp256k1recovery-2020/v2 and\n    // https://w3id.org/security/v3-unstable as DID document @context, complaining that the `blockchainAccountId` is\n    // being redefined.\n    if (intersect(ctx, [unstableContext, this.getContext()]).length == 2) {\n      ctx.splice(ctx.indexOf(unstableContext), 1)\n    }\n    didDoc['@context'] = ctx\n\n    if (didUrl.toLowerCase().startsWith('did:ethr')) {\n      //EcdsaSecp256k1RecoveryMethod2020 does not support older format blockchainAccountId\n      didDoc.verificationMethod?.forEach((x) => {\n        if (x.blockchainAccountId) {\n          if (x.blockchainAccountId.lastIndexOf('@eip155:') !== -1) {\n            const [address, chain] = x.blockchainAccountId.split('@eip155:')\n            x.blockchainAccountId = `eip155:${chain}:${address}`\n          }\n        }\n      })\n    }\n    return didDoc\n  }\n\n  getContext(): string {\n    return 'https://w3id.org/security/suites/secp256k1recovery-2020/v2'\n  }\n}\n"
  },
  {
    "path": "packages/credential-ld/src/suites/Ed25519Signature2018.ts",
    "content": "import { bytesToBase64, concat, encodeJoseBlob, hexToBytes, stringToUtf8Bytes } from '@veramo/utils'\nimport { RequiredAgentMethods, VeramoLdSignature } from '../ld-suites.js'\nimport { CredentialPayload, DIDDocument, IAgentContext, IKey, TKeyType } from '@veramo/core-types'\nimport { Ed25519Signature2018, Ed25519VerificationKey2018 } from '@transmute/ed25519-signature-2018'\n\n/**\n * Veramo wrapper for the Ed25519Signature2018 suite by Transmute Industries\n *\n * @alpha This API is experimental and is very likely to change or disappear in future releases without notice.\n */\nexport class VeramoEd25519Signature2018 extends VeramoLdSignature {\n  getSupportedVerificationType(): string[] {\n    return ['Ed25519VerificationKey2018', 'JsonWebKey2020']\n    // TODO: add support for ['Ed25519VerificationKey2020', 'Multikey']\n  }\n\n  getSupportedProofType(): string {\n    return 'Ed25519Signature2018'\n  }\n\n\n  getSupportedVeramoKeyType(): TKeyType {\n    return 'Ed25519'\n  }\n\n  getSuiteForSigning(\n    key: IKey,\n    issuerDid: string,\n    verificationMethodId: string,\n    context: IAgentContext<RequiredAgentMethods>,\n  ): any {\n    const controller = issuerDid\n\n    // DID Key ID\n    let id = verificationMethodId\n\n    const signer = {\n      // returns a JWS detached\n      sign: async (args: { data: Uint8Array }): Promise<string> => {\n        const header = {\n          alg: 'EdDSA',\n          b64: false,\n          crit: ['b64'],\n        }\n        const headerString = encodeJoseBlob(header)\n        const messageBuffer = concat([stringToUtf8Bytes(`${headerString}.`), args.data])\n        const messageString = bytesToBase64(messageBuffer)\n        const signature = await context.agent.keyManagerSign({\n          keyRef: key.kid,\n          algorithm: 'EdDSA',\n          data: messageString,\n          encoding: 'base64',\n        })\n        return `${headerString}..${signature}`\n      },\n    }\n\n    const verificationKey = new Ed25519VerificationKey2018({\n      id,\n      controller,\n      publicKey: hexToBytes(key.publicKeyHex),\n      signer: () => signer,\n      type: 'Ed25519VerificationKey2018',\n    })\n    // overwrite the signer since we're not passing the private key and transmute doesn't support that behavior\n    verificationKey.signer = () => signer as any\n\n    return new Ed25519Signature2018({\n      key: verificationKey,\n      signer: signer,\n    })\n  }\n\n  getSuiteForVerification(): any {\n    return new Ed25519Signature2018()\n  }\n\n  preSigningCredModification(credential: CredentialPayload): void {\n    // nothing to do here\n  }\n\n  async preDidResolutionModification(didUrl: string, didDoc: DIDDocument): Promise<DIDDocument> {\n    // nothing to do here\n    return didDoc\n  }\n}\n"
  },
  {
    "path": "packages/credential-ld/src/suites/Ed25519Signature2020.ts",
    "content": "import { RequiredAgentMethods, VeramoLdSignature } from '../ld-suites.js'\nimport {\n  CredentialPayload,\n  DIDDocComponent,\n  DIDDocument,\n  IAgentContext,\n  IKey,\n  IResolver,\n  TKeyType,\n} from '@veramo/core-types'\nimport { Ed25519Signature2020 } from '@digitalcredentials/ed25519-signature-2020'\nimport { Ed25519VerificationKey2020 } from '@digitalcredentials/ed25519-verification-key-2020'\nimport {\n  asArray,\n  base64ToBytes,\n  bytesToBase64,\n  bytesToMultibase,\n  extractPublicKeyHex,\n  hexToBytes,\n} from '@veramo/utils'\nimport { VerificationMethod } from 'did-resolver'\n\nimport Debug from 'debug'\n\nconst debug = Debug('veramo:credential-ld:Ed25519Signature2020')\n\n/**\n * Veramo wrapper for the Ed25519Signature2020 suite by digitalcredentials\n *\n * @alpha This API is experimental and is very likely to change or disappear in future releases without notice.\n */\nexport class VeramoEd25519Signature2020 extends VeramoLdSignature {\n  getSupportedVerificationType(): string[] {\n    return ['Ed25519VerificationKey2020', 'Ed25519VerificationKey2018']\n    // TODO: add support for ['JsonWebKey2020', 'Multikey']\n  }\n\n  getSupportedProofType(): string {\n    return 'Ed25519Signature2020'\n  }\n\n  getSupportedVeramoKeyType(): TKeyType {\n    return 'Ed25519'\n  }\n\n  getSuiteForSigning(\n    key: IKey,\n    issuerDid: string,\n    verificationMethodId: string,\n    context: IAgentContext<RequiredAgentMethods>,\n  ): Promise<any> {\n    const controller = issuerDid\n\n    // DID Key ID\n    let id = verificationMethodId\n\n    const signer = {\n      // returns signatureBytes\n      sign: async (args: { data: Uint8Array }): Promise<Uint8Array> => {\n        const messageString = bytesToBase64(args.data)\n        const signature = await context.agent.keyManagerSign({\n          keyRef: key.kid,\n          data: messageString,\n          encoding: 'base64',\n          algorithm: 'EdDSA',\n        })\n        return base64ToBytes(signature)\n      },\n    }\n\n    const verificationKey = new Ed25519VerificationKey2020({\n      id,\n      controller,\n      publicKeyMultibase: bytesToMultibase(hexToBytes(key.publicKeyHex), 'base58btc', 'ed25519-pub'),\n      // signer: () => signer,\n      // type: this.getSupportedVerificationType(),\n    })\n    // overwrite the signer since we're not passing the private key\n    verificationKey.signer = () => signer as any\n    verificationKey.type = 'Ed25519VerificationKey2020'\n    return new Ed25519Signature2020({\n      key: verificationKey,\n      signer: signer,\n    })\n  }\n\n  getSuiteForVerification(): any {\n    return new Ed25519Signature2020()\n  }\n\n  preSigningCredModification(credential: CredentialPayload): void {\n    // nothing to do here\n  }\n\n  async preDidResolutionModification(\n    didUrl: string,\n    doc: DIDDocument | Exclude<string, DIDDocComponent>,\n    context: IAgentContext<IResolver>,\n  ): Promise<DIDDocument | Exclude<string, DIDDocComponent>> {\n    let document = doc\n    // The verification method (key) must contain \"https://w3id.org/security/suites/ed25519-2020/v1\" context.\n    if ((document as DIDDocument).verificationMethod) {\n      document.verificationMethod = asArray(document.verificationMethod)?.map(\n        this.transformVerificationMethod,\n      )\n    }\n\n    // this signature suite requires the document loader to dereference the DID URL\n    if (didUrl.includes('#') && didUrl !== document.id) {\n      const contexts = (document as DIDDocument)['@context']\n      try {\n        let newDoc: any = (await context.agent.getDIDComponentById({\n          didDocument: document,\n          didUrl: didUrl,\n        })) as Exclude<string, DIDDocComponent>\n\n        // other signature suites require the full DID document, so as a workaround\n        // we'll only return the 2020 verification method, even if the 2018 would also be compatible\n        if (\n          [\n            'Ed25519VerificationKey2020',\n            // 'Ed25519VerificationKey2018',\n            // 'JsonWebKey2020'\n          ].includes(newDoc.type)\n        ) {\n          newDoc['@context'] = [...new Set([...asArray(contexts), ...asArray(document['@context'])])]\n          document = newDoc\n        }\n      } catch (e: any) {\n        debug(`document loader could not locate DID component by fragment: ${didUrl}`)\n      }\n    }\n\n    if ((document as VerificationMethod).type === 'Ed25519VerificationKey2020') {\n      document = this.transformVerificationMethod(document as VerificationMethod)\n    }\n\n    return document\n  }\n\n  private transformVerificationMethod(vm: VerificationMethod): VerificationMethod {\n    if (vm.type === 'Ed25519VerificationKey2020') {\n      ; (vm as any)['@context'] = 'https://w3id.org/security/suites/ed25519-2020/v1'\n      // publicKeyMultibase is required by this suite\n      if (!vm.publicKeyMultibase) {\n        const { publicKeyHex } = extractPublicKeyHex(vm)\n        vm.publicKeyMultibase = bytesToMultibase(hexToBytes(publicKeyHex), 'base58btc', 'ed25519-pub')\n      }\n    }\n    return vm\n  }\n}\n"
  },
  {
    "path": "packages/credential-ld/src/suites/JsonWebSignature2020.ts",
    "content": "import { CredentialPayload, DIDDocument, IAgentContext, IKey, TKeyType } from '@veramo/core-types'\nimport { RequiredAgentMethods, VeramoLdSignature } from '../ld-suites.js'\nimport { JsonWebKey, JsonWebSignature } from '@transmute/json-web-signature'\nimport {\n  asArray,\n  bytesToBase64,\n  bytesToBase64url,\n  concat,\n  encodeJoseBlob,\n  hexToBytes,\n  stringToUtf8Bytes,\n} from '@veramo/utils'\n\n/**\n * Veramo wrapper for the JsonWebSignature2020 suite by Transmute Industries\n *\n * @alpha This API is experimental and is very likely to change or disappear in future releases without notice.\n */\nexport class VeramoJsonWebSignature2020 extends VeramoLdSignature {\n  getSupportedVerificationType(): string {\n    return 'JsonWebKey2020'\n    // TODO: add support for ['Ed25519VerificationKey2018', 'Ed25519VerificationKey2020', 'Multikey'] and others\n  }\n\n  getSupportedProofType(): string {\n    return 'JsonWebSignature2020'\n  }\n\n  getSupportedVeramoKeyType(): TKeyType {\n    return 'Ed25519'\n  }\n\n  async getSuiteForSigning(\n    key: IKey,\n    issuerDid: string,\n    verificationMethodId: string,\n    context: IAgentContext<RequiredAgentMethods>,\n  ): Promise<any> {\n    const controller = issuerDid\n\n    // DID Key ID\n    let id = verificationMethodId\n\n    const signer = {\n      // returns a JWS detached\n      sign: async (args: { data: Uint8Array }): Promise<string> => {\n        const header = {\n          alg: 'EdDSA',\n          b64: false,\n          crit: ['b64'],\n        }\n        const headerString = encodeJoseBlob(header)\n        const messageBuffer = concat([stringToUtf8Bytes(`${headerString}.`), args.data])\n        const messageString = bytesToBase64(messageBuffer)\n        const signature = await context.agent.keyManagerSign({\n          keyRef: key.kid,\n          algorithm: 'EdDSA',\n          data: messageString,\n          encoding: 'base64',\n        })\n        return `${headerString}..${signature}`\n      },\n    }\n\n    const verificationKey = await JsonWebKey.from({\n      id: id,\n      type: 'JsonWebKey2020',\n      controller: controller,\n      publicKeyJwk: {\n        kty: 'OKP',\n        crv: 'Ed25519',\n        x: bytesToBase64url(hexToBytes(key.publicKeyHex)),\n      },\n    })\n\n    verificationKey.signer = () => signer\n\n    const suite = new JsonWebSignature({\n      key: verificationKey,\n    })\n\n    suite.ensureSuiteContext = ({ document }: { document: any; addSuiteContext: boolean }) => {\n      document['@context'] = [\n        ...asArray(document['@context'] || []),\n        'https://w3id.org/security/suites/jws-2020/v1',\n      ]\n    }\n\n    return suite\n  }\n\n  getSuiteForVerification(): any {\n    return new JsonWebSignature()\n  }\n\n  preSigningCredModification(credential: CredentialPayload): void {\n    // nop\n  }\n\n  async preDidResolutionModification(didUrl: string, didDoc: DIDDocument): Promise<DIDDocument> {\n    // do nothing\n    return didDoc\n  }\n}\n"
  },
  {
    "path": "packages/credential-ld/src/types.ts",
    "content": "/**\n * Describes a document with a `@context` property.\n *\n * @beta This API may change without a BREAKING CHANGE notice.\n */\nexport type ContextDoc = {\n  '@context': Record<string, any>\n}\n"
  },
  {
    "path": "packages/credential-ld/tsconfig.json",
    "content": "{\n  \"extends\": \"../tsconfig.settings.json\",\n  \"compilerOptions\": {\n    \"rootDir\": \"src\",\n    \"outDir\": \"build\",\n    \"declarationDir\": \"build\",\n    // https://github.com/transmute-industries/vc.js/issues/60\n    \"skipLibCheck\": true,\n    \"resolveJsonModule\": true\n  },\n  \"include\": [\"src/**/*.json\", \"src/**/*.ts\"],\n  \"references\": [\n    { \"path\": \"../core-types\" },\n    { \"path\": \"../credential-w3c\" },\n    { \"path\": \"../utils\" }\n  ]\n}\n"
  },
  {
    "path": "packages/credential-status/CHANGELOG.md",
    "content": "# Change Log\n\nAll notable changes to this project will be documented in this file.\nSee [Conventional Commits](https://conventionalcommits.org) for commit guidelines.\n\n# [7.0.0](https://github.com/decentralized-identity/veramo/compare/v6.0.2...v7.0.0) (2026-02-11)\n\n\n### Bug Fixes\n\n* **credential-status:** plugin class missing OpenAPI schema property ([#1427](https://github.com/decentralized-identity/veramo/issues/1427)) ([06882b9](https://github.com/decentralized-identity/veramo/commit/06882b9db64f153f1a7c550bf54b655c70697165))\n* **deps:** update devdeps and bump typeorm to 0.3.20 ([#1272](https://github.com/decentralized-identity/veramo/issues/1272)) ([7d17f37](https://github.com/decentralized-identity/veramo/commit/7d17f37ea7cc4e73a8cdae028681ae1be5c4d11c))\n\n\n\n\n\n## [6.0.2](https://github.com/decentralized-identity/veramo/compare/v6.0.1...v6.0.2) (2026-01-16)\n\n**Note:** Version bump only for package @veramo/credential-status\n\n\n\n\n\n## [6.0.1](https://github.com/decentralized-identity/veramo/compare/v6.0.0...v6.0.1) (2026-01-16)\n\n**Note:** Version bump only for package @veramo/credential-status\n\n\n\n\n\n# [6.0.0](https://github.com/decentralized-identity/veramo/compare/v5.6.0...v6.0.0) (2024-04-02)\n\n\n### Bug Fixes\n\n* **credential-w3c:** forward DID resolution options to the resolver ([#1344](https://github.com/decentralized-identity/veramo/issues/1344)) ([0c22cc6](https://github.com/decentralized-identity/veramo/commit/0c22cc6a79e974214500e4440b0ea2977012377d)), closes [#1343](https://github.com/decentralized-identity/veramo/issues/1343)\n* **did-provider-key:** align did:key resolver to spec ([#1332](https://github.com/decentralized-identity/veramo/issues/1332)) ([8e3b94c](https://github.com/decentralized-identity/veramo/commit/8e3b94cf997619d7adcb5cb8827e0f55ff88cdb5)), closes [#1330](https://github.com/decentralized-identity/veramo/issues/1330)\n\n\n### Code Refactoring\n\n* generate plugin schemas as TS instead of JSON ([#1315](https://github.com/decentralized-identity/veramo/issues/1315)) ([65c2d4b](https://github.com/decentralized-identity/veramo/commit/65c2d4bc814daa9a3a89f4f7b8e8c6973b8ce2f0)), closes [#1254](https://github.com/decentralized-identity/veramo/issues/1254)\n\n\n### Features\n\n* add Multikey support ([#1316](https://github.com/decentralized-identity/veramo/issues/1316)) ([165de35](https://github.com/decentralized-identity/veramo/commit/165de3549ccfd3d7c84514608ac3ea9e56a7b807))\n\n\n### BREAKING CHANGES\n\n* The `plugin.schema.json` files are now generated as `plugin.schema.ts`.\n\n\n\n\n\n# [5.6.0](https://github.com/decentralized-identity/veramo/compare/v5.5.3...v5.6.0) (2024-01-16)\n\n\n### Features\n\n* **remote-client:** allow dynamic headers param for AgentRestClient constructor ([#1314](https://github.com/decentralized-identity/veramo/issues/1314)) ([1b8a0a2](https://github.com/decentralized-identity/veramo/commit/1b8a0a2718dd63492ad3a312a6ebe5f6e7849935)), closes [#1313](https://github.com/decentralized-identity/veramo/issues/1313)\n\n\n\n\n\n## [5.5.3](https://github.com/decentralized-identity/veramo/compare/v5.5.2...v5.5.3) (2023-10-09)\n\n\n### Bug Fixes\n\n* use DIF URLs in packages ([#1271](https://github.com/decentralized-identity/veramo/issues/1271)) ([3dfc601](https://github.com/decentralized-identity/veramo/commit/3dfc6014cdee7902c59d8db76b4c8507b870f227))\n\n\n\n\n\n# [5.5.0](https://github.com/uport-project/veramo/compare/v5.4.1...v5.5.0) (2023-09-19)\n\n\n### Bug Fixes\n\n* **did-provider-key:** use compressed keys for creating Secp256k1 did:key ([#1217](https://github.com/uport-project/veramo/issues/1217)) ([ba8f6f5](https://github.com/uport-project/veramo/commit/ba8f6f5b9b701e57af86491504ecd209ca0c1c1d)), closes [#1213](https://github.com/uport-project/veramo/issues/1213)\n\n\n\n\n\n## [5.4.1](https://github.com/uport-project/veramo/compare/v5.4.0...v5.4.1) (2023-08-04)\n\n\n### Bug Fixes\n\n* **ci:** benign change meant to tag all packages for another patch release ([#1211](https://github.com/uport-project/veramo/issues/1211)) ([41b5c90](https://github.com/uport-project/veramo/commit/41b5c90277171b7b38c5cf49ca01db5cf75b6300))\n\n\n\n\n\n# [5.4.0](https://github.com/uport-project/veramo/compare/v5.3.0...v5.4.0) (2023-08-01)\n\n\n### Features\n\n* **did-comm:** add support for the AES based content and key encryption algorithms ([#1180](https://github.com/uport-project/veramo/issues/1180)) ([5294a81](https://github.com/uport-project/veramo/commit/5294a812ee578c0712b54f216416c3ef78c848da))\n\n\n\n\n\n# [5.3.0](https://github.com/uport-project/veramo/compare/v5.2.0...v5.3.0) (2023-07-27)\n\n**Note:** Version bump only for package @veramo/credential-status\n\n\n\n\n\n# [5.2.0](https://github.com/uport-project/veramo/compare/v5.1.4...v5.2.0) (2023-05-02)\n\n**Note:** Version bump only for package @veramo/credential-status\n\n\n\n\n\n## [5.1.2](https://github.com/uport-project/veramo/compare/v5.1.1...v5.1.2) (2023-02-25)\n\n**Note:** Version bump only for package @veramo/credential-status\n\n\n\n\n\n# [5.1.0](https://github.com/uport-project/veramo/compare/v5.0.0...v5.1.0) (2023-02-24)\n\n**Note:** Version bump only for package @veramo/credential-status\n\n\n\n\n\n# [5.0.0](https://github.com/uport-project/veramo/compare/v4.3.0...v5.0.0) (2023-02-09)\n\n\n### Build System\n\n* convert veramo modules to ESM instead of CommonJS ([#1103](https://github.com/uport-project/veramo/issues/1103)) ([b5cea3c](https://github.com/uport-project/veramo/commit/b5cea3c0d80d900a47bd1d9eea68f84b70a35e7b)), closes [#1099](https://github.com/uport-project/veramo/issues/1099)\n\n\n### Features\n\n* isolate `core-types` package from `core` ([#1116](https://github.com/uport-project/veramo/issues/1116)) ([ba7a303](https://github.com/uport-project/veramo/commit/ba7a303de91cf4cc568a3af1ddf8ca98ed022e9f))\n\n\n### BREAKING CHANGES\n\n* this is a breaking change as modules will have to be imported differently: \n* https://www.typescriptlang.org/docs/handbook/esm-node.html\n* https://nodejs.org/api/esm.html\n* https://caniuse.com/?search=modules\n\ntest(did-provider-ion): skip a couple of tests that fail with unreasonable errors\nchore: use ubuntu-latest on CI\nfix: temporarily remove puppeteer tests\nfix: use craco for test-react-app to enable babel config\ntest: fix unit and integration tests (browser tests still broken)\nfix: fix some build issues that prevented tests from working\nfix: missing deps flagged by pnpm\n\n\n\n\n\n# [4.3.0](https://github.com/uport-project/veramo/compare/v4.2.0...v4.3.0) (2023-01-27)\n\n**Note:** Version bump only for package @veramo/credential-status\n\n\n\n\n\n# [4.2.0](https://github.com/uport-project/veramo/compare/v4.1.2...v4.2.0) (2022-12-05)\n\n\n### Bug Fixes\n\n* **deps:** bump dependencies ([701b8ed](https://github.com/uport-project/veramo/commit/701b8edf981ea11c7ddb6a81d2817dbbdbb022f3))\n\n\n\n\n\n## [4.1.1](https://github.com/uport-project/veramo/compare/v4.1.0...v4.1.1) (2022-11-01)\n\n**Note:** Version bump only for package @veramo/credential-status\n\n\n\n\n\n# [4.1.0](https://github.com/uport-project/veramo/compare/v4.0.2...v4.1.0) (2022-10-31)\n\n\n### Bug Fixes\n\n* **deps:** Update dependency ethr-did-resolver to v7 ([#1038](https://github.com/uport-project/veramo/issues/1038)) ([d421c0f](https://github.com/uport-project/veramo/commit/d421c0f9f5934829df2930e58e98bcfce813ce84))\n\n\n\n\n\n## [4.0.2](https://github.com/uport-project/veramo/compare/v4.0.1...v4.0.2) (2022-10-04)\n\n**Note:** Version bump only for package @veramo/credential-status\n\n\n\n\n\n# [4.0.0](https://github.com/uport-project/veramo/compare/v3.1.5...v4.0.0) (2022-09-22)\n\n\n### Bug Fixes\n\n* **credential-status:** check credential status for all credential types ([#949](https://github.com/uport-project/veramo/issues/949)) ([877c513](https://github.com/uport-project/veramo/commit/877c513a5bc253ed30c74ace00ce988197d12a2d)), closes [#934](https://github.com/uport-project/veramo/issues/934)\n* **credential-status:** simplify credential-status scripts ([45b8c1f](https://github.com/uport-project/veramo/commit/45b8c1f1a5ce39f48fb9e093c26b8766d9cd5325))\n* **deps:** Bump `did-jwt`, `did-jwt-vc` as direct package deps ([#955](https://github.com/uport-project/veramo/issues/955)) ([e57edb3](https://github.com/uport-project/veramo/commit/e57edb34cfbaee6bba1d944497d688104f32c698))\n* **deps:** update did-libraries ([219cde2](https://github.com/uport-project/veramo/commit/219cde250e8d4f06d7978afcc38a04471342fd21))\n* **deps:** use did-jwt v6 and ethr-did-resolver v6 ([#925](https://github.com/uport-project/veramo/issues/925)) ([0c77d03](https://github.com/uport-project/veramo/commit/0c77d03ec5ec9e2091de3f74f67ab86a22cde197)), closes [#923](https://github.com/uport-project/veramo/issues/923) [#848](https://github.com/uport-project/veramo/issues/848)\n* update and fix inline documentation of all exported types ([#921](https://github.com/uport-project/veramo/issues/921)) ([63e64e0](https://github.com/uport-project/veramo/commit/63e64e0e2693808c4704dca8cc511dc0bab3f3b1))\n\n\n### Features\n\n* add support for serviceEndpoint property as defined in latest DID Spec ([#988](https://github.com/uport-project/veramo/issues/988)) ([9bed70b](https://github.com/uport-project/veramo/commit/9bed70ba658aed34a97944e0dee27bca6c81d700))\n* **credential-ld:** add support for browser environments ([#916](https://github.com/uport-project/veramo/issues/916)) ([435e4d2](https://github.com/uport-project/veramo/commit/435e4d260b1774f96b182c1a75ab2f1c993f2291))\n* **credential-status:** add credential status check plugin for Veramo ([#874](https://github.com/uport-project/veramo/issues/874)) ([cf62dfe](https://github.com/uport-project/veramo/commit/cf62dfe21ebc76bc95e98fc55bfe1113e80c138b))\n* **credential-status:** expect revoked boolean property from StatusMethods ([e00daa4](https://github.com/uport-project/veramo/commit/e00daa47865ea42d7bd8667f37c6e12fc21fd4b9))\n* **credential-status:** rename plugin interfaces and methods ([a5adaba](https://github.com/uport-project/veramo/commit/a5adaba21a97f525bf69d156df991afc234896ab)), closes [#981](https://github.com/uport-project/veramo/issues/981)\n* **credential-w3c:** align verification API between formats ([#996](https://github.com/uport-project/veramo/issues/996)) ([b987fc0](https://github.com/uport-project/veramo/commit/b987fc0903a31d3bbffb43fef872be4d6c62c2ad)), closes [#935](https://github.com/uport-project/veramo/issues/935) [#954](https://github.com/uport-project/veramo/issues/954) [#375](https://github.com/uport-project/veramo/issues/375) [#989](https://github.com/uport-project/veramo/issues/989)\n* define an interface for credential status manager ([#956](https://github.com/uport-project/veramo/issues/956)) ([6fbd22f](https://github.com/uport-project/veramo/commit/6fbd22fa6ba7bb1d4092afbded0f95c0d841bd97)), closes [#937](https://github.com/uport-project/veramo/issues/937) [#981](https://github.com/uport-project/veramo/issues/981)\n\n\n### BREAKING CHANGES\n\n* the `did-resolver` and connected libraries change the data-type for `ServiceEndpoint` to `Service` and the previous semantic has changed. Services can have multiple endpoints, not just a single string.\n"
  },
  {
    "path": "packages/credential-status/LICENSE",
    "content": "                                 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 2019 Consensys AG\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"
  },
  {
    "path": "packages/credential-status/README.md",
    "content": "# Credential Revocation Status plugin for Veramo\n\nVeramo package which enables support for [status of W3C Verifiable Credentials](https://www.w3.org/TR/vc-data-model/#status)."
  },
  {
    "path": "packages/credential-status/api-extractor.json",
    "content": "{\n  \"$schema\": \"https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json\",\n  \"apiReport\": {\n    \"enabled\": true,\n    \"reportFolder\": \"./api\",\n    \"reportTempFolder\": \"./api\"\n  },\n\n  \"docModel\": {\n    \"enabled\": true,\n    \"apiJsonFilePath\": \"./api/<unscopedPackageName>.api.json\"\n  },\n\n  \"dtsRollup\": {\n    \"enabled\": false\n  },\n  \"mainEntryPointFilePath\": \"<projectFolder>/build/index.d.ts\"\n}\n"
  },
  {
    "path": "packages/credential-status/package.json",
    "content": "{\n  \"name\": \"@veramo/credential-status\",\n  \"description\": \"Veramo plugin for resolving a credential status\",\n  \"version\": \"7.0.0\",\n  \"main\": \"build/index.js\",\n  \"exports\": \"./build/index.js\",\n  \"types\": \"build/index.d.ts\",\n  \"scripts\": {\n    \"build\": \"tsc\",\n    \"extract-api\": \"node ../cli/bin/veramo.js dev extract-api\"\n  },\n  \"dependencies\": {\n    \"@veramo/core-types\": \"workspace:^\",\n    \"@veramo/utils\": \"workspace:^\",\n    \"credential-status\": \"^3.0.0\",\n    \"did-jwt\": \"^8.0.0\",\n    \"did-resolver\": \"^4.1.0\"\n  },\n  \"devDependencies\": {\n    \"@types/debug\": \"4.1.8\",\n    \"typescript\": \"5.7.3\"\n  },\n  \"files\": [\n    \"build/**/*\",\n    \"src/**/*\",\n    \"README.md\",\n    \"LICENSE\"\n  ],\n  \"publishConfig\": {\n    \"access\": \"public\"\n  },\n  \"repository\": {\n    \"type\": \"git\",\n    \"url\": \"https://github.com/decentralized-identity/veramo.git\",\n    \"directory\": \"packages/credential-status\"\n  },\n  \"author\": \"Konstantin Tsabolov <konstantin.tsabolov@spherity.com>\",\n  \"contributors\": [\n    \"Consensys Mesh R&D <hello@veramo.io>\",\n    \"Simonas Karuzas <simonas.karuzas@mesh.xyz>\",\n    \"Mircea Nistor <mircea.nistor@mesh.xyz>\"\n  ],\n  \"keywords\": [\n    \"Veramo\",\n    \"DID\",\n    \"Verifiable Credential\",\n    \"credentialStatus\",\n    \"aggregator\",\n    \"veramo-plugin\"\n  ],\n  \"license\": \"Apache-2.0\",\n  \"type\": \"module\",\n  \"moduleDirectories\": [\n    \"node_modules\",\n    \"src\"\n  ]\n}\n"
  },
  {
    "path": "packages/credential-status/src/__tests__/credential-status.test.ts",
    "content": "import { ICredentialStatusVerifier, VerifiableCredential } from '../../../core-types/src'\nimport { createAgent } from '../../../core/src'\nimport { DIDResolverPlugin } from '../../../did-resolver/src'\nimport { CredentialStatusPlugin } from '../credential-status.js'\nimport { DIDDocument, DIDResolutionOptions, DIDResolutionResult, Resolvable } from 'did-resolver'\nimport { StatusMethod } from 'credential-status'\nimport { jest } from '@jest/globals'\n\ndescribe('@veramo/credential-status', () => {\n  const referenceDoc: DIDDocument = { id: 'did:example:1234' }\n  const referenceCredential: VerifiableCredential = {\n    '@context': [],\n    issuanceDate: new Date().toISOString(),\n    proof: {},\n    issuer: referenceDoc.id,\n    credentialSubject: {},\n    credentialStatus: {\n      type: 'ExoticStatusMethod2022',\n      id: 'some-exotic-id',\n    },\n  }\n\n  it('should check the credential status', async () => {\n    expect.assertions(3)\n    const expectedResult = { revoked: false }\n    const checkStatus = jest.fn(async () => expectedResult)\n    const agent = createAgent<ICredentialStatusVerifier>({\n      plugins: [\n        new CredentialStatusPlugin({\n          ExoticStatusMethod2022: checkStatus,\n        }),\n      ],\n    })\n\n    const result = await agent.checkCredentialStatus({\n      credential: referenceCredential,\n      didDocumentOverride: referenceDoc,\n    })\n\n    expect(result).toStrictEqual(expectedResult)\n    expect(checkStatus).toHaveBeenCalledTimes(1)\n    expect(checkStatus).toHaveBeenCalledWith(referenceCredential, referenceDoc)\n  })\n\n  it('should check the credential status using DID resolver to get the issuer doc', async () => {\n    expect.assertions(4)\n    const expectedResult = { revoked: false }\n    const checkStatus = jest.fn(async () => expectedResult)\n    const fakeResolver: Resolvable = {\n      resolve: jest.fn(\n        async (didUrl: string, options?: DIDResolutionOptions): Promise<DIDResolutionResult> => {\n          return {\n            didDocument: { id: didUrl },\n            didResolutionMetadata: {},\n            didDocumentMetadata: {},\n          }\n        },\n      ),\n    }\n    const agent = createAgent({\n      plugins: [\n        new CredentialStatusPlugin({\n          ExoticStatusMethod2022: checkStatus,\n        }),\n        new DIDResolverPlugin({ resolver: fakeResolver }),\n      ],\n    })\n\n    const result = await agent.checkCredentialStatus({\n      credential: referenceCredential,\n    })\n\n    expect(result).toStrictEqual(expectedResult)\n    expect(checkStatus).toHaveBeenCalledTimes(1)\n    expect(checkStatus).toHaveBeenCalledWith(referenceCredential, referenceDoc)\n    expect(fakeResolver.resolve).toHaveBeenCalledTimes(1)\n  })\n\n  it('should not perform status check if no `credentialStatus` present', async () => {\n    expect.assertions(2)\n    const checkStatus = jest.fn()\n    const agent = createAgent({\n      plugins: [\n        new CredentialStatusPlugin({\n          // @ts-ignore\n          ExoticStatusMethod2022: checkStatus,\n        }),\n      ],\n    })\n\n    const result = await agent.checkCredentialStatus({\n      credential: {},\n      didDocumentOverride: referenceDoc,\n    })\n\n    expect(result).toEqual({\n      message: 'credentialStatus property was not set on the original credential',\n      revoked: false,\n    })\n    expect(checkStatus).toHaveBeenCalledTimes(0)\n  })\n\n  it('should throw if unknown status check was provided', async () => {\n    expect.assertions(1)\n    const agent = createAgent({\n      plugins: [\n        new CredentialStatusPlugin({\n          NotCalled: jest.fn() as StatusMethod,\n        }),\n      ],\n    })\n\n    await expect(\n      agent.checkCredentialStatus({\n        credential: referenceCredential,\n        didDocumentOverride: referenceDoc,\n      }),\n    ).rejects.toThrow(\n      `unknown_method: credentialStatus method ExoticStatusMethod2022 unknown. Validity can not be determined.`,\n    )\n  })\n})\n"
  },
  {
    "path": "packages/credential-status/src/credential-status.ts",
    "content": "import {\n  CredentialStatus,\n  IAgentContext,\n  IAgentPlugin,\n  ICheckCredentialStatusArgs,\n  ICredentialStatusVerifier,\n  IResolver,\n  schema,\n} from '@veramo/core-types'\nimport { extractIssuer, isDefined, resolveDidOrThrow } from '@veramo/utils'\nimport { Status, StatusMethod } from 'credential-status'\n\n/**\n * This plugin implements the {@link @veramo/core-types#ICredentialStatusVerifier | ICredentialStatusVerifier}\n * interface.\n *\n * This aggregates some {@link credential-status#StatusMethod | credential status implementations} to provide a second\n * layer of validation when verifying Verifiable Credentials.\n *\n * This is used for the discovery of information about the current status of a verifiable credential, such as whether\n * it is suspended or revoked. The precise contents of the credential status information is determined by the specific\n * `credentialStatus` type definition.\n *\n * The results provided by this plugin depend on whether the {@link credential-status#StatusMethod | StatusMethod}\n * required by the credential is installed.\n *\n * @see {@link credential-status#Status}\n *\n * @beta This API may change without a BREAKING CHANGE notice.\n */\nexport class CredentialStatusPlugin implements IAgentPlugin {\n  private readonly status: Status\n  readonly schema = schema.ICredentialStatusVerifier\n  readonly methods: ICredentialStatusVerifier\n\n  constructor(registry: Record<string, StatusMethod> = {}) {\n    this.status = new Status(registry)\n    this.methods = {\n      checkCredentialStatus: this.checkCredentialStatus.bind(this),\n    }\n  }\n\n  private async checkCredentialStatus(args: ICheckCredentialStatusArgs, context: IAgentContext<IResolver>) {\n    let didDoc = args.didDocumentOverride\n    if (!didDoc) {\n      const issuerDid = extractIssuer(args.credential)\n      didDoc = await resolveDidOrThrow(issuerDid, context, args.resolutionOptions)\n    }\n    const statusCheck: CredentialStatus = (await this.status.checkStatus(\n      args.credential,\n      didDoc,\n    )) as CredentialStatus\n    if (!isDefined(statusCheck.revoked)) {\n      throw new Error(\n        `invalid_result: 'revoked' property missing. The Credential Status verification resulted in an ambiguous result: ${JSON.stringify(\n          statusCheck,\n        )}`,\n      )\n    }\n    return statusCheck\n  }\n}\n"
  },
  {
    "path": "packages/credential-status/src/index.ts",
    "content": "/* istanbul ignore file */\nexport { CredentialStatusPlugin } from './credential-status.js'\n"
  },
  {
    "path": "packages/credential-status/tsconfig.json",
    "content": "{\n  \"extends\": \"../tsconfig.settings.json\",\n  \"compilerOptions\": {\n    \"rootDir\": \"src\",\n    \"outDir\": \"build\",\n    \"declarationDir\": \"build\",\n    \"skipLibCheck\": true\n  },\n  \"references\": [\n    { \"path\": \"../core-types\" },\n    { \"path\": \"../utils\" }\n  ]\n}\n"
  },
  {
    "path": "packages/credential-w3c/CHANGELOG.md",
    "content": "# Change Log\n\nAll notable changes to this project will be documented in this file.\nSee [Conventional Commits](https://conventionalcommits.org) for commit guidelines.\n\n# [7.0.0](https://github.com/decentralized-identity/veramo/compare/v6.0.2...v7.0.0) (2026-02-11)\n\n\n### Bug Fixes\n\n* **cli:** update @veramo/cli setup and credential example for ICredentialProvider refactor ([#1489](https://github.com/decentralized-identity/veramo/issues/1489)) ([0fa0bdc](https://github.com/decentralized-identity/veramo/commit/0fa0bdcb8baab0fa8097eb5fa8a112974c998e6b)), closes [#1488](https://github.com/decentralized-identity/veramo/issues/1488) [#1395](https://github.com/decentralized-identity/veramo/issues/1395)\n* **deps:** update dependency uuid to v11 ([#1431](https://github.com/decentralized-identity/veramo/issues/1431)) ([6ad84d9](https://github.com/decentralized-identity/veramo/commit/6ad84d91f02794e741e4b770e29e1ee9a93edcfb))\n* **deps:** update devdeps and bump typeorm to 0.3.20 ([#1272](https://github.com/decentralized-identity/veramo/issues/1272)) ([7d17f37](https://github.com/decentralized-identity/veramo/commit/7d17f37ea7cc4e73a8cdae028681ae1be5c4d11c))\n\n\n### Features\n\n* **credential-w3c:** added support bbs proofformat ([#1383](https://github.com/decentralized-identity/veramo/issues/1383)) ([83cc115](https://github.com/decentralized-identity/veramo/commit/83cc1156cb37cafd8489aa24cff690dca741d3d7))\n* **credential-w3c:** refactor the ICredentialProvider API ([#1488](https://github.com/decentralized-identity/veramo/issues/1488)) ([cbd848d](https://github.com/decentralized-identity/veramo/commit/cbd848d4ce2b52497d99d335f1c93bd8b005cdb2))\n* **credential-w3c:** remove hardcoded proof formats ([#1395](https://github.com/decentralized-identity/veramo/issues/1395)) ([5b7d3fa](https://github.com/decentralized-identity/veramo/commit/5b7d3fad7d2ada4954f8020a6474df13d9fe51dc))\n\n\n### BREAKING CHANGES\n\n* **credential-w3c:** This changeset, along with the previous changes in #1395 modify the CredentialPlugin to support extensibility without modifications to the veramo repository. This plugin now acts as an orchestrator for other ICredentialProvider implementations that provide the actual support for various verifiable data formats. ICredentialProvider implementations can be implemented externally and used with this plugin.\n* **credential-w3c:** The credential plugins specializing in JSON-LD / EIP712 are no longer top level veramo plugins but are now managed by the `@veramo/credential-w3c` plugin which will be able to use multiple proof formats and multiplex accordingly. The constructor for the `CredentialPlugin` has changed to accept different implementations of proof formats.\n\n\n\n\n\n## [6.0.2](https://github.com/decentralized-identity/veramo/compare/v6.0.1...v6.0.2) (2026-01-16)\n\n**Note:** Version bump only for package @veramo/credential-w3c\n\n\n\n\n\n## [6.0.1](https://github.com/decentralized-identity/veramo/compare/v6.0.0...v6.0.1) (2026-01-16)\n\n**Note:** Version bump only for package @veramo/credential-w3c\n\n\n\n\n\n# [6.0.0](https://github.com/decentralized-identity/veramo/compare/v5.6.0...v6.0.0) (2024-04-02)\n\n\n### Bug Fixes\n\n* **cli:** remove interactive prompting on CLI execute command ([#1347](https://github.com/decentralized-identity/veramo/issues/1347)) ([5accc6b](https://github.com/decentralized-identity/veramo/commit/5accc6b60f8a69155842eaeb5aed80fb65d154a1)), closes [#1281](https://github.com/decentralized-identity/veramo/issues/1281)\n* **credential-w3c:** forward DID resolution options to the resolver ([#1344](https://github.com/decentralized-identity/veramo/issues/1344)) ([0c22cc6](https://github.com/decentralized-identity/veramo/commit/0c22cc6a79e974214500e4440b0ea2977012377d)), closes [#1343](https://github.com/decentralized-identity/veramo/issues/1343)\n* export const plugin schemas instead of defaults ([#1327](https://github.com/decentralized-identity/veramo/issues/1327)) ([7896cea](https://github.com/decentralized-identity/veramo/commit/7896ceaf2c79993eee44e46950814bea74bfe647)), closes [#1318](https://github.com/decentralized-identity/veramo/issues/1318) [#1317](https://github.com/decentralized-identity/veramo/issues/1317) [#1315](https://github.com/decentralized-identity/veramo/issues/1315)\n\n\n### Code Refactoring\n\n* generate plugin schemas as TS instead of JSON ([#1315](https://github.com/decentralized-identity/veramo/issues/1315)) ([65c2d4b](https://github.com/decentralized-identity/veramo/commit/65c2d4bc814daa9a3a89f4f7b8e8c6973b8ce2f0)), closes [#1254](https://github.com/decentralized-identity/veramo/issues/1254)\n\n\n### Features\n\n* add Multikey support ([#1316](https://github.com/decentralized-identity/veramo/issues/1316)) ([165de35](https://github.com/decentralized-identity/veramo/commit/165de3549ccfd3d7c84514608ac3ea9e56a7b807))\n\n\n### BREAKING CHANGES\n\n* The `plugin.schema.json` files are now generated as `plugin.schema.ts`.\n\n\n\n\n\n# [5.6.0](https://github.com/decentralized-identity/veramo/compare/v5.5.3...v5.6.0) (2024-01-16)\n\n\n### Features\n\n* **remote-client:** allow dynamic headers param for AgentRestClient constructor ([#1314](https://github.com/decentralized-identity/veramo/issues/1314)) ([1b8a0a2](https://github.com/decentralized-identity/veramo/commit/1b8a0a2718dd63492ad3a312a6ebe5f6e7849935)), closes [#1313](https://github.com/decentralized-identity/veramo/issues/1313)\n\n\n\n\n\n## [5.5.3](https://github.com/decentralized-identity/veramo/compare/v5.5.2...v5.5.3) (2023-10-09)\n\n\n### Bug Fixes\n\n* use DIF URLs in packages ([#1271](https://github.com/decentralized-identity/veramo/issues/1271)) ([3dfc601](https://github.com/decentralized-identity/veramo/commit/3dfc6014cdee7902c59d8db76b4c8507b870f227))\n\n\n\n\n\n# [5.5.0](https://github.com/uport-project/veramo/compare/v5.4.1...v5.5.0) (2023-09-19)\n\n\n### Bug Fixes\n\n* **did-provider-key:** use compressed keys for creating Secp256k1 did:key ([#1217](https://github.com/uport-project/veramo/issues/1217)) ([ba8f6f5](https://github.com/uport-project/veramo/commit/ba8f6f5b9b701e57af86491504ecd209ca0c1c1d)), closes [#1213](https://github.com/uport-project/veramo/issues/1213)\n\n\n\n\n\n## [5.4.1](https://github.com/uport-project/veramo/compare/v5.4.0...v5.4.1) (2023-08-04)\n\n\n### Bug Fixes\n\n* **ci:** benign change meant to tag all packages for another patch release ([#1211](https://github.com/uport-project/veramo/issues/1211)) ([41b5c90](https://github.com/uport-project/veramo/commit/41b5c90277171b7b38c5cf49ca01db5cf75b6300))\n\n\n\n\n\n# [5.4.0](https://github.com/uport-project/veramo/compare/v5.3.0...v5.4.0) (2023-08-01)\n\n\n### Features\n\n* **credential-w3c:** allow issuers with query parameters for credentials and presentations ([#1207](https://github.com/uport-project/veramo/issues/1207)) ([688f59d](https://github.com/uport-project/veramo/commit/688f59d6b492bc25bc51bbe73be969d6c30a958d)), closes [#1201](https://github.com/uport-project/veramo/issues/1201)\n* **did-comm:** add support for the AES based content and key encryption algorithms ([#1180](https://github.com/uport-project/veramo/issues/1180)) ([5294a81](https://github.com/uport-project/veramo/commit/5294a812ee578c0712b54f216416c3ef78c848da))\n\n\n\n\n\n# [5.3.0](https://github.com/uport-project/veramo/compare/v5.2.0...v5.3.0) (2023-07-27)\n\n\n### Features\n\n* allow secp256r1 key type for JWT VC issuance ([#1192](https://github.com/uport-project/veramo/issues/1192)) ([2ce7056](https://github.com/uport-project/veramo/commit/2ce705680173174e7399c4d0607b67b7303c6c97))\n* **credential-w3c:** support specifying a key when creating credential or presentation ([#1202](https://github.com/uport-project/veramo/issues/1202)) ([70d49f4](https://github.com/uport-project/veramo/commit/70d49f48a71a4db674f793d14711527d539fb975))\n\n\n\n\n\n# [5.2.0](https://github.com/uport-project/veramo/compare/v5.1.4...v5.2.0) (2023-05-02)\n\n\n### Bug Fixes\n\n* **credential-ld:** fix Ed25519Signature2020 verification ([#1166](https://github.com/uport-project/veramo/issues/1166)) ([c965fd5](https://github.com/uport-project/veramo/commit/c965fd502f652c9929ae4753c56ebbe351447733))\n* **deps:** update dependency canonicalize to v2 ([8368462](https://github.com/uport-project/veramo/commit/8368462c415e316318855f9f762b040dbb251296))\n\n\n\n\n\n## [5.1.4](https://github.com/uport-project/veramo/compare/v5.1.3...v5.1.4) (2023-03-16)\n\n\n### Bug Fixes\n\n* **cli:** fix `credential verify` command for JWT credentials ([#1148](https://github.com/uport-project/veramo/issues/1148)) ([697a14c](https://github.com/uport-project/veramo/commit/697a14c5f0377afb8f836cde9ff3956121247780))\n\n\n\n\n\n## [5.1.2](https://github.com/uport-project/veramo/compare/v5.1.1...v5.1.2) (2023-02-25)\n\n\n### Bug Fixes\n\n* **ci:** minor changes to trigger release alignment ([9db312f](https://github.com/uport-project/veramo/commit/9db312f8f049ec13ef394dc77fe6e2759143790d))\n\n\n\n\n\n# [5.1.0](https://github.com/uport-project/veramo/compare/v5.0.0...v5.1.0) (2023-02-24)\n\n**Note:** Version bump only for package @veramo/credential-w3c\n\n\n\n\n\n# [5.0.0](https://github.com/uport-project/veramo/compare/v4.3.0...v5.0.0) (2023-02-09)\n\n\n### Build System\n\n* convert veramo modules to ESM instead of CommonJS ([#1103](https://github.com/uport-project/veramo/issues/1103)) ([b5cea3c](https://github.com/uport-project/veramo/commit/b5cea3c0d80d900a47bd1d9eea68f84b70a35e7b)), closes [#1099](https://github.com/uport-project/veramo/issues/1099)\n\n\n### Features\n\n* isolate `core-types` package from `core` ([#1116](https://github.com/uport-project/veramo/issues/1116)) ([ba7a303](https://github.com/uport-project/veramo/commit/ba7a303de91cf4cc568a3af1ddf8ca98ed022e9f))\n\n\n### BREAKING CHANGES\n\n* this is a breaking change as modules will have to be imported differently: \n* https://www.typescriptlang.org/docs/handbook/esm-node.html\n* https://nodejs.org/api/esm.html\n* https://caniuse.com/?search=modules\n\ntest(did-provider-ion): skip a couple of tests that fail with unreasonable errors\nchore: use ubuntu-latest on CI\nfix: temporarily remove puppeteer tests\nfix: use craco for test-react-app to enable babel config\ntest: fix unit and integration tests (browser tests still broken)\nfix: fix some build issues that prevented tests from working\nfix: missing deps flagged by pnpm\n\n\n\n\n\n# [4.3.0](https://github.com/uport-project/veramo/compare/v4.2.0...v4.3.0) (2023-01-27)\n\n**Note:** Version bump only for package @veramo/credential-w3c\n\n\n\n\n\n# [4.2.0](https://github.com/uport-project/veramo/compare/v4.1.2...v4.2.0) (2022-12-05)\n\n\n### Bug Fixes\n\n* **credential-w3c:** correct verification of credentials given as objects with jwt proofs ([#1071](https://github.com/uport-project/veramo/issues/1071)) ([b0d75e9](https://github.com/uport-project/veramo/commit/b0d75e9af7f28384ce2e5ef744dfbc3c302cd1a8))\n* **deps:** bump dependencies ([701b8ed](https://github.com/uport-project/veramo/commit/701b8edf981ea11c7ddb6a81d2817dbbdbb022f3))\n\n\n\n\n\n## [4.1.1](https://github.com/uport-project/veramo/compare/v4.1.0...v4.1.1) (2022-11-01)\n\n**Note:** Version bump only for package @veramo/credential-w3c\n\n\n\n\n\n# [4.1.0](https://github.com/uport-project/veramo/compare/v4.0.2...v4.1.0) (2022-10-31)\n\n\n### Bug Fixes\n\n* **deps:** Update dependency ethr-did-resolver to v7 ([#1038](https://github.com/uport-project/veramo/issues/1038)) ([d421c0f](https://github.com/uport-project/veramo/commit/d421c0f9f5934829df2930e58e98bcfce813ce84))\n* remove deprecated testnets ([#1028](https://github.com/uport-project/veramo/issues/1028)) ([2823738](https://github.com/uport-project/veramo/commit/28237383d0cc2eb20bcf8e10562221ea2ab32f94)), closes [#1025](https://github.com/uport-project/veramo/issues/1025)\n\n\n\n\n\n## [4.0.2](https://github.com/uport-project/veramo/compare/v4.0.1...v4.0.2) (2022-10-04)\n\n\n### Bug Fixes\n\n* **data-store:** use looser typeorm version range to fix [#1013](https://github.com/uport-project/veramo/issues/1013) ([#1016](https://github.com/uport-project/veramo/issues/1016)) ([83807f3](https://github.com/uport-project/veramo/commit/83807f31f845c8a0116f0300c51735ec406d9dd4))\n* **deps:** update dependency uuid to v9 ([4ff90a5](https://github.com/uport-project/veramo/commit/4ff90a58f5993880635f2b39c73edadaf3149066))\n\n\n\n\n\n## [4.0.1](https://github.com/uport-project/veramo/compare/v4.0.0...v4.0.1) (2022-09-23)\n\n\n### Bug Fixes\n\n* **credential-w3c:** manually merge schemas for ICredentialPlugin ([#1008](https://github.com/uport-project/veramo/issues/1008)) ([cff1765](https://github.com/uport-project/veramo/commit/cff1765ea052960d2e0ca88042c4b9a9d4db7fad)), closes [#1007](https://github.com/uport-project/veramo/issues/1007)\n\n\n\n\n\n# [4.0.0](https://github.com/uport-project/veramo/compare/v3.1.5...v4.0.0) (2022-09-22)\n\n\n### Bug Fixes\n\n* **credential-ld:** fix EcdsaSecp256k1RecoverySignature2020 suite context ([#909](https://github.com/uport-project/veramo/issues/909)) ([48fbee3](https://github.com/uport-project/veramo/commit/48fbee3e62eab3df4225ae0bdb3a92f5665eb171))\n* **credential-ld:** include credential context and fix context loader Map ([ef7797d](https://github.com/uport-project/veramo/commit/ef7797d4c5f20b22e4e39a5ad60a851fa1c4f2ed))\n* **credential-status:** check credential status for all credential types ([#949](https://github.com/uport-project/veramo/issues/949)) ([877c513](https://github.com/uport-project/veramo/commit/877c513a5bc253ed30c74ace00ce988197d12a2d)), closes [#934](https://github.com/uport-project/veramo/issues/934)\n* **credential-w3c:** forward domain and challenge args to createVerifiablePresentationJwt ([#887](https://github.com/uport-project/veramo/issues/887)) ([2374c71](https://github.com/uport-project/veramo/commit/2374c71251b94bc178c669b9c0ef3cd98e74a017))\n* deprecate the `save` parameter ([#975](https://github.com/uport-project/veramo/issues/975)) ([598c0e1](https://github.com/uport-project/veramo/commit/598c0e1e3f37d1b30c865fa01b93b7657f43d795)), closes [#966](https://github.com/uport-project/veramo/issues/966)\n* **deps:** Bump `did-jwt`, `did-jwt-vc` as direct package deps ([#955](https://github.com/uport-project/veramo/issues/955)) ([e57edb3](https://github.com/uport-project/veramo/commit/e57edb34cfbaee6bba1d944497d688104f32c698))\n* **deps:** update dependency did-jwt-vc to v2.1.8 ([d4520be](https://github.com/uport-project/veramo/commit/d4520be7f8ca140a5c8eafd7effb38812d51f2b4))\n* **deps:** Update dependency did-jwt-vc to v3 ([014c1ab](https://github.com/uport-project/veramo/commit/014c1ab974647d44d7ef1de0f931625348c4c98b))\n* **deps:** update did-libraries ([219cde2](https://github.com/uport-project/veramo/commit/219cde250e8d4f06d7978afcc38a04471342fd21))\n* **deps:** use did-jwt v6 and ethr-did-resolver v6 ([#925](https://github.com/uport-project/veramo/issues/925)) ([0c77d03](https://github.com/uport-project/veramo/commit/0c77d03ec5ec9e2091de3f74f67ab86a22cde197)), closes [#923](https://github.com/uport-project/veramo/issues/923) [#848](https://github.com/uport-project/veramo/issues/848)\n* **did-resolver:** use interface `Resolvable` instead of the `Resolver` class ([9c2e59f](https://github.com/uport-project/veramo/commit/9c2e59f3f23f808511c6c0e8e440b4d53ba5cb00))\n* update and fix inline documentation of all exported types ([#921](https://github.com/uport-project/veramo/issues/921)) ([63e64e0](https://github.com/uport-project/veramo/commit/63e64e0e2693808c4704dca8cc511dc0bab3f3b1))\n\n\n### Features\n\n* add support for serviceEndpoint property as defined in latest DID Spec ([#988](https://github.com/uport-project/veramo/issues/988)) ([9bed70b](https://github.com/uport-project/veramo/commit/9bed70ba658aed34a97944e0dee27bca6c81d700))\n* **credential-ld:** add option to fetch remote contexts ([60226a1](https://github.com/uport-project/veramo/commit/60226a1a64d7f06e3869ff0087f4773376b4160e))\n* **credential-ld:** add support for browser environments ([#916](https://github.com/uport-project/veramo/issues/916)) ([435e4d2](https://github.com/uport-project/veramo/commit/435e4d260b1774f96b182c1a75ab2f1c993f2291))\n* **credential-status:** expect revoked boolean property from StatusMethods ([e00daa4](https://github.com/uport-project/veramo/commit/e00daa47865ea42d7bd8667f37c6e12fc21fd4b9))\n* **credential-w3c:** add ICredentialPlugin interface in core package ([#1001](https://github.com/uport-project/veramo/issues/1001)) ([7b6d195](https://github.com/uport-project/veramo/commit/7b6d1950364c8b741dd958d29e506b95fa5b1cec)), closes [#941](https://github.com/uport-project/veramo/issues/941)\n* **credential-w3c:** add override policies to verifyPresentation ([#990](https://github.com/uport-project/veramo/issues/990)) ([06b3147](https://github.com/uport-project/veramo/commit/06b314717cbe35f696e706b1ebf5e54438115493)), closes [#375](https://github.com/uport-project/veramo/issues/375) [#954](https://github.com/uport-project/veramo/issues/954)\n* **credential-w3c:** align verification API between formats ([#996](https://github.com/uport-project/veramo/issues/996)) ([b987fc0](https://github.com/uport-project/veramo/commit/b987fc0903a31d3bbffb43fef872be4d6c62c2ad)), closes [#935](https://github.com/uport-project/veramo/issues/935) [#954](https://github.com/uport-project/veramo/issues/954) [#375](https://github.com/uport-project/veramo/issues/375) [#989](https://github.com/uport-project/veramo/issues/989)\n* CredentialIssuerEIP712 ([#899](https://github.com/uport-project/veramo/issues/899)) ([5d62c52](https://github.com/uport-project/veramo/commit/5d62c52e28a504470f8ba2c2cbd3c38eed7f435f))\n* **date-store-json:** add JSON object storage implementation ([#819](https://github.com/uport-project/veramo/issues/819)) ([934b34a](https://github.com/uport-project/veramo/commit/934b34a18b194928f90e7797289cc6f2243789ec))\n\n\n### BREAKING CHANGES\n\n* the `did-resolver` and connected libraries change the data-type for `ServiceEndpoint` to `Service` and the previous semantic has changed. Services can have multiple endpoints, not just a single string.\n\n\n\n\n\n## [3.1.3](https://github.com/uport-project/veramo/compare/v3.1.2...v3.1.3) (2022-06-01)\n\n**Note:** Version bump only for package @veramo/credential-w3c\n\n\n\n\n\n# [3.1.0](https://github.com/uport-project/veramo/compare/v3.0.0...v3.1.0) (2021-11-12)\n\n\n### Bug Fixes\n\n* **deps:** update did-libraries ([0ea73fc](https://github.com/uport-project/veramo/commit/0ea73fc1dba02c3d4c4df5befef265f7f573b2d1))\n* **deps:** update did-libraries ([417dc5d](https://github.com/uport-project/veramo/commit/417dc5dd157ee259b6f89f4987f1ecca444fb1d4))\n\n\n\n\n\n# [3.0.0](https://github.com/uport-project/veramo/compare/v2.1.3...v3.0.0) (2021-09-20)\n\n\n### Bug Fixes\n\n* **deps:** update all non-major dependencies ([8fc5312](https://github.com/uport-project/veramo/commit/8fc53120498ce2982e8ec640e00bbb03f6f4204e))\n\n\n\n\n\n# [2.1.0](https://github.com/uport-project/veramo/compare/v2.0.1...v2.1.0) (2021-08-11)\n\n\n### Bug Fixes\n\n* **credentials-w3c:** accept Presentations without Credentials ([#616](https://github.com/uport-project/veramo/issues/616)) ([2389cd0](https://github.com/uport-project/veramo/commit/2389cd0df080e968ee320d66fabf2e8a7b51ba47))\n\n\n\n\n\n# [2.0.0](https://github.com/uport-project/veramo/compare/v1.2.2...v2.0.0) (2021-07-14)\n\n\n### Bug Fixes\n\n* **credential-w3c:** fixed handling of Ed25519 keys when creating VPs ([#534](https://github.com/uport-project/veramo/issues/534))([#516](https://github.com/uport-project/veramo/issues/516)) ([988c76c](https://github.com/uport-project/veramo/commit/988c76c46d391f3b76499ff141bdefe21e729c4a))\n* **deps:** bump did-jwt to 5.4.0 ([#528](https://github.com/uport-project/veramo/issues/528)) ([65f22cf](https://github.com/uport-project/veramo/commit/65f22cf6dcca48b5bb35331894536a2a567a1189))\n\n\n### Features\n\n* implement didcomm v2 packing/unpacking ([#575](https://github.com/uport-project/veramo/issues/575)) ([249b07e](https://github.com/uport-project/veramo/commit/249b07eca8d2de9eb5252d71683d5f1fba319d60)), closes [#559](https://github.com/uport-project/veramo/issues/559) [#558](https://github.com/uport-project/veramo/issues/558)\n* **key-manager:** add generic signing capabilities ([#529](https://github.com/uport-project/veramo/issues/529)) ([5f10a1b](https://github.com/uport-project/veramo/commit/5f10a1bcea214cb593de12fa6ec3a91b3cb712bb)), closes [#522](https://github.com/uport-project/veramo/issues/522)\n\n\n\n\n\n# [1.2.0](https://github.com/uport-project/veramo/compare/v1.1.2...v1.2.0) (2021-04-27)\n\n\n### Features\n\n* adapt to did core spec ([#430](https://github.com/uport-project/veramo/issues/430)) ([9712db0](https://github.com/uport-project/veramo/commit/9712db0eea1a3f48cf0665d66ae715ea0c23cd4a)), closes [#418](https://github.com/uport-project/veramo/issues/418) [#428](https://github.com/uport-project/veramo/issues/428) [#417](https://github.com/uport-project/veramo/issues/417) [#416](https://github.com/uport-project/veramo/issues/416) [#412](https://github.com/uport-project/veramo/issues/412) [#397](https://github.com/uport-project/veramo/issues/397) [#384](https://github.com/uport-project/veramo/issues/384) [#394](https://github.com/uport-project/veramo/issues/394)\n* add option to keep payload fields when creating JWT VC/VP ([#431](https://github.com/uport-project/veramo/issues/431)) ([43923e1](https://github.com/uport-project/veramo/commit/43923e18b8e0b68c4552489d568ab16748156970)), closes [#394](https://github.com/uport-project/veramo/issues/394)\n* **did-provider-key:** add did:key provider; fixes [#335](https://github.com/uport-project/veramo/issues/335) ([#351](https://github.com/uport-project/veramo/issues/351)) ([42cd2b0](https://github.com/uport-project/veramo/commit/42cd2b08a2fd21b5b5d7bdfa57dd00ccc7184dc7)), closes [decentralized-identity/did-jwt#78](https://github.com/decentralized-identity/did-jwt/issues/78)\n\n\n\n\n\n# [1.1.0](https://github.com/uport-project/veramo/compare/v1.0.1...v1.1.0) (2021-01-26)\n\n**Note:** Version bump only for package @veramo/credential-w3c\n\n\n\n\n\n## 1.0.1 (2020-12-18)\n\n**Note:** Version bump only for package @veramo/credential-w3c\n"
  },
  {
    "path": "packages/credential-w3c/LICENSE",
    "content": "                                 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 2019 Consensys AG\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"
  },
  {
    "path": "packages/credential-w3c/README.md",
    "content": "# Veramo W3C credentials plugin \n\nVeramo package for working with W3C Verifiable Credentials & Presentations.\n\nThis package contains a plugin and a message handler for issuing and verifying Credentials\nand Presentations that adhere to W3C standards.\n"
  },
  {
    "path": "packages/credential-w3c/api-extractor.json",
    "content": "{\n  \"$schema\": \"https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json\",\n  \"apiReport\": {\n    \"enabled\": true,\n    \"reportFolder\": \"./api\",\n    \"reportTempFolder\": \"./api\"\n  },\n\n  \"docModel\": {\n    \"enabled\": true,\n    \"apiJsonFilePath\": \"./api/<unscopedPackageName>.api.json\"\n  },\n\n  \"dtsRollup\": {\n    \"enabled\": false\n  },\n  \"mainEntryPointFilePath\": \"<projectFolder>/build/index.d.ts\"\n}\n"
  },
  {
    "path": "packages/credential-w3c/package.json",
    "content": "{\n  \"name\": \"@veramo/credential-w3c\",\n  \"description\": \"Veramo plugin for working with W3C Verifiable Credentials & Presentations.\",\n  \"version\": \"7.0.0\",\n  \"main\": \"build/index.js\",\n  \"exports\": {\n    \".\": \"./build/index.js\"\n  },\n  \"types\": \"build/index.d.ts\",\n  \"scripts\": {\n    \"build\": \"tsc\",\n    \"extract-api\": \"node ../cli/bin/veramo.js dev extract-api\"\n  },\n  \"dependencies\": {\n    \"@veramo/core-types\": \"workspace:^\",\n    \"@veramo/message-handler\": \"workspace:^\",\n    \"@veramo/utils\": \"workspace:^\",\n    \"canonicalize\": \"^2.0.0\",\n    \"debug\": \"^4.3.3\",\n    \"did-jwt\": \"^8.0.0\",\n    \"did-jwt-vc\": \"^4.0.0\",\n    \"did-resolver\": \"^4.1.0\",\n    \"uuid\": \"^11.0.0\"\n  },\n  \"devDependencies\": {\n    \"@types/debug\": \"4.1.8\",\n    \"@types/uuid\": \"9.0.2\",\n    \"typescript\": \"5.7.3\"\n  },\n  \"files\": [\n    \"build/**/*\",\n    \"src/**/*\",\n    \"README.md\",\n    \"LICENSE\"\n  ],\n  \"publishConfig\": {\n    \"access\": \"public\"\n  },\n  \"repository\": {\n    \"type\": \"git\",\n    \"url\": \"https://github.com/decentralized-identity/veramo.git\",\n    \"directory\": \"packages/credential-w3c\"\n  },\n  \"author\": \"Consensys Mesh R&D <hello@veramo.io>\",\n  \"contributors\": [\n    \"Simonas Karuzas <simonas.karuzas@mesh.xyz>\",\n    \"Mircea Nistor <mircea.nistor@mesh.xyz>\"\n  ],\n  \"keywords\": [\n    \"Veramo\",\n    \"DID\",\n    \"Verifiable Credential\",\n    \"JWT\",\n    \"W3C\",\n    \"aggregator\",\n    \"vc-jwt\",\n    \"veramo-plugin\"\n  ],\n  \"license\": \"Apache-2.0\",\n  \"type\": \"module\",\n  \"moduleDirectories\": [\n    \"node_modules\",\n    \"src\"\n  ]\n}\n"
  },
  {
    "path": "packages/credential-w3c/src/__tests__/action-handler.test.ts",
    "content": "import {\n  CredentialPayload,\n  ICredentialPlugin,\n  IDIDManager,\n  IIdentifier,\n  IKey,\n  IKeyManager,\n  IResolver,\n  PresentationPayload,\n  TAgent,\n} from '../../../core-types/src'\nimport { CredentialPlugin } from '../action-handler.js'\nimport { CredentialProviderJWT } from '../../../credential-jwt/src'\nimport { createAgent } from '../../../core/src/agent.js'\nimport { KeyManager } from '../../../key-manager/src/key-manager.js'\nimport { MemoryKeyStore, MemoryPrivateKeyStore } from '../../../key-manager/src'\nimport { KeyManagementSystem } from '../../../kms-local/src'\nimport { DIDManager, MemoryDIDStore } from '../../../did-manager/src'\nimport { getDidKeyResolver, KeyDIDProvider } from '../../../did-provider-key/src'\nimport { DIDResolverPlugin } from '../../../did-resolver/src'\nimport { Resolver } from 'did-resolver'\nimport {\n  ICredentialProvider,\n  ProofFormatQuery,\n  TentativeVerificationQuery,\n} from '../abstract-credential-provider'\nimport {\n  ICreateVerifiableCredentialArgs,\n  ICreateVerifiablePresentationArgs,\n  IssuerAgentContext,\n  IVerifyCredentialArgs,\n  IVerifyPresentationArgs,\n  IVerifyResult,\n  VerifiableCredential,\n  VerifiablePresentation,\n  VerifierAgentContext,\n} from '@veramo/core-types'\n\nlet didKeyIdentifier: IIdentifier\nlet agent: TAgent<IResolver & IKeyManager & IDIDManager & ICredentialPlugin>\n\ndescribe('@veramo/credential-w3c', () => {\n  beforeAll(async () => {\n    agent = createAgent<IResolver & IKeyManager & IDIDManager & ICredentialPlugin>({\n      plugins: [\n        new KeyManager({\n          store: new MemoryKeyStore(),\n          kms: {\n            local: new KeyManagementSystem(new MemoryPrivateKeyStore()),\n          },\n        }),\n        new DIDManager({\n          providers: {\n            'did:key': new KeyDIDProvider({ defaultKms: 'local' }),\n          },\n          store: new MemoryDIDStore(),\n          defaultProvider: 'did:key',\n        }),\n        new DIDResolverPlugin({\n          resolver: new Resolver({\n            ...getDidKeyResolver(),\n          }),\n        }),\n        new CredentialPlugin([new CredentialProviderJWT()]),\n      ],\n    })\n    didKeyIdentifier = await agent.didManagerCreate()\n  })\n\n  class DummyProofProvider implements ICredentialProvider {\n    createVerifiableCredential(\n      args: ICreateVerifiableCredentialArgs,\n      context: IssuerAgentContext,\n    ): Promise<VerifiableCredential> {\n      throw new Error('Method not implemented.')\n    }\n    createVerifiablePresentation(\n      args: ICreateVerifiablePresentationArgs,\n      context: IssuerAgentContext,\n    ): Promise<VerifiablePresentation> {\n      throw new Error('Method not implemented.')\n    }\n    verifyCredential(args: IVerifyCredentialArgs, context: VerifierAgentContext): Promise<IVerifyResult> {\n      throw new Error('Method not implemented.')\n    }\n    verifyPresentation(args: IVerifyPresentationArgs, context: VerifierAgentContext): Promise<IVerifyResult> {\n      throw new Error('Method not implemented.')\n    }\n    canVerifyDocumentType(query: TentativeVerificationQuery): boolean {\n      return false\n    }\n\n    getProofFormatsSupportedForKey(key: IKey): string[] {\n      return ['dummy', 'proofs']\n    }\n\n    canIssueProofFormat(query: ProofFormatQuery): boolean {\n      return false\n    }\n  }\n\n  it('lists usable proof formats', async () => {\n    expect.assertions(2)\n\n    const proofFormats = await agent.listUsableProofFormats(didKeyIdentifier)\n    expect(proofFormats).toEqual(['jwt'])\n\n    const newAgent = createAgent<ICredentialPlugin>({\n      plugins: [new CredentialPlugin([new DummyProofProvider()])],\n    })\n    const proofFormats2 = await newAgent.listUsableProofFormats(didKeyIdentifier)\n    expect(proofFormats2).toEqual(['dummy', 'proofs'])\n  })\n\n  it('handles createVerifiableCredential', async () => {\n    expect.assertions(1)\n\n    const issuerId = didKeyIdentifier.did\n\n    const credential: CredentialPayload = {\n      '@context': ['https://www.w3.org/2018/credentials/v1', 'https://www.w3.org/2020/demo/4342323'],\n      type: ['VerifiableCredential', 'PublicProfile'],\n      issuer: { id: issuerId },\n      issuanceDate: new Date().toISOString(),\n      id: 'vc1',\n      credentialSubject: {\n        id: 'https://example.com/user/alice',\n        name: 'Alice',\n        profilePicture: 'https://example.com/a.png',\n        address: {\n          street: 'Some str.',\n          house: 1,\n        },\n      },\n    }\n\n    const vc = await agent.createVerifiableCredential({\n      credential,\n      save: false,\n      proofFormat: 'jwt',\n    })\n    expect(vc.id).toEqual('vc1')\n  })\n\n  it('handles createVerifiablePresentation', async () => {\n    expect.assertions(1)\n\n    const issuerId = didKeyIdentifier.did\n\n    const credential = await agent.createVerifiableCredential({\n      credential: {\n        '@context': ['https://www.w3.org/2018/credentials/v1'],\n        type: ['VerifiableCredential', 'PublicProfile'],\n        issuer: { id: issuerId },\n        issuanceDate: new Date().toISOString(),\n        id: 'vc1',\n        credentialSubject: {\n          id: 'https://example.com/user/alice',\n          name: 'Alice',\n          profilePicture: 'https://example.com/a.png',\n          address: {\n            street: 'Some str.',\n            house: 1,\n          },\n        },\n      },\n      save: false,\n      proofFormat: 'jwt',\n    })\n\n    const presentation: PresentationPayload = {\n      '@context': ['https://www.w3.org/2018/credentials/v1'],\n      type: ['VerifiablePresentation'],\n      holder: didKeyIdentifier.did,\n      issuanceDate: new Date().toISOString(),\n      verifiableCredential: [credential],\n    }\n\n    const vp = await agent.createVerifiablePresentation({\n      presentation,\n      save: false,\n      proofFormat: 'jwt',\n    })\n\n    expect(vp.holder).toEqual(issuerId)\n  })\n\n  it('fails to create credential with unknown proof format', async () => {\n    expect.assertions(1)\n    await expect(() =>\n      agent.createVerifiableCredential({\n        credential: { dummy: 'data', issuer: { id: didKeyIdentifier.did } },\n        proofFormat: 'unknown',\n      }),\n    ).rejects.toThrow(/invalid_setup: No provider found for the requested proof format/)\n  })\n\n  it('fails to create presentation with unknown proof format', async () => {\n    expect.assertions(1)\n    await expect(() =>\n      agent.createVerifiablePresentation({\n        presentation: { dummy: 'data', holder: didKeyIdentifier.did },\n        proofFormat: 'unknown',\n      }),\n    ).rejects.toThrow(/invalid_setup: No provider found for the requested proof format/)\n  })\n})\n"
  },
  {
    "path": "packages/credential-w3c/src/__tests__/credentialStatus.test.ts",
    "content": "describe('dummy', () => {\n  const a = 100\n  it('should run a dummy test', () => {\n    expect(a).toEqual(100)\n  })\n})\n\n// TODO Update these after refactoring did-jwt-vc\n\n// import { W3cActionHandler, ActionTypes, ActionSignW3cVc } from '../index'\n// import { SimpleSigner, decodeJWT } from 'did-jwt'\n// import { Resolver } from 'did-resolver'\n// import { ActionSignW3cVp } from '../action-handler'\n// import { Credential } from '@veramo/core'\n\n// const privateKey = 'a285ab66393c5fdda46d6fbad9e27fafd438254ab72ad5acb681a0e9f20f5d7b'\n// const signerAddress = '0x2036c6cd85692f0fb2c26e6c6b2eced9e4478dfd'\n// const mockDid: string = `did:ethr:${signerAddress}`\n\n// const mockAgent = {\n//   didManager: {\n//     getIdentifier: async (did: string) => ({\n//       did: mockDid,\n//       keyByType: async (type: string) => ({\n//         signer: () => {\n//           return SimpleSigner(privateKey)\n//         },\n//       }),\n//     }),\n//   },\n//   didResolver: {\n//     resolve: async (did: string) => {\n//       return {\n//         '@context': 'https://www.w3.org/ns/did/v1',\n//         id: 'did:ethr:rinkeby:0x42ba71c59a22a037e54f8d5b13d7b3721daa18c3',\n//         publicKey: [\n//           {\n//             id: 'did:ethr:rinkeby:0x42ba71c59a22a037e54f8d5b13d7b3721daa18c3#owner',\n//             type: 'EcdsaSecp256k1VerificationKey2019',\n//             owner: 'did:ethr:rinkeby:0x42ba71c59a22a037e54f8d5b13d7b3721daa18c3',\n//             ethereumAddress: '0x42ba71c59a22a037e54f8d5b13d7b3721daa18c3',\n//           },\n//         ],\n//         authentication: [\n//           {\n//             type: 'Secp256k1SignatureAuthentication2018',\n//             publicKey: 'did:ethr:rinkeby:0x42ba71c59a22a037e54f8d5b13d7b3721daa18c3#owner',\n//           },\n//         ],\n//       }\n//     },\n//   },\n// }\n\n// describe('@veramo/credential-w3c', () => {\n//   // it('handles signing a presentation with credentialStatus', async () => {\n//   //   expect.assertions(1)\n\n//   //   const actionHandler = new W3cActionHandler()\n\n//   //   const data = {\n//   //     issuer: mockDid,\n//   //     audience: 'did:web:uport.me',\n//   //     '@context': ['https://www.w3.org/2018/credentials/v1'],\n//   //     type: ['VerifiablePresentation'],\n//   //     verifiableCredential: ['eyJ0eXAiOiJKV1QiLCJhbGciOiJFUzI1NkstUiJ9.eyJpYXQiOjE1ODU4MTEyNTksInN1YiI6ImRpZDp3ZWI6dXBvcnQubWUiLCJ2YyI6eyJAY29udGV4dCI6WyJodHRwczovL3d3dy53My5vcmcvMjAxOC9jcmVkZW50aWFscy92MSJdLCJ0eXBlIjpbIlZlcmlmaWFibGVDcmVkZW50aWFsIl0sImNyZWRlbnRpYWxTdWJqZWN0Ijp7Im5hbWUiOiJCb2IifX0sImlzcyI6ImRpZDpldGhyOnJpbmtlYnk6MHg0MmJhNzFjNTlhMjJhMDM3ZTU0ZjhkNWIxM2Q3YjM3MjFkYWExOGMzIn0.lSuP2V-xr0RaW-M_egBXnhv0cUuM7Vp54wz1A_f3zCXjR7-bcfk1HqvweQsX-m7mXx9J9sn2vNS6YcJhWk2oBAE'],\n//   //     credentialStatus: {\n//   //       type: 'TestStatusMethod',\n//   //       id: 'local'\n//   //     }\n//   //   }\n\n//   //   let result = await actionHandler.handleAction(\n//   //     {\n//   //       type: ActionTypes.signPresentationJwt,\n//   //       data,\n//   //     } as ActionSignW3cVp,\n//   //     mockAgent as any,\n//   //   )\n\n//   //   console.log(\"gigel\", result)\n\n//   //   expect(result.credentialStatus).toMatchObject({ type: 'TestStatusMethod', id: 'local' })\n//   // })\n\n//   it('handles sign.w3c.vc.jwt with credentialStatus', async () => {\n//     // expect.assertions(1)\n\n//     const actionHandler = new W3cActionHandler()\n\n//     const data = {\n//       issuer: mockDid,\n//       '@context': ['https://www.w3.org/2018/credentials/v1'],\n//       type: ['VerifiableCredential'],\n//       credentialSubject: {\n//         id: 'did:web:uport.me',\n//         you: 'Rock',\n//       },\n//       credentialStatus: {\n//         type: 'TestStatusMethod',\n//         id: 'local',\n//       },\n//     }\n\n//     let result: Credential = await actionHandler.handleAction(\n//       {\n//         type: ActionTypes.signCredentialJwt,\n//         data,\n//       } as ActionSignW3cVc,\n//       mockAgent as any,\n//     )\n\n//     const decoded = decodeJWT(result.raw)\n\n//     expect(decoded.payload.credentialStatus).toMatchObject({ type: 'TestStatusMethod', id: 'local' })\n//   })\n// })\n"
  },
  {
    "path": "packages/credential-w3c/src/__tests__/issue-verify-flow-w3c.test.ts",
    "content": "import {\n  CredentialPayload,\n  ICredentialPlugin,\n  IDIDManager,\n  IIdentifier,\n  IKeyManager,\n  IResolver,\n  TAgent,\n  VerifiableCredential,\n} from '../../../core-types/src'\nimport { createAgent } from '../../../core/src'\nimport { CredentialPlugin } from '..'\nimport { DIDManager, MemoryDIDStore } from '../../../did-manager/src'\nimport { KeyManager, MemoryKeyStore, MemoryPrivateKeyStore } from '../../../key-manager/src'\nimport { KeyManagementSystem } from '../../../kms-local/src'\nimport { getDidKeyResolver, KeyDIDProvider } from '../../../did-provider-key/src'\nimport { DIDResolverPlugin } from '../../../did-resolver/src'\nimport {\n  ContextDoc,\n  CredentialProviderLD,\n  LdDefaultContexts,\n  VeramoEcdsaSecp256k1RecoverySignature2020,\n  VeramoEd25519Signature2018,\n} from '../../../credential-ld/src'\nimport { Resolver } from 'did-resolver'\nimport { jest } from '@jest/globals'\nimport { CredentialProviderJWT } from '../../../credential-jwt/src'\n\njest.setTimeout(300000)\n\nconst customContext: Record<string, ContextDoc> = {\n  'custom:example.context': {\n    '@context': {\n      nothing: 'custom:example.context#blank',\n    },\n  },\n}\n\ndescribe('credential-w3c full flow', () => {\n  let didKeyIdentifier: IIdentifier\n  let agent: TAgent<IResolver & IKeyManager & IDIDManager & ICredentialPlugin>\n  let credential: CredentialPayload\n\n  beforeAll(async () => {\n    const jwt = new CredentialProviderJWT()\n    const ld = new CredentialProviderLD({\n      contextMaps: [LdDefaultContexts, customContext],\n      suites: [new VeramoEd25519Signature2018(), new VeramoEcdsaSecp256k1RecoverySignature2020()],\n    })\n    agent = createAgent<IResolver & IKeyManager & IDIDManager & ICredentialPlugin>({\n      plugins: [\n        new KeyManager({\n          store: new MemoryKeyStore(),\n          kms: {\n            local: new KeyManagementSystem(new MemoryPrivateKeyStore()),\n          },\n        }),\n        new DIDManager({\n          providers: {\n            'did:key': new KeyDIDProvider({ defaultKms: 'local' }),\n          },\n          store: new MemoryDIDStore(),\n          defaultProvider: 'did:key',\n        }),\n        new DIDResolverPlugin({\n          resolver: new Resolver({\n            ...getDidKeyResolver(),\n          }),\n        }),\n        new CredentialPlugin([jwt, ld]),\n      ],\n    })\n    didKeyIdentifier = await agent.didManagerCreate()\n    credential = {\n      issuer: didKeyIdentifier.did,\n      '@context': ['custom:example.context'],\n      credentialSubject: {\n        nothing: 'else matters',\n      },\n    }\n  })\n\n  it(`verifies a credential created with jwt proofType`, async () => {\n    const verifiableCredential1 = await agent.createVerifiableCredential({\n      credential,\n      proofFormat: 'jwt',\n    })\n    const verifyResult = await agent.verifyCredential({ credential: verifiableCredential1 })\n    expect(verifyResult.verified).toBeTruthy()\n  })\n\n  it(`verifies a credential created with lds proofType`, async () => {\n    const verifiableCredential1 = await agent.createVerifiableCredential({\n      credential,\n      proofFormat: 'lds',\n    })\n    const verifyResult = await agent.verifyCredential({ credential: verifiableCredential1 })\n    expect(verifyResult.verified).toBeTruthy()\n  })\n\n  it(`fails to verify a credential created with lds proofType with modified values`, async () => {\n    const verifiableCredential1 = await agent.createVerifiableCredential({\n      credential,\n      proofFormat: 'lds',\n    })\n    const modifiedCredential: VerifiableCredential = {\n      ...verifiableCredential1,\n      issuer: { id: 'did:fake:wrong' },\n    }\n    const verifyResult = await agent.verifyCredential({ credential: modifiedCredential })\n    expect(verifyResult.verified).toBeFalsy()\n  })\n\n  it('fails the verification of a jwt credential with false value outside of proof', async () => {\n    const verifiableCredential1 = await agent.createVerifiableCredential({\n      credential,\n      proofFormat: 'jwt',\n    })\n\n    const modifiedCredential: VerifiableCredential = {\n      ...verifiableCredential1,\n      issuer: { id: 'did:fake:wrong' },\n    }\n    const verifyResult = await agent.verifyCredential({ credential: modifiedCredential })\n\n    expect(verifyResult.verified).toBeFalsy()\n  })\n\n  // example credential found at: https://learn.mattr.global/tutorials/web-credentials/issue/issue-basic\n  it(`verifies a credential created with lds proofType via Mattr`, async () => {\n    const verifiableCredential1 = {\n      '@context': [\n        'https://www.w3.org/2018/credentials/v1',\n        {\n          '@vocab': 'https://w3id.org/security/undefinedTerm#',\n        },\n        'https://schema.org',\n      ],\n      type: ['VerifiableCredential', 'CourseCredential'],\n      issuer: {\n        id: 'did:key:z6MkndAHigYrXNpape7jgaC7jHiWwxzB3chuKUGXJg2b5RSj',\n        name: 'tenant',\n      },\n      issuanceDate: '2021-07-26T01:05:05.152Z',\n      credentialSubject: {\n        id: 'did:key:z6MkfxQU7dy8eKxyHpG267FV23agZQu9zmokd8BprepfHALi',\n        givenName: 'Chris',\n        familyName: 'Shin',\n        educationalCredentialAwarded: 'Certificate Name',\n      },\n      proof: {\n        type: 'Ed25519Signature2018',\n        created: '2021-07-26T01:05:06Z',\n        jws: 'eyJhbGciOiJFZERTQSIsImI2NCI6ZmFsc2UsImNyaXQiOlsiYjY0Il19..o6hnrrWpArG8LQz2Ex_u66_BtuPdp3Hkz18nhNdNhJ7J1k_2lmCCwsNdmo-kNFirZdSIMzqO-V3wEjMDphVEAA',\n        proofPurpose: 'assertionMethod',\n        verificationMethod:\n          'did:key:z6MkndAHigYrXNpape7jgaC7jHiWwxzB3chuKUGXJg2b5RSj#z6MkndAHigYrXNpape7jgaC7jHiWwxzB3chuKUGXJg2b5RSj',\n      },\n    }\n    const verifyResult = await agent.verifyCredential({ credential: verifiableCredential1 })\n    expect(verifyResult.verified).toBeTruthy()\n  })\n\n  it('verify a verifiablePresentation', async () => {\n    const verifiableCredential1 = await agent.createVerifiableCredential({\n      credential,\n      proofFormat: 'jwt',\n    })\n\n    const verifiablePresentation = await agent.createVerifiablePresentation({\n      presentation: {\n        verifiableCredential: [verifiableCredential1],\n        holder: didKeyIdentifier.did,\n      },\n      challenge: 'VERAMO',\n      proofFormat: 'jwt',\n    })\n\n    expect(verifiablePresentation).toBeDefined()\n\n    const response = await agent.verifyPresentation({\n      presentation: verifiablePresentation,\n      challenge: 'VERAMO',\n    })\n\n    expect(response.verified).toBe(true)\n  })\n\n  it('fails the verification of an expired credential', async () => {\n    const presentationJWT =\n      'eyJhbGciOiJFZERTQSIsInR5cCI6IkpXVCJ9.eyJleHAiOjE2NjAyOTcyMTAsInZwIjp7IkBjb250ZXh0IjpbImh0dHBzOi8vd3d3LnczLm9yZy8yMDE4L2NyZWRlbnRpYWxzL3YxIl0sInR5cGUiOlsiVmVyaWZpYWJsZVByZXNlbnRhdGlvbiJdLCJ2ZXJpZmlhYmxlQ3JlZGVudGlhbCI6WyJleUpoYkdjaU9pSkZaRVJUUVNJc0luUjVjQ0k2SWtwWFZDSjkuZXlKbGVIQWlPakUyTmpBeU9UY3lNVEFzSW5aaklqcDdJa0JqYjI1MFpYaDBJanBiSW1oMGRIQnpPaTh2ZDNkM0xuY3pMbTl5Wnk4eU1ERTRMMk55WldSbGJuUnBZV3h6TDNZeElpd2lZM1Z6ZEc5dE9tVjRZVzF3YkdVdVkyOXVkR1Y0ZENKZExDSjBlWEJsSWpwYklsWmxjbWxtYVdGaWJHVkRjbVZrWlc1MGFXRnNJbDBzSW1OeVpXUmxiblJwWVd4VGRXSnFaV04wSWpwN0ltNXZkR2hwYm1jaU9pSmxiSE5sSUcxaGRIUmxjbk1pZlgwc0ltNWlaaUk2TVRZMk1ESTVOekl4TUN3aWFYTnpJam9pWkdsa09tdGxlVHA2TmsxcmFWVTNVbk5hVnpOeWFXVmxRMjg1U25OMVVEUnpRWEZYZFdGRE0zbGhjbWwxWVZCMlVXcHRZVzVsWTFBaWZRLkZhdzBEUWNNdXpacEVkcy1LR3dOalMyM2IzbUEzZFhQWXBQcGJzNmRVSnhIOVBrZzVieGF3UDVwMlNPajdQM25IdEpCR3lwTjJ3NzRfZjc3SjF5dUJ3Il19LCJuYmYiOjE2NjAyOTcyMTAsImlzcyI6ImRpZDprZXk6ejZNa2lVN1JzWlczcmllZUNvOUpzdVA0c0FxV3VhQzN5YXJpdWFQdlFqbWFuZWNQIn0.YcYbyqVlD8YsTjVw0kCEs0P_ie6SFMakf_ncPntEjsmS9C4cKyiS50ZhNkOv0R3Roy1NrzX7h93WBU55KeJlCw'\n\n    const response = await agent.verifyPresentation({\n      presentation: presentationJWT,\n    })\n\n    expect(response.verified).toBe(false)\n    expect(response.error).toBeDefined()\n    expect(response.error?.message).toContain('JWT has expired')\n  })\n\n  it('fails the verification with nbf in the future', async () => {\n    const presentationJWT =\n      'eyJhbGciOiJFZERTQSIsInR5cCI6IkpXVCJ9.eyJ2cCI6eyJAY29udGV4dCI6WyJodHRwczovL3d3dy53My5vcmcvMjAxOC9jcmVkZW50aWFscy92MSJdLCJ0eXBlIjpbIlZlcmlmaWFibGVQcmVzZW50YXRpb24iXSwidmVyaWZpYWJsZUNyZWRlbnRpYWwiOlsiZXlKaGJHY2lPaUpGWkVSVFFTSXNJblI1Y0NJNklrcFhWQ0o5LmV5SjJZeUk2ZXlKQVkyOXVkR1Y0ZENJNld5Sm9kSFJ3Y3pvdkwzZDNkeTUzTXk1dmNtY3ZNakF4T0M5amNtVmtaVzUwYVdGc2N5OTJNU0lzSW1OMWMzUnZiVHBsZUdGdGNHeGxMbU52Ym5SbGVIUWlYU3dpZEhsd1pTSTZXeUpXWlhKcFptbGhZbXhsUTNKbFpHVnVkR2xoYkNKZExDSmpjbVZrWlc1MGFXRnNVM1ZpYW1WamRDSTZleUp1YjNSb2FXNW5Jam9pWld4elpTQnRZWFIwWlhKekluMTlMQ0p1WW1ZaU9qRXhOall3TWprNE5UZzRMQ0pwYzNNaU9pSmthV1E2YTJWNU9ubzJUV3QyYlhCeFRXbDFOM2h1U25kVE9YQkVSR0ZSYW1oQ1dUWndlbU00V1RKQ2FWRnhSWFUwZW1GRldFMVdUQ0o5LnA4Y2FTS1pTcGdISm1TRzhMekpnSWlWMzFRU3NjOEJ2anZuQ1JrOEM3X1UxLXV5cS11MHlQcDdjRWlSOUtXTnprN2RDQlBiR2pBRGRiNC0tV3V5LUNRIl19LCJuYmYiOjI2NjAyOTg1ODgsImlzcyI6ImRpZDprZXk6ejZNa3ZtcHFNaXU3eG5Kd1M5cEREYVFqaEJZNnB6YzhZMkJpUXFFdTR6YUVYTVZMIiwibm9uY2UiOiJWRVJBTU8ifQ.F-uiI2iVMcdm1VFzkXgtZqq8QGw5XnyEI36vGblBluHnklnNYNmE5eluQ23dbcduGWSe3ZJJ65C7HrPTUoXvDA'\n\n    const response = await agent.verifyPresentation({\n      presentation: presentationJWT,\n    })\n\n    expect(response.verified).toBe(false)\n    expect(response.error).toBeDefined()\n    expect(response.error?.message).toContain('JWT not valid before nbf')\n  })\n\n  /**\n   * These tests can be uncommented out when the did-jwt starts to support the policies merge request\n   */\n\n  it('passes the verification of an expired credential with policy exp false', async () => {\n    const presentationJWT =\n      'eyJhbGciOiJFZERTQSIsInR5cCI6IkpXVCJ9.eyJ2cCI6eyJAY29udGV4dCI6WyJodHRwczovL3d3dy53My5vcmcvMjAxOC9jcmVkZW50aWFscy92MSJdLCJ0eXBlIjpbIlZlcmlmaWFibGVQcmVzZW50YXRpb24iXSwidmVyaWZpYWJsZUNyZWRlbnRpYWwiOlsiZXlKaGJHY2lPaUpGWkVSVFFTSXNJblI1Y0NJNklrcFhWQ0o5LmV5SjJZeUk2ZXlKQVkyOXVkR1Y0ZENJNld5Sm9kSFJ3Y3pvdkwzZDNkeTUzTXk1dmNtY3ZNakF4T0M5amNtVmtaVzUwYVdGc2N5OTJNU0lzSW1OMWMzUnZiVHBsZUdGdGNHeGxMbU52Ym5SbGVIUWlYU3dpZEhsd1pTSTZXeUpXWlhKcFptbGhZbXhsUTNKbFpHVnVkR2xoYkNKZExDSmpjbVZrWlc1MGFXRnNVM1ZpYW1WamRDSTZleUp1YjNSb2FXNW5Jam9pWld4elpTQnRZWFIwWlhKekluMTlMQ0p1WW1ZaU9qRXhOall3TWprNE5UZzRMQ0pwYzNNaU9pSmthV1E2YTJWNU9ubzJUV3QyYlhCeFRXbDFOM2h1U25kVE9YQkVSR0ZSYW1oQ1dUWndlbU00V1RKQ2FWRnhSWFUwZW1GRldFMVdUQ0o5LnA4Y2FTS1pTcGdISm1TRzhMekpnSWlWMzFRU3NjOEJ2anZuQ1JrOEM3X1UxLXV5cS11MHlQcDdjRWlSOUtXTnprN2RDQlBiR2pBRGRiNC0tV3V5LUNRIl19LCJuYmYiOjI2NjAyOTg1ODgsImlzcyI6ImRpZDprZXk6ejZNa3ZtcHFNaXU3eG5Kd1M5cEREYVFqaEJZNnB6YzhZMkJpUXFFdTR6YUVYTVZMIiwibm9uY2UiOiJWRVJBTU8ifQ.F-uiI2iVMcdm1VFzkXgtZqq8QGw5XnyEI36vGblBluHnklnNYNmE5eluQ23dbcduGWSe3ZJJ65C7HrPTUoXvDA'\n\n    const response = await agent.verifyPresentation({\n      presentation: presentationJWT,\n      policies: {\n        expirationDate: false,\n        issuanceDate: false,\n      },\n    })\n\n    expect(response.verified).toBe(true)\n  })\n\n  it('passes the verification with nbf in the future with policy nbf false', async () => {\n    const presentationJWT =\n      'eyJhbGciOiJFZERTQSIsInR5cCI6IkpXVCJ9.eyJ2cCI6eyJAY29udGV4dCI6WyJodHRwczovL3d3dy53My5vcmcvMjAxOC9jcmVkZW50aWFscy92MSJdLCJ0eXBlIjpbIlZlcmlmaWFibGVQcmVzZW50YXRpb24iXSwidmVyaWZpYWJsZUNyZWRlbnRpYWwiOlsiZXlKaGJHY2lPaUpGWkVSVFFTSXNJblI1Y0NJNklrcFhWQ0o5LmV5SjJZeUk2ZXlKQVkyOXVkR1Y0ZENJNld5Sm9kSFJ3Y3pvdkwzZDNkeTUzTXk1dmNtY3ZNakF4T0M5amNtVmtaVzUwYVdGc2N5OTJNU0lzSW1OMWMzUnZiVHBsZUdGdGNHeGxMbU52Ym5SbGVIUWlYU3dpZEhsd1pTSTZXeUpXWlhKcFptbGhZbXhsUTNKbFpHVnVkR2xoYkNKZExDSmpjbVZrWlc1MGFXRnNVM1ZpYW1WamRDSTZleUp1YjNSb2FXNW5Jam9pWld4elpTQnRZWFIwWlhKekluMTlMQ0p1WW1ZaU9qRXhOall3TWprNE5UZzRMQ0pwYzNNaU9pSmthV1E2YTJWNU9ubzJUV3QyYlhCeFRXbDFOM2h1U25kVE9YQkVSR0ZSYW1oQ1dUWndlbU00V1RKQ2FWRnhSWFUwZW1GRldFMVdUQ0o5LnA4Y2FTS1pTcGdISm1TRzhMekpnSWlWMzFRU3NjOEJ2anZuQ1JrOEM3X1UxLXV5cS11MHlQcDdjRWlSOUtXTnprN2RDQlBiR2pBRGRiNC0tV3V5LUNRIl19LCJuYmYiOjI2NjAyOTg1ODgsImlzcyI6ImRpZDprZXk6ejZNa3ZtcHFNaXU3eG5Kd1M5cEREYVFqaEJZNnB6YzhZMkJpUXFFdTR6YUVYTVZMIiwibm9uY2UiOiJWRVJBTU8ifQ.F-uiI2iVMcdm1VFzkXgtZqq8QGw5XnyEI36vGblBluHnklnNYNmE5eluQ23dbcduGWSe3ZJJ65C7HrPTUoXvDA'\n\n    const response = await agent.verifyPresentation({\n      presentation: presentationJWT,\n      policies: {\n        issuanceDate: false,\n      },\n    })\n\n    expect(response.verified).toBe(true)\n  })\n})\n"
  },
  {
    "path": "packages/credential-w3c/src/__tests__/message-handler.test.ts",
    "content": "import { DIDResolutionResult, IAgentContext, ICredentialVerifier, IResolver } from '../../../core-types/src'\nimport { Message } from '../../../message-handler/src'\nimport { IContext, MessageTypes, W3cMessageHandler } from '../message-handler.js'\nimport { jest } from '@jest/globals'\nimport { computeEntryHash } from '../../../utils/src'\n\ndescribe('@veramo/credential-w3c', () => {\n  const handler = new W3cMessageHandler()\n  // don't need to replace rinkeby since test has mock resolver\n  const didEthr = 'did:ethr:rinkeby:0x3c357ba458933a19c1df1c7f6b473b3302bbbe61'\n  const didKey = 'did:key:z6Mkqjn1SMUbR88S7BZFAZnr7sfzPXmm3DfRdMy3Z5CdMqnd'\n\n  const context: IContext = {\n    agent: {\n      getSchema: jest.fn(),\n      execute: jest.fn(),\n      availableMethods: jest.fn(),\n      emit: jest.fn(),\n      resolveDid: async (args?): Promise<DIDResolutionResult> => {\n        if (!args?.didUrl) throw Error('DID required')\n\n        if (args?.didUrl === didEthr) {\n          return {\n            didResolutionMetadata: {},\n            didDocumentMetadata: {},\n            didDocument: {\n              '@context': 'https://www.w3.org/ns/did/v1',\n              id: args?.didUrl,\n              verificationMethod: [\n                {\n                  id: `${didEthr}#owner`,\n                  type: 'EcdsaSecp256k1RecoveryMethod2020',\n                  controller: args?.didUrl,\n                  blockchainAccountId: `eip155:5:${didEthr.slice(-42)}`,\n                },\n              ],\n              authentication: [`${didEthr}#owner`],\n            },\n          }\n        } else {\n          return {\n            didResolutionMetadata: {},\n            didDocumentMetadata: {},\n            didDocument: {\n              '@context': 'https://www.w3.org/ns/did/v1',\n              id: didKey,\n              verificationMethod: [\n                {\n                  id: '#z6Mkqjn1SMUbR88S7BZFAZnr7sfzPXmm3DfRdMy3Z5CdMqnd',\n                  type: 'Ed25519VerificationKey2018',\n                  controller: didKey,\n                  publicKeyBase58: 'CHWxr7EA5adxzgiYUzq1Gn7zZxVudLR4wM47ioEcSd1F',\n                },\n                {\n                  id: '#z6LSkpCZ3cLP76M3Q26rhZe6q98vMdcSPTt4iML4r9UT7LVt',\n                  type: 'X25519KeyAgreementKey2019',\n                  controller: didKey,\n                  publicKeyBase58: 'A92PXJXX1ddJJdj6Av89WYvSWV5KgrhuqNcPMgpvPxj8',\n                },\n              ],\n              authentication: ['#z6Mkqjn1SMUbR88S7BZFAZnr7sfzPXmm3DfRdMy3Z5CdMqnd'],\n              assertionMethod: ['#z6Mkqjn1SMUbR88S7BZFAZnr7sfzPXmm3DfRdMy3Z5CdMqnd'],\n            },\n          }\n        }\n      },\n      canVerifyDocumentType: jest.fn(),\n      verifyCredential: jest.fn(),\n      verifyPresentation: jest.fn(),\n      getDIDComponentById: jest.fn(),\n    },\n  } as IAgentContext<IResolver & ICredentialVerifier>\n\n  it('should reject unknown message type', async () => {\n    expect.assertions(1)\n    const message = new Message({ raw: 'test', metaData: [{ type: 'test' }] })\n    await expect(handler.handle(message, context)).rejects.toThrow('Unsupported message type')\n  })\n\n  const vcJwtSecp256k1 =\n    'eyJ0eXAiOiJKV1QiLCJhbGciOiJFUzI1NkstUiJ9.eyJpYXQiOjE1ODI2MTk2NzYsInN1YiI6ImRpZDpldGhyOnJpbmtlYnk6MHgzYzM1N2JhNDU4OTMzYTE5YzFkZjFjN2Y2YjQ3M2IzMzAyYmJiZTYxIiwidmMiOnsiQGNvbnRleHQiOlsiaHR0cHM6Ly93d3cudzMub3JnLzIwMTgvY3JlZGVudGlhbHMvdjEiXSwidHlwZSI6WyJWZXJpZmlhYmxlQ3JlZGVudGlhbCJdLCJjcmVkZW50aWFsU3ViamVjdCI6eyJuYW1lIjoiQWxpY2UifX0sImlzcyI6ImRpZDpldGhyOnJpbmtlYnk6MHgzYzM1N2JhNDU4OTMzYTE5YzFkZjFjN2Y2YjQ3M2IzMzAyYmJiZTYxIn0.IGF1LFOc4_PcGVeq7Yw7OGz4Gj7xXZK6p8bP9CSEIXz7mNFPM0v0nuevTZ47a0I8XgLfCFNkUrIIscjH8MFx_wE'\n\n  const vcPayloadSecp256k1 = {\n    iat: 1582619676,\n    sub: didEthr,\n    vc: {\n      '@context': ['https://www.w3.org/2018/credentials/v1'],\n      type: ['VerifiableCredential'],\n      credentialSubject: {\n        name: 'Alice',\n      },\n    },\n    iss: didEthr,\n  }\n\n  const vpJwtSecp256k1 =\n    'eyJ0eXAiOiJKV1QiLCJhbGciOiJFUzI1NkstUiJ9.eyJpYXQiOjE1ODI2MTk4NzUsImF1ZCI6ImRpZDpldGhyOnJpbmtlYnk6MHgzYzM1N2JhNDU4OTMzYTE5YzFkZjFjN2Y2YjQ3M2IzMzAyYmJiZTYxIiwidGFnIjoieHl6LTEyMyIsInZwIjp7IkBjb250ZXh0IjpbImh0dHBzOi8vd3d3LnczLm9yZy8yMDE4L2NyZWRlbnRpYWxzL3YxIl0sInR5cGUiOlsiVmVyaWZpYWJsZVByZXNlbnRhdGlvbiJdLCJ2ZXJpZmlhYmxlQ3JlZGVudGlhbCI6WyJleUowZVhBaU9pSktWMVFpTENKaGJHY2lPaUpGVXpJMU5rc3RVaUo5LmV5SnBZWFFpT2pFMU9ESTJNVGsyTnpZc0luTjFZaUk2SW1ScFpEcGxkR2h5T25KcGJtdGxZbms2TUhnell6TTFOMkpoTkRVNE9UTXpZVEU1WXpGa1pqRmpOMlkyWWpRM00ySXpNekF5WW1KaVpUWXhJaXdpZG1NaU9uc2lRR052Ym5SbGVIUWlPbHNpYUhSMGNITTZMeTkzZDNjdWR6TXViM0puTHpJd01UZ3ZZM0psWkdWdWRHbGhiSE12ZGpFaVhTd2lkSGx3WlNJNld5SldaWEpwWm1saFlteGxRM0psWkdWdWRHbGhiQ0pkTENKamNtVmtaVzUwYVdGc1UzVmlhbVZqZENJNmV5SnVZVzFsSWpvaVFXeHBZMlVpZlgwc0ltbHpjeUk2SW1ScFpEcGxkR2h5T25KcGJtdGxZbms2TUhnell6TTFOMkpoTkRVNE9UTXpZVEU1WXpGa1pqRmpOMlkyWWpRM00ySXpNekF5WW1KaVpUWXhJbjAuSUdGMUxGT2M0X1BjR1ZlcTdZdzdPR3o0R2o3eFhaSzZwOGJQOUNTRUlYejdtTkZQTTB2MG51ZXZUWjQ3YTBJOFhnTGZDRk5rVXJJSXNjakg4TUZ4X3dFIl19LCJpc3MiOiJkaWQ6ZXRocjpyaW5rZWJ5OjB4M2MzNTdiYTQ1ODkzM2ExOWMxZGYxYzdmNmI0NzNiMzMwMmJiYmU2MSJ9.7gIGq437moBKMwF3PUrycjCP4Op6dL6IJV6GygSq1KGV7QU0II16YzETsr412AlHl_kaYgUJjRav7unJdyJL0wA'\n\n  const vpPayloadSecp256k1 = {\n    iat: 1582619875,\n    aud: didEthr,\n    tag: 'xyz-123',\n    vp: {\n      '@context': ['https://www.w3.org/2018/credentials/v1'],\n      type: ['VerifiablePresentation'],\n      verifiableCredential: [\n        'eyJ0eXAiOiJKV1QiLCJhbGciOiJFUzI1NkstUiJ9.eyJpYXQiOjE1ODI2MTk2NzYsInN1YiI6ImRpZDpldGhyOnJpbmtlYnk6MHgzYzM1N2JhNDU4OTMzYTE5YzFkZjFjN2Y2YjQ3M2IzMzAyYmJiZTYxIiwidmMiOnsiQGNvbnRleHQiOlsiaHR0cHM6Ly93d3cudzMub3JnLzIwMTgvY3JlZGVudGlhbHMvdjEiXSwidHlwZSI6WyJWZXJpZmlhYmxlQ3JlZGVudGlhbCJdLCJjcmVkZW50aWFsU3ViamVjdCI6eyJuYW1lIjoiQWxpY2UifX0sImlzcyI6ImRpZDpldGhyOnJpbmtlYnk6MHgzYzM1N2JhNDU4OTMzYTE5YzFkZjFjN2Y2YjQ3M2IzMzAyYmJiZTYxIn0.IGF1LFOc4_PcGVeq7Yw7OGz4Gj7xXZK6p8bP9CSEIXz7mNFPM0v0nuevTZ47a0I8XgLfCFNkUrIIscjH8MFx_wE',\n      ],\n    },\n    iss: didEthr,\n  }\n\n  it('should return handled VC message (ES256K-R)', async () => {\n    expect.assertions(6)\n    const message = new Message({ raw: vcJwtSecp256k1, metaData: [{ type: 'test' }] })\n    // This would be done by '@veramo/did-jwt':\n    message.data = vcPayloadSecp256k1\n    message.addMetaData({ type: 'JWT', value: 'ES256K-R' })\n    const handled = await handler.handle(message, context)\n    expect(handled.isValid()).toEqual(true)\n    expect(handled.id).toEqual(computeEntryHash(vcJwtSecp256k1))\n    expect(handled.raw).toEqual(vcJwtSecp256k1)\n    expect(handled.type).toEqual(MessageTypes.vc)\n    expect(handled.from).toEqual(vcPayloadSecp256k1.iss)\n    expect(handled.to).toEqual(vcPayloadSecp256k1.sub)\n    // expect(handled.timestamp).toEqual(vcPayload.iat)\n  })\n\n  it('should return handled VP message (ES256K-R)', async () => {\n    expect.assertions(7)\n    const message = new Message({ raw: vpJwtSecp256k1, metaData: [{ type: 'test' }] })\n    // This would be done by '@veramo/did-jwt':\n    message.data = vpPayloadSecp256k1\n    message.addMetaData({ type: 'JWT', value: 'ES256K-R' })\n\n    const handled = await handler.handle(message, context)\n    expect(handled.isValid()).toEqual(true)\n    expect(handled.id).toEqual(computeEntryHash(vpJwtSecp256k1))\n    expect(handled.raw).toEqual(vpJwtSecp256k1)\n    expect(handled.type).toEqual(MessageTypes.vp)\n    expect(handled.from).toEqual(vpPayloadSecp256k1.iss)\n    expect(handled.to).toEqual(vpPayloadSecp256k1.aud)\n    expect(handled.threadId).toEqual(vpPayloadSecp256k1.tag)\n    // expect(handled.timestamp).toEqual(vpPayload.iat)\n  })\n\n  const vcJwtEd25519 =\n    'eyJhbGciOiJFZERTQSIsInR5cCI6IkpXVCJ9.eyJ2YyI6eyJjcmVkZW50aWFsU3ViamVjdCI6eyJuYW1lIjoiQWxpY2UifSwiQGNvbnRleHQiOlsiaHR0cHM6Ly93d3cudzMub3JnLzIwMTgvY3JlZGVudGlhbHMvdjEiXSwidHlwZSI6WyJWZXJpZmlhYmxlQ3JlZGVudGlhbCIsIlByb2ZpbGUiXX0sInN1YiI6ImRpZDprZXk6ejZNa3FqbjFTTVViUjg4UzdCWkZBWm5yN3NmelBYbW0zRGZSZE15M1o1Q2RNcW5kIiwibmJmIjoxNjIxOTczOTU0LCJpc3MiOiJkaWQ6a2V5Ono2TWtxam4xU01VYlI4OFM3QlpGQVpucjdzZnpQWG1tM0RmUmRNeTNaNUNkTXFuZCJ9.xFUvm49vS4dNoSURJwrCMwdePgrAyBRzs7GqvcUyD6KjfNM8eSgFeF8CEUHC21WcwrmbTNrzpQtgFQTFP_9HAA'\n\n  const vcPayloadEd25519 = {\n    vc: {\n      credentialSubject: {\n        name: 'Alice',\n      },\n      '@context': ['https://www.w3.org/2018/credentials/v1'],\n      type: ['VerifiableCredential', 'Profile'],\n    },\n    sub: didKey,\n    nbf: 1621973954,\n    iss: didKey,\n  }\n\n  const vpJwtEd25519 =\n    'eyJhbGciOiJFZERTQSIsInR5cCI6IkpXVCJ9.eyJ2cCI6eyJAY29udGV4dCI6WyJodHRwczovL3d3dy53My5vcmcvMjAxOC9jcmVkZW50aWFscy92MSJdLCJ0eXBlIjpbIlZlcmlmaWFibGVQcmVzZW50YXRpb24iLCJQcm9maWxlIl0sInZlcmlmaWFibGVDcmVkZW50aWFsIjpbImV5SmhiR2NpT2lKRlpFUlRRU0lzSW5SNWNDSTZJa3BYVkNKOS5leUoyWXlJNmV5SmpjbVZrWlc1MGFXRnNVM1ZpYW1WamRDSTZleUp1WVcxbElqb2lRV3hwWTJVaWZTd2lRR052Ym5SbGVIUWlPbHNpYUhSMGNITTZMeTkzZDNjdWR6TXViM0puTHpJd01UZ3ZZM0psWkdWdWRHbGhiSE12ZGpFaVhTd2lkSGx3WlNJNld5SldaWEpwWm1saFlteGxRM0psWkdWdWRHbGhiQ0lzSWxCeWIyWnBiR1VpWFgwc0luTjFZaUk2SW1ScFpEcHJaWGs2ZWpaTmEzRnFiakZUVFZWaVVqZzRVemRDV2taQldtNXlOM05tZWxCWWJXMHpSR1pTWkUxNU0xbzFRMlJOY1c1a0lpd2libUptSWpveE5qSXhPVGN6T1RVMExDSnBjM01pT2lKa2FXUTZhMlY1T25vMlRXdHhhbTR4VTAxVllsSTRPRk0zUWxwR1FWcHVjamR6Wm5wUVdHMXRNMFJtVW1STmVUTmFOVU5rVFhGdVpDSjkueEZVdm00OXZTNGROb1NVUkp3ckNNd2RlUGdyQXlCUnpzN0dxdmNVeUQ2S2pmTk04ZVNnRmVGOENFVUhDMjFXY3dybWJUTnJ6cFF0Z0ZRVEZQXzlIQUEiXX0sInRhZyI6Inh5ejEyMyIsIm5iZiI6MTYyMTk3NDM4MiwiaXNzIjoiZGlkOmtleTp6Nk1rcWpuMVNNVWJSODhTN0JaRkFabnI3c2Z6UFhtbTNEZlJkTXkzWjVDZE1xbmQiLCJhdWQiOlsiZGlkOmtleTp6Nk1rcWpuMVNNVWJSODhTN0JaRkFabnI3c2Z6UFhtbTNEZlJkTXkzWjVDZE1xbmQiXX0.Lju6nUthZXnCi3RyX-6IRowzWQMp5FpcHLHqL9J9AvVWlNa40eWTdhhXPkshLoxjY9sorIO39G_1fc09MWWlAQ'\n\n  const vpPayloadEd25519 = {\n    vp: {\n      '@context': ['https://www.w3.org/2018/credentials/v1'],\n      type: ['VerifiablePresentation', 'Profile'],\n      verifiableCredential: [\n        'eyJhbGciOiJFZERTQSIsInR5cCI6IkpXVCJ9.eyJ2YyI6eyJjcmVkZW50aWFsU3ViamVjdCI6eyJuYW1lIjoiQWxpY2UifSwiQGNvbnRleHQiOlsiaHR0cHM6Ly93d3cudzMub3JnLzIwMTgvY3JlZGVudGlhbHMvdjEiXSwidHlwZSI6WyJWZXJpZmlhYmxlQ3JlZGVudGlhbCIsIlByb2ZpbGUiXX0sInN1YiI6ImRpZDprZXk6ejZNa3FqbjFTTVViUjg4UzdCWkZBWm5yN3NmelBYbW0zRGZSZE15M1o1Q2RNcW5kIiwibmJmIjoxNjIxOTczOTU0LCJpc3MiOiJkaWQ6a2V5Ono2TWtxam4xU01VYlI4OFM3QlpGQVpucjdzZnpQWG1tM0RmUmRNeTNaNUNkTXFuZCJ9.xFUvm49vS4dNoSURJwrCMwdePgrAyBRzs7GqvcUyD6KjfNM8eSgFeF8CEUHC21WcwrmbTNrzpQtgFQTFP_9HAA',\n      ],\n    },\n    tag: 'xyz123',\n    nbf: 1621974382,\n    iss: didKey,\n    aud: didKey,\n  }\n\n  it('should return handled VC message (Ed25519)', async () => {\n    expect.assertions(6)\n    const message = new Message({ raw: vcJwtEd25519, metaData: [{ type: 'test' }] })\n    // This would be done by '@veramo/did-jwt':\n    message.data = vcPayloadEd25519\n    message.addMetaData({ type: 'JWT', value: 'Ed25519' })\n    const handled = await handler.handle(message, context)\n    expect(handled.isValid()).toEqual(true)\n    expect(handled.id).toEqual(computeEntryHash(vcJwtEd25519))\n    expect(handled.raw).toEqual(vcJwtEd25519)\n    expect(handled.type).toEqual(MessageTypes.vc)\n    expect(handled.from).toEqual(vcPayloadEd25519.iss)\n    expect(handled.to).toEqual(vcPayloadEd25519.sub)\n  })\n\n  it('should return handled VP message (Ed25519)', async () => {\n    expect.assertions(7)\n    const message = new Message({ raw: vpJwtEd25519, metaData: [{ type: 'test' }] })\n    // This would be done by '@veramo/did-jwt':\n    message.data = vpPayloadEd25519\n    message.addMetaData({ type: 'JWT', value: 'Ed25519' })\n\n    const handled = await handler.handle(message, context)\n    expect(handled.isValid()).toEqual(true)\n    expect(handled.id).toEqual(computeEntryHash(vpJwtEd25519))\n    expect(handled.raw).toEqual(vpJwtEd25519)\n    expect(handled.type).toEqual(MessageTypes.vp)\n    expect(handled.from).toEqual(vpPayloadEd25519.iss)\n    expect(handled.to).toEqual(vpPayloadEd25519.aud)\n    expect(handled.threadId).toEqual(vpPayloadEd25519.tag)\n  })\n\n  const vpMultiAudJwt =\n    'eyJhbGciOiJFUzI1NksiLCJ0eXAiOiJKV1QifQ.eyJ2cCI6eyJAY29udGV4dCI6WyJodHRwczovL3d3dy53My5vcmcvMjAxOC9jcmVkZW50aWFscy92MSJdLCJ0eXBlIjpbIlZlcmlmaWFibGVQcmVzZW50YXRpb24iXSwidmVyaWZpYWJsZUNyZWRlbnRpYWwiOlsiZXlKaGJHY2lPaUpGVXpJMU5rc2lMQ0owZVhBaU9pSktWMVFpZlEuZXlKMll5STZleUpBWTI5dWRHVjRkQ0k2V3lKb2RIUndjem92TDNkM2R5NTNNeTV2Y21jdk1qQXhPQzlqY21Wa1pXNTBhV0ZzY3k5Mk1TSXNJbWgwZEhCek9pOHZkbVZ5WVcxdkxtbHZMMk52Ym5SbGVIUnpMM0J5YjJacGJHVXZkakVpWFN3aWRIbHdaU0k2V3lKV1pYSnBabWxoWW14bFEzSmxaR1Z1ZEdsaGJDSmRMQ0pqY21Wa1pXNTBhV0ZzVTNWaWFtVmpkQ0k2ZXlKdVlXMWxJam9pUVd4cFkyVWlmWDBzSW5OMVlpSTZJbVJwWkRwbGRHaHlPbWR2WlhKc2FUb3dlREF5WkdJMllqZ3pZVE00WlRNeFpHVmtabU5rTURBeE4yRTBPRE5qT0dJd01EY3pZV1EwTURRNU5UZG1OV1l6TXpjNFpEVmtPR1l6WkRneU5USXhNRFE0T1NJc0ltNWlaaUk2TVRZMk5UUTFNalUwT0N3aWFYTnpJam9pWkdsa09tVjBhSEk2WjI5bGNteHBPakI0TURKa1lqWmlPRE5oTXpobE16RmtaV1JtWTJRd01ERTNZVFE0TTJNNFlqQXdOek5oWkRRd05EazFOMlkxWmpNek56aGtOV1E0WmpOa09ESTFNakV3TkRnNUluMC56ZXRBSXVTVWtxNGlmbmxhelg3c1RodTlpd3VzNjZDVHBfaDVObW0xc2RyZXZ4ck02WklSZGJEVExrZlZ6MmxGR3BxeU1aLW9tMVBtUHNOOFluY2ZSZyJdfSwidGFnIjoidGFnMTIzIiwibmJmIjoxNjY1NDUzMDYwLCJpc3MiOiJkaWQ6ZXRocjpnb2VybGk6MHgwMmRiNmI4M2EzOGUzMWRlZGZjZDAwMTdhNDgzYzhiMDA3M2FkNDA0OTU3ZjVmMzM3OGQ1ZDhmM2Q4MjUyMTA0ODkiLCJhdWQiOlsiZGlkOmV4YW1wbGU6MzQ1NiIsImRpZDp3ZWI6dXBvcnQubWUiXX0.NfQjQb3_mo956o5guLTV5iKF9mna-Yy70MBZQlNDu9OujpDhbsaQ5MHFw5GGG1M47_74ZAaMTOx9Wc7iY7eLZw'\n\n  const vpMultiAudPayload = {\n    iat: 1588676739,\n    vp: {\n      '@context': ['https://www.w3.org/2018/credentials/v1'],\n      type: ['VerifiablePresentation'],\n      verifiableCredential: [vpMultiAudJwt],\n    },\n    tag: 'tag123',\n    aud: ['did:example:3456', 'did:web:uport.me'],\n    iss: 'did:ethr:goerli:0x02db6b83a38e31dedfcd0017a483c8b0073ad404957f5f3378d5d8f3d825210489',\n  }\n\n  it('should use the first audience did as a message.to field', async () => {\n    expect.assertions(7)\n    const message = new Message({ raw: vpMultiAudJwt, metaData: [{ type: 'test' }] })\n    // This would be done by '@veramo/did-jwt':\n    message.data = vpMultiAudPayload\n    message.addMetaData({ type: 'JWT', value: 'ES256K-R' })\n\n    const handled = await handler.handle(message, context)\n    expect(handled.isValid()).toEqual(true)\n    expect(handled.id).toEqual(computeEntryHash(vpMultiAudJwt))\n    expect(handled.raw).toEqual(vpMultiAudJwt)\n    expect(handled.type).toEqual(MessageTypes.vp)\n    expect(handled.from).toEqual(vpMultiAudPayload.iss)\n    expect(handled.to).toEqual(vpMultiAudPayload.aud[0])\n    expect(handled.threadId).toEqual(vpMultiAudPayload.tag)\n  })\n\n  it('should return handled VC message with credentialStatus', async () => {\n    expect.assertions(6)\n    const token =\n      'eyJ0eXAiOiJKV1QiLCJhbGciOiJFUzI1NksifQ.eyJpYXQiOjE1ODgyNDkyNTgsInN1YiI6ImRpZDp3ZWI6dXBvcnQubWUiLCJub25jZSI6IjM4NzE4Njc0NTMiLCJ2YyI6eyJAY29udGV4dCI6WyJodHRwczovL3d3dy53My5vcmcvMjAxOC9jcmVkZW50aWFscy92MSJdLCJ0eXBlIjpbIlZlcmlmaWFibGVDcmVkZW50aWFsIiwiQXdlc29tZW5lc3NDcmVkZW50aWFsIl0sImNyZWRlbnRpYWxTdWJqZWN0Ijp7Iml0IjoicmVhbGx5IHdoaXBzIHRoZSBsbGFtbWEncyBhc3MhIn19LCJjcmVkZW50aWFsU3RhdHVzIjp7InR5cGUiOiJFdGhyU3RhdHVzUmVnaXN0cnkyMDE5IiwiaWQiOiJyaW5rZWJ5OjB4OTdmZDI3ODkyY2RjRDAzNWRBZTFmZTcxMjM1YzYzNjA0NEI1OTM0OCJ9LCJpc3MiOiJkaWQ6ZXRocjoweDU0ZDU5ZTNmZmQ3NjkxN2Y2MmRiNzAyYWMzNTRiMTdmMzg0Mjk1NWUifQ.mtMt6-sJdaKH_sPUFPan1FzvWPtlrdKLRCHrh1aOS_zSVyTGHynA0-5AHcEujB1Rz1SuzuM3rkhHRO8eX2IAYg'\n    const message = new Message({\n      raw: token,\n      metaData: [{ type: 'test' }],\n    })\n    // This would be done by '@veramo/did-jwt':\n    message.data = {\n      iat: 1588249258,\n      sub: 'did:web:uport.me',\n      vc: {\n        '@context': ['https://www.w3.org/2018/credentials/v1'],\n        type: ['VerifiableCredential', 'AwesomenessCredential'],\n        credentialSubject: {\n          it: \"really whips the llamma's ass!\",\n        },\n      },\n      credentialStatus: {\n        type: 'EthrStatusRegistry2019',\n        // TODO(nickreynolds): deploy\n        id: 'sepolia:0x97fd27892cdcD035dAe1fe71235c636044B59348',\n      },\n      iss: 'did:ethr:0x54d59e3ffd76917f62db702ac354b17f3842955e',\n    }\n    message.addMetaData({ type: 'JWT', value: 'ES256K' })\n\n    const handled = await handler.handle(message, context)\n\n    expect(handled.isValid()).toEqual(true)\n    expect(handled.id).toEqual(computeEntryHash(token))\n    expect(handled.raw).toEqual(token)\n    expect(handled.type).toEqual(MessageTypes.vc)\n    expect(handled.from).toEqual('did:ethr:0x54d59e3ffd76917f62db702ac354b17f3842955e')\n    expect(handled.to).toEqual('did:web:uport.me')\n  })\n})\n"
  },
  {
    "path": "packages/credential-w3c/src/abstract-credential-provider.ts",
    "content": "import {\n  ICredentialIssuer,\n  ICredentialVerifier,\n  IKey,\n  ProofFormat,\n  W3CVerifiableCredential,\n  W3CVerifiablePresentation,\n} from '@veramo/core-types'\n\n/**\n * Subset of issuer methods implemented by Credential Providers\n *\n * @internal\n */\nexport type IssuerMethods = Pick<\n  ICredentialIssuer,\n  'createVerifiableCredential' | 'createVerifiablePresentation'\n>\n\n/**\n * Subset of verifier methods implemented by Credential Providers\n *\n * @internal\n */\nexport type VerifierMethods = Pick<ICredentialVerifier, 'verifyCredential' | 'verifyPresentation'>\n\n/**\n * Query a {@link ICredentialProvider} if a verification attempt can be made using the provided document\n *\n * @see {@link ICredentialProvider.canVerifyDocumentType}\n * @public\n */\nexport type TentativeVerificationQuery = { document: W3CVerifiableCredential | W3CVerifiablePresentation }\n\n/**\n * Query a {@link ICredentialProvider} for a particular proof format\n *\n * @see {@link ICredentialProvider.canIssueProofFormat}\n * @public\n */\nexport type ProofFormatQuery = { proofFormat: ProofFormat }\n\n/**\n * The interface definition for a sub-plugin that can issue and verify Verifiable Data\n * (e.g. Verifiable Credentials and Presentations)\n *\n * @see {@link @veramo/credential-jwt#CredentialProviderJWT} for an implementation.\n * @remarks Please see {@link https://www.w3.org/TR/vc-data-model | W3C Verifiable Credentials data model}\n *\n * @public\n */\nexport interface ICredentialProvider extends IssuerMethods, VerifierMethods {\n  /**\n   * Lists the proof formats supported by this provider for a given key\n   * @param key - The key to check supported proof formats for\n   *\n   * @returns An array of supported proof format strings\n   */\n  getProofFormatsSupportedForKey(key: IKey): ProofFormat[]\n\n  /**\n   * Checks if this provider can attempt to verify a document.\n   *\n   * @param query - contains the document to check\n   *\n   * @returns a boolean indicating if a verification attempt can be made\n   */\n  canVerifyDocumentType(query: TentativeVerificationQuery): boolean\n\n  /**\n   * Checks if this provider can issue a credential or presentation in a particular format.\n   * @param query - The proof format to check\n   *\n   * @returns a boolean indicating if the credential or presentation can be issued in that format\n   */\n  canIssueProofFormat(query: ProofFormatQuery): boolean\n}\n"
  },
  {
    "path": "packages/credential-w3c/src/action-handler.ts",
    "content": "import {\n  IAgentContext,\n  IAgentPlugin,\n  ICreateVerifiableCredentialArgs,\n  ICreateVerifiablePresentationArgs,\n  ICredentialPlugin,\n  ICredentialStatusVerifier,\n  IIdentifier,\n  IssuerAgentContext,\n  IVerifyCredentialArgs,\n  IVerifyPresentationArgs,\n  IVerifyResult,\n  ProofFormat,\n  schema,\n  VerifiableCredential,\n  VerifiablePresentation,\n  VerifierAgentContext,\n} from '@veramo/core-types'\n\nimport { ICredentialProvider } from './abstract-credential-provider.js'\n\nimport { extractIssuer, isDefined, MANDATORY_CREDENTIAL_CONTEXT, processEntryToArray } from '@veramo/utils'\nimport Debug from 'debug'\n\nconst debug = Debug('veramo:w3c:action-handler')\n\n/**\n * A Veramo plugin that implements the {@link @veramo/core-types#ICredentialPlugin | ICredentialPlugin} methods.\n *\n * @public\n */\nexport class CredentialPlugin implements IAgentPlugin {\n  readonly methods: ICredentialPlugin\n  readonly schema = {\n    components: {\n      schemas: {\n        ...schema.ICredentialIssuer.components.schemas,\n        ...schema.ICredentialVerifier.components.schemas,\n      },\n      methods: {\n        ...schema.ICredentialIssuer.components.methods,\n        ...schema.ICredentialVerifier.components.methods,\n      },\n    },\n  }\n  private providers: ICredentialProvider[]\n\n  constructor(providers: ICredentialProvider[]) {\n    this.providers = providers\n    this.methods = {\n      listUsableProofFormats: this.listUsableProofFormats.bind(this),\n      createVerifiableCredential: this.createVerifiableCredential.bind(this),\n      verifyCredential: this.verifyCredential.bind(this),\n      createVerifiablePresentation: this.createVerifiablePresentation.bind(this),\n      verifyPresentation: this.verifyPresentation.bind(this),\n    }\n  }\n\n  /** {@inheritdoc @veramo/core-types#ICredentialIssuer.listUsableProofFormats} */\n  async listUsableProofFormats(did: IIdentifier, context: IssuerAgentContext): Promise<ProofFormat[]> {\n    const signingOptions: string[] = []\n    const keys = did.keys\n    for (const key of keys) {\n      for (const provider of this.providers) {\n        signingOptions.push(...provider.getProofFormatsSupportedForKey(key))\n      }\n    }\n    return signingOptions\n  }\n\n  /** {@inheritdoc @veramo/core-types#ICredentialIssuer.createVerifiableCredential} */\n  async createVerifiableCredential(\n    args: ICreateVerifiableCredentialArgs,\n    context: IssuerAgentContext,\n  ): Promise<VerifiableCredential> {\n    let { credential, proofFormat, keyRef, removeOriginalFields, save, now, ...otherOptions } = args\n    const credentialContext = processEntryToArray(credential['@context'], MANDATORY_CREDENTIAL_CONTEXT)\n    const credentialType = processEntryToArray(credential.type, 'VerifiableCredential')\n\n    // only add issuanceDate for JWT\n    now = typeof now === 'number' ? new Date(now * 1000) : now\n    if (!Object.getOwnPropertyNames(credential).includes('issuanceDate')) {\n      credential.issuanceDate = (now instanceof Date ? now : new Date()).toISOString()\n    }\n\n    credential = {\n      ...credential,\n      '@context': credentialContext,\n      type: credentialType,\n    }\n\n    //FIXME: if the identifier is not found, the error message should reflect that.\n    const issuer = extractIssuer(credential, { removeParameters: true })\n    if (!issuer || typeof issuer === 'undefined') {\n      throw new Error('invalid_argument: credential.issuer must not be empty')\n    }\n\n    let identifier: IIdentifier\n    try {\n      identifier = await context.agent.didManagerGet({ did: issuer })\n    } catch (e) {\n      throw new Error(`invalid_argument: credential.issuer must be a DID managed by this agent. ${e}`)\n    }\n    try {\n      let verifiableCredential: VerifiableCredential | undefined\n\n      async function tryToIssueCredential(providers: ICredentialProvider[]) {\n        for (const provider of providers) {\n          if (provider.canIssueProofFormat({ proofFormat })) {\n            return await provider.createVerifiableCredential(args, context)\n          }\n        }\n      }\n      verifiableCredential = await tryToIssueCredential(this.providers)\n\n      if (!verifiableCredential) {\n        throw new Error('invalid_setup: No provider found for the requested proof format')\n      }\n\n      if (save) {\n        await context.agent.dataStoreSaveVerifiableCredential({ verifiableCredential })\n      }\n\n      return verifiableCredential\n    } catch (error) {\n      debug(error)\n      return Promise.reject(error)\n    }\n  }\n\n  /** {@inheritdoc @veramo/core-types#ICredentialVerifier.verifyCredential} */\n  async verifyCredential(args: IVerifyCredentialArgs, context: VerifierAgentContext): Promise<IVerifyResult> {\n    let { credential, policies } = args\n\n    async function getVerificationResult(issuers: ICredentialProvider[]): Promise<IVerifyResult | undefined> {\n      for (const issuer of issuers) {\n        if (issuer.canVerifyDocumentType({ document: credential })) {\n          return issuer.verifyCredential(args, context)\n        }\n      }\n    }\n    let verificationResult = await getVerificationResult(this.providers)\n    if (!verificationResult) {\n      throw new Error('invalid_setup: No verifier found for the provided credential')\n    }\n    const verifiedCredential = <VerifiableCredential>credential\n\n    if (policies?.credentialStatus !== false && (await isRevoked(verifiedCredential, context as any))) {\n      verificationResult = {\n        verified: false,\n        error: {\n          message: 'revoked: The credential was revoked by the issuer',\n          errorCode: 'revoked',\n        },\n      }\n    }\n\n    return verificationResult\n  }\n\n  /** {@inheritdoc @veramo/core-types#ICredentialIssuer.createVerifiablePresentation} */\n  async createVerifiablePresentation(\n    args: ICreateVerifiablePresentationArgs,\n    context: IssuerAgentContext,\n  ): Promise<VerifiablePresentation> {\n    let { presentation, proofFormat, save } = args\n    const presentationContext: string[] = processEntryToArray(\n      args?.presentation?.['@context'],\n      MANDATORY_CREDENTIAL_CONTEXT,\n    )\n    const presentationType = processEntryToArray(args?.presentation?.type, 'VerifiablePresentation')\n    presentation = {\n      ...presentation,\n      '@context': presentationContext,\n      type: presentationType,\n    }\n\n    if (!isDefined(presentation.holder)) {\n      throw new Error('invalid_argument: presentation.holder must not be empty')\n    }\n\n    if (presentation.verifiableCredential) {\n      presentation.verifiableCredential = presentation.verifiableCredential.map((cred) => {\n        // map JWT credentials to their canonical form\n        if (typeof cred !== 'string' && cred.proof.jwt) {\n          return cred.proof.jwt\n        } else {\n          return cred\n        }\n      })\n    }\n\n    async function tryToCreatePresentation(issuers: ICredentialProvider[]) {\n      for (const issuer of issuers) {\n        if (issuer.canIssueProofFormat({ proofFormat })) {\n          return await issuer.createVerifiablePresentation(args, context)\n        }\n      }\n    }\n\n    let verifiablePresentation = await tryToCreatePresentation(this.providers)\n\n    if (!verifiablePresentation) {\n      throw new Error('invalid_setup: No provider found for the requested proof format')\n    }\n\n    if (save) {\n      await context.agent.dataStoreSaveVerifiablePresentation({ verifiablePresentation })\n    }\n    return verifiablePresentation\n  }\n\n  /** {@inheritdoc @veramo/core-types#ICredentialVerifier.verifyPresentation} */\n  async verifyPresentation(\n    args: IVerifyPresentationArgs,\n    context: VerifierAgentContext,\n  ): Promise<IVerifyResult> {\n    async function tryVerification(issuers: ICredentialProvider[]): Promise<IVerifyResult | undefined> {\n      for (const issuer of issuers) {\n        if (issuer.canVerifyDocumentType({ document: args.presentation })) {\n          return issuer.verifyPresentation(args, context)\n        }\n      }\n    }\n    let result = await tryVerification(this.providers)\n    if (!result) {\n      throw new Error('invalid_setup: No verifier found for the provided presentation')\n    }\n    return result\n  }\n}\n\nasync function isRevoked(\n  credential: VerifiableCredential,\n  context: IAgentContext<ICredentialStatusVerifier>,\n): Promise<boolean> {\n  if (!credential.credentialStatus) return false\n\n  if (typeof context.agent.checkCredentialStatus === 'function') {\n    const status = await context.agent.checkCredentialStatus({ credential })\n    return status?.revoked == true || status?.verified === false\n  }\n\n  throw new Error(\n    `invalid_setup: The credential status can't be verified because there is no ICredentialStatusVerifier plugin installed.`,\n  )\n}\n"
  },
  {
    "path": "packages/credential-w3c/src/index.ts",
    "content": "/**\n * Provides a {@link @veramo/credential-w3c#CredentialPlugin | plugin} for the {@link @veramo/core#Agent} that\n * implements\n * {@link @veramo/core-types#ICredentialIssuer} interface.\n *\n * Provides a {@link @veramo/credential-w3c#W3cMessageHandler | plugin} for the\n * {@link @veramo/message-handler#MessageHandler} that verifies Credentials and Presentations in a message.\n *\n * @packageDocumentation\n */\nexport { W3cMessageHandler, MessageTypes } from './message-handler.js'\nimport { CredentialPlugin } from './action-handler.js'\n\n/**\n * @deprecated please use {@link CredentialPlugin} instead\n * @public\n */\nconst CredentialIssuer = CredentialPlugin\nexport { CredentialIssuer, CredentialPlugin }\n\n// For backward compatibility, re-export the plugin types that were moved to core in v4\nexport type { ICredentialIssuer, ICredentialVerifier } from '@veramo/core-types'\n\nexport type {\n  ICredentialProvider,\n  ProofFormatQuery,\n  TentativeVerificationQuery,\n} from './abstract-credential-provider.js'\n"
  },
  {
    "path": "packages/credential-w3c/src/message-handler.ts",
    "content": "import {\n  IAgentContext,\n  ICredentialVerifier,\n  IResolver,\n  VerifiableCredential,\n  VerifiablePresentation,\n} from '@veramo/core-types'\nimport { AbstractMessageHandler, Message } from '@veramo/message-handler'\nimport { asArray, computeEntryHash, decodeCredentialToObject, extractIssuer } from '@veramo/utils'\nimport {\n  normalizeCredential,\n  normalizePresentation,\n  validateJwtCredentialPayload,\n  validateJwtPresentationPayload,\n} from 'did-jwt-vc'\nimport { v4 as uuidv4 } from 'uuid'\nimport Debug from 'debug'\n\nconst debug = Debug('veramo:w3c:message-handler')\n\n/**\n * These types are used by `@veramo/data-store` when storing Verifiable Credentials and Presentations\n *\n * @internal\n */\nexport const MessageTypes = {\n  /** Represents a Verifiable Credential */\n  vc: 'w3c.vc',\n  /** Represents a Verifiable Presentation */\n  vp: 'w3c.vp',\n}\n\n/**\n * Represents the requirements that this plugin has.\n * The agent that is using this plugin is expected to provide these methods.\n *\n * This interface can be used for static type checks, to make sure your application is properly initialized.\n */\nexport type IContext = IAgentContext<IResolver & ICredentialVerifier>\n\n/**\n * An implementation of the {@link @veramo/message-handler#AbstractMessageHandler}.\n *\n * This plugin can handle incoming W3C Verifiable Credentials and Presentations and prepare them\n * for internal storage as {@link @veramo/message-handler#Message} types.\n *\n * The current version can only handle `JWT` encoded\n *\n * @remarks {@link @veramo/core-types#IDataStore | IDataStore }\n *\n * @public\n */\nexport class W3cMessageHandler extends AbstractMessageHandler {\n  async handle(message: Message, context: IContext): Promise<Message> {\n    const meta = message.getLastMetaData()\n\n    // console.log(JSON.stringify(message, null,  2))\n\n    //FIXME: messages should not be expected to be only JWT\n    if (meta?.type === 'JWT' && message.raw) {\n      const { data } = message\n\n      try {\n        validateJwtPresentationPayload(data)\n\n        //FIXME: flagging this for potential privacy leaks\n        debug('JWT is', MessageTypes.vp)\n        const presentation = normalizePresentation(message.raw)\n        const credentials = presentation.verifiableCredential\n\n        message.id = computeEntryHash(message.raw)\n        message.type = MessageTypes.vp\n        message.from = presentation.holder\n        message.to = presentation.verifier?.[0]\n\n        if (presentation.tag) {\n          message.threadId = presentation.tag\n        }\n\n        message.createdAt = presentation.issuanceDate\n        message.presentations = [presentation]\n        message.credentials = credentials\n\n        return message\n      } catch (e) {}\n\n      try {\n        validateJwtCredentialPayload(data)\n        //FIXME: flagging this for potential privacy leaks\n        debug('JWT is', MessageTypes.vc)\n        const credential = normalizeCredential(message.raw)\n\n        message.id = computeEntryHash(message.raw)\n        message.type = MessageTypes.vc\n        message.from = credential.issuer.id\n        message.to = credential.credentialSubject.id\n\n        if (credential.tag) {\n          message.threadId = credential.tag\n        }\n\n        message.createdAt = credential.issuanceDate\n        message.credentials = [credential]\n        return message\n      } catch (e) {}\n    }\n\n    // LDS Verification and Handling\n    if (message.type === MessageTypes.vc && message.data) {\n      // verify credential\n      const credential = message.data as VerifiableCredential\n\n      const result = await context.agent.verifyCredential({ credential })\n      if (result.verified) {\n        message.id = computeEntryHash(message.raw || message.id || uuidv4())\n        message.type = MessageTypes.vc\n        message.from = extractIssuer(credential)\n        message.to = credential.credentialSubject.id\n\n        if (credential.tag) {\n          message.threadId = credential.tag\n        }\n\n        message.createdAt = credential.issuanceDate\n        message.credentials = [credential]\n        return message\n      } else {\n        throw new Error(result.error?.message)\n      }\n    }\n\n    if (message.type === MessageTypes.vp && message.data) {\n      // verify presentation\n      const presentation = message.data as VerifiablePresentation\n\n      // throws on error.\n      const result = await context.agent.verifyPresentation({\n        presentation,\n        // FIXME: HARDCODED CHALLENGE VERIFICATION FOR NOW\n        challenge: 'VERAMO',\n        domain: 'VERAMO',\n      })\n      if (result.verified) {\n        message.id = computeEntryHash(message.raw || message.id || uuidv4())\n        message.type = MessageTypes.vp\n        message.from = presentation.holder\n        // message.to = presentation.verifier?.[0]\n\n        if (presentation.tag) {\n          message.threadId = presentation.tag\n        }\n\n        // message.createdAt = presentation.issuanceDate\n        message.presentations = [presentation]\n        message.credentials = asArray(presentation.verifiableCredential).map(decodeCredentialToObject)\n        return message\n      } else {\n        throw new Error(result.error?.message)\n      }\n    }\n\n    return super.handle(message, context)\n  }\n}\n"
  },
  {
    "path": "packages/credential-w3c/tsconfig.json",
    "content": "{\n  \"extends\": \"../tsconfig.settings.json\",\n  \"compilerOptions\": {\n    \"rootDir\": \"src\",\n    \"outDir\": \"build\",\n    \"declarationDir\": \"build\",\n    // https://github.com/transmute-industries/vc.js/issues/60\n    \"skipLibCheck\": true\n  },\n  \"references\": [\n    {\n      \"path\": \"../core-types\"\n    },\n    {\n      \"path\": \"../message-handler\"\n    },\n    {\n      \"path\": \"../utils\"\n    }\n  ],\n  \"include\": [\n    \"./**/*.ts\"\n  ]\n}\n"
  },
  {
    "path": "packages/data-store/CHANGELOG.md",
    "content": "# Change Log\n\nAll notable changes to this project will be documented in this file.\nSee [Conventional Commits](https://conventionalcommits.org) for commit guidelines.\n\n# [7.0.0](https://github.com/decentralized-identity/veramo/compare/v6.0.2...v7.0.0) (2026-02-11)\n\n\n### Bug Fixes\n\n* **data-store:** replace typeOrm findOne queries including relations with find ([#1400](https://github.com/decentralized-identity/veramo/issues/1400)) ([034afc4](https://github.com/decentralized-identity/veramo/commit/034afc430225aef98ecdf93214b75d049ebcb9d7))\n* **data-store:** validate sorted queries in data store ([#1482](https://github.com/decentralized-identity/veramo/issues/1482)) ([067e39d](https://github.com/decentralized-identity/veramo/commit/067e39dd76f11ee2d25b99c8361d4f02a4223e3b))\n* **deps:** update dependency uuid to v11 ([#1431](https://github.com/decentralized-identity/veramo/issues/1431)) ([6ad84d9](https://github.com/decentralized-identity/veramo/commit/6ad84d91f02794e741e4b770e29e1ee9a93edcfb))\n* **deps:** update devdeps and bump typeorm to 0.3.20 ([#1272](https://github.com/decentralized-identity/veramo/issues/1272)) ([7d17f37](https://github.com/decentralized-identity/veramo/commit/7d17f37ea7cc4e73a8cdae028681ae1be5c4d11c))\n\n\n### Features\n\n* **credential-w3c:** refactor the ICredentialProvider API ([#1488](https://github.com/decentralized-identity/veramo/issues/1488)) ([cbd848d](https://github.com/decentralized-identity/veramo/commit/cbd848d4ce2b52497d99d335f1c93bd8b005cdb2))\n\n\n### BREAKING CHANGES\n\n* **credential-w3c:** This changeset, along with the previous changes in #1395 modify the CredentialPlugin to support extensibility without modifications to the veramo repository. This plugin now acts as an orchestrator for other ICredentialProvider implementations that provide the actual support for various verifiable data formats. ICredentialProvider implementations can be implemented externally and used with this plugin.\n\n\n\n\n\n## [6.0.2](https://github.com/decentralized-identity/veramo/compare/v6.0.1...v6.0.2) (2026-01-16)\n\n\n### Bug Fixes\n\n* **data-store:** validate sorted queries in data store ([#1482](https://github.com/decentralized-identity/veramo/issues/1482)) ([0807612](https://github.com/decentralized-identity/veramo/commit/080761254fba065c30989793dc14aec68eb5e677))\n\n\n\n\n\n## [6.0.1](https://github.com/decentralized-identity/veramo/compare/v6.0.0...v6.0.1) (2026-01-16)\n\n**Note:** Version bump only for package @veramo/data-store\n\n\n\n\n\n# [6.0.0](https://github.com/decentralized-identity/veramo/compare/v5.6.0...v6.0.0) (2024-04-02)\n\n\n### Bug Fixes\n\n* export const plugin schemas instead of defaults ([#1327](https://github.com/decentralized-identity/veramo/issues/1327)) ([7896cea](https://github.com/decentralized-identity/veramo/commit/7896ceaf2c79993eee44e46950814bea74bfe647)), closes [#1318](https://github.com/decentralized-identity/veramo/issues/1318) [#1317](https://github.com/decentralized-identity/veramo/issues/1317) [#1315](https://github.com/decentralized-identity/veramo/issues/1315)\n\n\n### Code Refactoring\n\n* generate plugin schemas as TS instead of JSON ([#1315](https://github.com/decentralized-identity/veramo/issues/1315)) ([65c2d4b](https://github.com/decentralized-identity/veramo/commit/65c2d4bc814daa9a3a89f4f7b8e8c6973b8ce2f0)), closes [#1254](https://github.com/decentralized-identity/veramo/issues/1254)\n\n\n### Features\n\n* add Multikey support ([#1316](https://github.com/decentralized-identity/veramo/issues/1316)) ([165de35](https://github.com/decentralized-identity/veramo/commit/165de3549ccfd3d7c84514608ac3ea9e56a7b807))\n\n\n### BREAKING CHANGES\n\n* The `plugin.schema.json` files are now generated as `plugin.schema.ts`.\n\n\n\n\n\n# [5.6.0](https://github.com/decentralized-identity/veramo/compare/v5.5.3...v5.6.0) (2024-01-16)\n\n\n### Features\n\n* **remote-client:** allow dynamic headers param for AgentRestClient constructor ([#1314](https://github.com/decentralized-identity/veramo/issues/1314)) ([1b8a0a2](https://github.com/decentralized-identity/veramo/commit/1b8a0a2718dd63492ad3a312a6ebe5f6e7849935)), closes [#1313](https://github.com/decentralized-identity/veramo/issues/1313)\n\n\n\n\n\n## [5.5.3](https://github.com/decentralized-identity/veramo/compare/v5.5.2...v5.5.3) (2023-10-09)\n\n\n### Bug Fixes\n\n* use DIF URLs in packages ([#1271](https://github.com/decentralized-identity/veramo/issues/1271)) ([3dfc601](https://github.com/decentralized-identity/veramo/commit/3dfc6014cdee7902c59d8db76b4c8507b870f227))\n\n\n\n\n\n## [5.5.2](https://github.com/uport-project/veramo/compare/v5.5.1...v5.5.2) (2023-10-06)\n\n\n### Bug Fixes\n\n* **data-store:** match claims by credential hash when deleting credential ([#1270](https://github.com/uport-project/veramo/issues/1270)) ([4ee626d](https://github.com/uport-project/veramo/commit/4ee626d4b16e50cbc9a16055120051b068f177bd)), closes [#1269](https://github.com/uport-project/veramo/issues/1269)\n\n\n\n\n\n## [5.5.1](https://github.com/uport-project/veramo/compare/v5.5.0...v5.5.1) (2023-09-21)\n\n\n### Bug Fixes\n\n* **data-store:** take and skip for postgres ([#1249](https://github.com/uport-project/veramo/issues/1249)) ([fcd2699](https://github.com/uport-project/veramo/commit/fcd269961ba9a5470c9b809f076493db481efaaa))\n\n\n\n\n\n# [5.5.0](https://github.com/uport-project/veramo/compare/v5.4.1...v5.5.0) (2023-09-19)\n\n\n### Bug Fixes\n\n* **data-store:** order skip take in orm and json ([#1243](https://github.com/uport-project/veramo/issues/1243)) ([28c1224](https://github.com/uport-project/veramo/commit/28c12247c4e4b5c94e5e92b481e3ccc71b2c4ec6))\n* **did-provider-key:** use compressed keys for creating Secp256k1 did:key ([#1217](https://github.com/uport-project/veramo/issues/1217)) ([ba8f6f5](https://github.com/uport-project/veramo/commit/ba8f6f5b9b701e57af86491504ecd209ca0c1c1d)), closes [#1213](https://github.com/uport-project/veramo/issues/1213)\n\n\n\n\n\n## [5.4.1](https://github.com/uport-project/veramo/compare/v5.4.0...v5.4.1) (2023-08-04)\n\n\n### Bug Fixes\n\n* **ci:** benign change meant to tag all packages for another patch release ([#1211](https://github.com/uport-project/veramo/issues/1211)) ([41b5c90](https://github.com/uport-project/veramo/commit/41b5c90277171b7b38c5cf49ca01db5cf75b6300))\n\n\n\n\n\n# [5.4.0](https://github.com/uport-project/veramo/compare/v5.3.0...v5.4.0) (2023-08-01)\n\n\n### Features\n\n* **did-comm:** add support for the AES based content and key encryption algorithms ([#1180](https://github.com/uport-project/veramo/issues/1180)) ([5294a81](https://github.com/uport-project/veramo/commit/5294a812ee578c0712b54f216416c3ef78c848da))\n\n\n\n\n\n# [5.3.0](https://github.com/uport-project/veramo/compare/v5.2.0...v5.3.0) (2023-07-27)\n\n**Note:** Version bump only for package @veramo/data-store\n\n\n\n\n\n# [5.2.0](https://github.com/uport-project/veramo/compare/v5.1.4...v5.2.0) (2023-05-02)\n\n\n### Bug Fixes\n\n* **data-store:** fix react-native migrations on older Android installations ([#1152](https://github.com/uport-project/veramo/issues/1152)) ([826b994](https://github.com/uport-project/veramo/commit/826b994c6c86f45ea05a93bfc409cec34e562ec6))\n\n\n\n\n\n## [5.1.2](https://github.com/uport-project/veramo/compare/v5.1.1...v5.1.2) (2023-02-25)\n\n**Note:** Version bump only for package @veramo/data-store\n\n\n\n\n\n# [5.1.0](https://github.com/uport-project/veramo/compare/v5.0.0...v5.1.0) (2023-02-24)\n\n\n### Bug Fixes\n\n* P256 key parity corrections ([#1137](https://github.com/uport-project/veramo/issues/1137)) ([d0eca2b](https://github.com/uport-project/veramo/commit/d0eca2b3cd9ca6741f7f056e28bb9799910bc5ec)), closes [#1136](https://github.com/uport-project/veramo/issues/1136) [#1135](https://github.com/uport-project/veramo/issues/1135)\n\n\n\n\n\n# [5.0.0](https://github.com/uport-project/veramo/compare/v4.3.0...v5.0.0) (2023-02-09)\n\n\n### Bug Fixes\n\n* **did-manager:** rename AbstractDIDStore methods for SES compatibility ([0287340](https://github.com/uport-project/veramo/commit/02873401508a8a7d8c999bc12dc1d107a4a5202f)), closes [#1090](https://github.com/uport-project/veramo/issues/1090)\n* **key-manager:** rename Abstract[Private]KeyStore methods for SES compatibility ([91631b6](https://github.com/uport-project/veramo/commit/91631b6d2a09d46accff6509f44792d88209b801)), closes [#1090](https://github.com/uport-project/veramo/issues/1090)\n\n\n### Build System\n\n* convert veramo modules to ESM instead of CommonJS ([#1103](https://github.com/uport-project/veramo/issues/1103)) ([b5cea3c](https://github.com/uport-project/veramo/commit/b5cea3c0d80d900a47bd1d9eea68f84b70a35e7b)), closes [#1099](https://github.com/uport-project/veramo/issues/1099)\n\n\n### Features\n\n* isolate `core-types` package from `core` ([#1116](https://github.com/uport-project/veramo/issues/1116)) ([ba7a303](https://github.com/uport-project/veramo/commit/ba7a303de91cf4cc568a3af1ddf8ca98ed022e9f))\n\n\n### BREAKING CHANGES\n\n* **did-manager:** implementations of AbstractDIDStore need to rename their methods to conform to the new API. Functionality remains the same.\n* **key-manager:** implementations of AbstractKeyStore and AbstractPrivateKeyStore need to rename their methods to conform to the new API. Functionality remains the same.\n* this is a breaking change as modules will have to be imported differently: \n* https://www.typescriptlang.org/docs/handbook/esm-node.html\n* https://nodejs.org/api/esm.html\n* https://caniuse.com/?search=modules\n\ntest(did-provider-ion): skip a couple of tests that fail with unreasonable errors\nchore: use ubuntu-latest on CI\nfix: temporarily remove puppeteer tests\nfix: use craco for test-react-app to enable babel config\ntest: fix unit and integration tests (browser tests still broken)\nfix: fix some build issues that prevented tests from working\nfix: missing deps flagged by pnpm\n\n\n\n\n\n# [4.3.0](https://github.com/uport-project/veramo/compare/v4.2.0...v4.3.0) (2023-01-27)\n\n**Note:** Version bump only for package @veramo/data-store\n\n\n\n\n\n# [4.2.0](https://github.com/uport-project/veramo/compare/v4.1.2...v4.2.0) (2022-12-05)\n\n\n### Bug Fixes\n\n* **credential-ld:** simplify signature suite use of Uint8Array ([49a10ec](https://github.com/uport-project/veramo/commit/49a10ecc29d56118ac09c5df73fed885fe6988c1))\n* **deps:** bump dependencies ([701b8ed](https://github.com/uport-project/veramo/commit/701b8edf981ea11c7ddb6a81d2817dbbdbb022f3))\n\n\n\n\n\n## [4.1.1](https://github.com/uport-project/veramo/compare/v4.1.0...v4.1.1) (2022-11-01)\n\n**Note:** Version bump only for package @veramo/data-store\n\n\n\n\n\n# [4.1.0](https://github.com/uport-project/veramo/compare/v4.0.2...v4.1.0) (2022-10-31)\n\n**Note:** Version bump only for package @veramo/data-store\n\n\n\n\n\n## [4.0.2](https://github.com/uport-project/veramo/compare/v4.0.1...v4.0.2) (2022-10-04)\n\n\n### Bug Fixes\n\n* **data-store:** use looser typeorm version range to fix [#1013](https://github.com/uport-project/veramo/issues/1013) ([#1016](https://github.com/uport-project/veramo/issues/1016)) ([83807f3](https://github.com/uport-project/veramo/commit/83807f31f845c8a0116f0300c51735ec406d9dd4))\n\n\n\n\n\n# [4.0.0](https://github.com/uport-project/veramo/compare/v3.1.5...v4.0.0) (2022-09-22)\n\n\n### Bug Fixes\n\n* **deps:** update all non-major dependencies ([a7a5b5d](https://github.com/uport-project/veramo/commit/a7a5b5dc3a2d90670927f4367bef2055a6d39f3b))\n* **deps:** update all non-major dependencies ([04c0053](https://github.com/uport-project/veramo/commit/04c00530963b1c4496374532bf74b73f3b22c825))\n* **deps:** update all non-major dependencies ([d8aa16a](https://github.com/uport-project/veramo/commit/d8aa16a36d2e63c65177bbf281f8d15fcc9dcb5a))\n* **deps:** update all non-major dependencies ([183b4bc](https://github.com/uport-project/veramo/commit/183b4bc5ca3dcf11dd111e7e1ae19636909ff4c7))\n* **deps:** update dependency typeorm to v0.2.41 ([61a8103](https://github.com/uport-project/veramo/commit/61a8103c15849dfd8574dda69692a7d8f7fa534e))\n* **did-resolver:** use interface `Resolvable` instead of the `Resolver` class ([9c2e59f](https://github.com/uport-project/veramo/commit/9c2e59f3f23f808511c6c0e8e440b4d53ba5cb00))\n* **docs:** fix relevant errors and warnings in TSDoc to enable proper docs generation on `[@next](https://github.com/next)` branch ([79c3872](https://github.com/uport-project/veramo/commit/79c387230219c92c1951d19b8ddf716308a46c5b))\n* update and fix inline documentation of all exported types ([#921](https://github.com/uport-project/veramo/issues/921)) ([63e64e0](https://github.com/uport-project/veramo/commit/63e64e0e2693808c4704dca8cc511dc0bab3f3b1))\n\n\n### Features\n\n* add partial match for dids and aliases in did discovery provider for data store ([92b793e](https://github.com/uport-project/veramo/commit/92b793e8b45f005b87717393419cf5f84a5ca0ec))\n* add support for serviceEndpoint property as defined in latest DID Spec ([#988](https://github.com/uport-project/veramo/issues/988)) ([9bed70b](https://github.com/uport-project/veramo/commit/9bed70ba658aed34a97944e0dee27bca6c81d700))\n* **credential-ld:** add support for browser environments ([#916](https://github.com/uport-project/veramo/issues/916)) ([435e4d2](https://github.com/uport-project/veramo/commit/435e4d260b1774f96b182c1a75ab2f1c993f2291))\n* **credential-w3c:** add ICredentialPlugin interface in core package ([#1001](https://github.com/uport-project/veramo/issues/1001)) ([7b6d195](https://github.com/uport-project/veramo/commit/7b6d1950364c8b741dd958d29e506b95fa5b1cec)), closes [#941](https://github.com/uport-project/veramo/issues/941)\n* **data-store:** use DataSource instead of Connection ([#970](https://github.com/uport-project/veramo/issues/970)) ([3377930](https://github.com/uport-project/veramo/commit/3377930189bcbd43dfd155992093d2bbeb883335)), closes [#947](https://github.com/uport-project/veramo/issues/947)\n* **date-store-json:** add JSON object storage implementation ([#819](https://github.com/uport-project/veramo/issues/819)) ([934b34a](https://github.com/uport-project/veramo/commit/934b34a18b194928f90e7797289cc6f2243789ec))\n* update did-discover-provider to search by DID likeness in addition to name ([3696a7a](https://github.com/uport-project/veramo/commit/3696a7aa275e97de0cd1048a7d32ead57abf9e7c))\n\n\n### BREAKING CHANGES\n\n* the `did-resolver` and connected libraries change the data-type for `ServiceEndpoint` to `Service` and the previous semantic has changed. Services can have multiple endpoints, not just a single string.\n\n\n\n\n\n## [3.1.4](https://github.com/uport-project/veramo/compare/v3.1.3...v3.1.4) (2022-06-02)\n\n\n### Bug Fixes\n\n* **deps:** bump sqlite3 to 5.0.8 to enable build on apple M1 chips ([#911](https://github.com/uport-project/veramo/issues/911)) ([daeadb7](https://github.com/uport-project/veramo/commit/daeadb7ce5a86a5ef01e1b1d507133f11fb35d29))\n\n\n\n\n\n## [3.1.3](https://github.com/uport-project/veramo/compare/v3.1.2...v3.1.3) (2022-06-01)\n\n**Note:** Version bump only for package @veramo/data-store\n\n\n\n\n\n# [3.1.0](https://github.com/uport-project/veramo/compare/v3.0.0...v3.1.0) (2021-11-12)\n\n\n### Bug Fixes\n\n* **data-store:** add support for entityPrefix ([#725](https://github.com/uport-project/veramo/issues/725)) ([801bb95](https://github.com/uport-project/veramo/commit/801bb95ddd22abaa61c938b025834132d4e8d3be)), closes [#724](https://github.com/uport-project/veramo/issues/724)\n* **deps:** update all non-major dependencies ([a6614e8](https://github.com/uport-project/veramo/commit/a6614e8ba9b34c6fdb7a9e3960b6fa20090ce44a))\n\n\n### Features\n\n* **did-comm:** didcomm messaging using did:ethr ([#744](https://github.com/uport-project/veramo/issues/744)) ([1be5e04](https://github.com/uport-project/veramo/commit/1be5e04e09112c0823d776fe2d55117d71a7b448)), closes [#743](https://github.com/uport-project/veramo/issues/743)\n\n\n\n\n\n# [3.0.0](https://github.com/uport-project/veramo/compare/v2.1.3...v3.0.0) (2021-09-20)\n\n\n### Features\n\n* **data-store:** initialize DB using migrations ([#679](https://github.com/uport-project/veramo/issues/679)) ([41f6240](https://github.com/uport-project/veramo/commit/41f6240d68a79338772230cbfff768189ab031ed)), closes [#676](https://github.com/uport-project/veramo/issues/676)\n* **key-manager:** move private key storage to kms-local ([#661](https://github.com/uport-project/veramo/issues/661)) ([6b1d135](https://github.com/uport-project/veramo/commit/6b1d135eedb1c58b715be8941d34312da39facb2)), closes [#539](https://github.com/uport-project/veramo/issues/539) [#540](https://github.com/uport-project/veramo/issues/540) [#680](https://github.com/uport-project/veramo/issues/680)\n\n\n### BREAKING CHANGES\n\n* **key-manager:** `keyManagetGet` no longer returns private key data\n* **key-manager:** `KeyStore` no longer requires a `SecretBox`\n* **key-manager:** `KeyManagementSystem` needs a `PrivateKeyStore`\n* **key-manager:** @veramo/cli configuration version update to 3.0\n\nIf you're already working with Veramo and wish to upgrade existing agents to veramo 3.0, you'll have to make some changes to your configuration, depending on how you're using the framework.\n\nIt boils down to these 3 steps:\n\n1. Update your database connection to use migrations\n2. Remove the `SecretBox` parameter from `KeyManager`\n3. Add a `PrivateKeyStore` parameter to `KeyManagementSystem` with a `SecretBox` that you were using before with `KeyManager` (and keep the same encryption key)\n\n* feat(key-manager): move private key storage to kms-local\n* **data-store:** database needs migrations for initialization. See #679 #676\nThe `@veramo/data-store` package relies on `typeorm` as a database abstraction.\nTypeorm has a connection flag `synchonize` which bootstraps the database along with schema and relations based on a set of `Entities` (annotated typescript classes).\nThis is very handy for fast development iterations but it is **not recommended for production** use because there is too much ambiguity possible when the `Entities` change, and there is a risk of data loss.\nThe recommended way to do things is to use the `migrations` mechanism. It allows you to migrate to new database schemas when necessary, and even customize the database to your own needs.\n\n**Going forward, this is the mechanism we will be recommending for connections.**\n\n\n\n\n\n# [2.1.0](https://github.com/uport-project/veramo/compare/v2.0.1...v2.1.0) (2021-08-11)\n\n\n### Bug Fixes\n\n* **credentials-w3c:** accept Presentations without Credentials ([#616](https://github.com/uport-project/veramo/issues/616)) ([2389cd0](https://github.com/uport-project/veramo/commit/2389cd0df080e968ee320d66fabf2e8a7b51ba47))\n* dataStoreDeleteVerifiableCredential ([#652](https://github.com/uport-project/veramo/issues/652)) ([840d89b](https://github.com/uport-project/veramo/commit/840d89ba097b89c061c9206057e05bd2e3d3a630)), closes [#649](https://github.com/uport-project/veramo/issues/649)\n\n\n### Features\n\n* **data-store:** delete verifiable credential ([#634](https://github.com/uport-project/veramo/issues/634)) ([c7b0131](https://github.com/uport-project/veramo/commit/c7b0131c94e21c5c6800990c5743418b6b135a30)), closes [#635](https://github.com/uport-project/veramo/issues/635)\n\n\n\n\n\n# [2.0.0](https://github.com/uport-project/veramo/compare/v1.2.2...v2.0.0) (2021-07-14)\n\n\n### Bug Fixes\n\n* **kms-local:** replace buggy didcomm clone with did jwt implementation ([#548](https://github.com/uport-project/veramo/issues/548)) ([9dea353](https://github.com/uport-project/veramo/commit/9dea3533c1936d53c1d5674c358679b17d623af2)), closes [#538](https://github.com/uport-project/veramo/issues/538)\n\n\n### Features\n\n* **did-discovery:** implement a DID discovery plugin with simple providers ([#597](https://github.com/uport-project/veramo/issues/597)) ([6f01df3](https://github.com/uport-project/veramo/commit/6f01df38a732ba314d1e60728d65f511d26bfdcb))\n* **key-manager:** add generic signing capabilities ([#529](https://github.com/uport-project/veramo/issues/529)) ([5f10a1b](https://github.com/uport-project/veramo/commit/5f10a1bcea214cb593de12fa6ec3a91b3cb712bb)), closes [#522](https://github.com/uport-project/veramo/issues/522)\n\n\n### BREAKING CHANGES\n\n* **kms-local:** `@veramo/kms-local-react-native` is no more. On react-native, please use `@veramo/kms-local` instead, combined with `@ethersproject/shims`\n\n\n\n\n\n# [1.2.0](https://github.com/uport-project/veramo/compare/v1.1.2...v1.2.0) (2021-04-27)\n\n**Note:** Version bump only for package @veramo/data-store\n\n\n\n\n\n## [1.1.2](https://github.com/uport-project/veramo/compare/v1.1.1...v1.1.2) (2021-04-26)\n\n\n### Bug Fixes\n\n* add names to TypeORM entities ([#480](https://github.com/uport-project/veramo/issues/480)) ([750bfcf](https://github.com/uport-project/veramo/commit/750bfcf825b3d18080f7bf308b3a33a4da71a5eb))\n\n\n\n\n\n# [1.1.0](https://github.com/uport-project/veramo/compare/v1.0.1...v1.1.0) (2021-01-26)\n\n\n### Bug Fixes\n\n* make privateKey property of Key entity nullable ([#342](https://github.com/uport-project/veramo/issues/342)) ([aa48ed9](https://github.com/uport-project/veramo/commit/aa48ed9930395c66aa8f952b8545c9b918e303ae))\n\n\n\n\n\n## 1.0.1 (2020-12-18)\n\n**Note:** Version bump only for package @veramo/data-store\n"
  },
  {
    "path": "packages/data-store/LICENSE",
    "content": "                                 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 2019 Consensys AG\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"
  },
  {
    "path": "packages/data-store/README.md",
    "content": "# Veramo data store\n\nVeramo data storage based on TypeORM.\nThis package provides several plugins that relate to data storage.\n\n### `DataStore`\nA plugin that exposes simple store/get methods for messages, credentials and presentations.\n\n### `DataStoreORM`\nA plugin that provides more querying options using TypeORM.\n\n### `KeyStore` and `DIDStore`\n\nImplementations of `AbstractKeyStore` and `AbstractDIDStore`\n"
  },
  {
    "path": "packages/data-store/api-extractor.json",
    "content": "{\n  \"$schema\": \"https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json\",\n  \"apiReport\": {\n    \"enabled\": true,\n    \"reportFolder\": \"./api\",\n    \"reportTempFolder\": \"./api\"\n  },\n\n  \"docModel\": {\n    \"enabled\": true,\n    \"apiJsonFilePath\": \"./api/<unscopedPackageName>.api.json\"\n  },\n\n  \"dtsRollup\": {\n    \"enabled\": false\n  },\n  \"mainEntryPointFilePath\": \"<projectFolder>/build/index.d.ts\"\n}\n"
  },
  {
    "path": "packages/data-store/package.json",
    "content": "{\n  \"name\": \"@veramo/data-store\",\n  \"description\": \"Veramo data storage plugin based on TypeORM database drivers\",\n  \"version\": \"7.0.0\",\n  \"main\": \"build/index.js\",\n  \"types\": \"build/index.d.ts\",\n  \"scripts\": {\n    \"build\": \"tsc\",\n    \"extract-api\": \"node ../cli/bin/veramo.js dev extract-api\"\n  },\n  \"dependencies\": {\n    \"@veramo/core-types\": \"workspace:^\",\n    \"@veramo/did-discovery\": \"workspace:^\",\n    \"@veramo/did-manager\": \"workspace:^\",\n    \"@veramo/key-manager\": \"workspace:^\",\n    \"@veramo/utils\": \"workspace:^\",\n    \"debug\": \"^4.3.3\",\n    \"did-jwt-vc\": \"^4.0.0\",\n    \"typeorm\": \"^0.3.20\",\n    \"uuid\": \"^11.0.0\"\n  },\n  \"devDependencies\": {\n    \"@types/debug\": \"4.1.8\",\n    \"@types/uuid\": \"9.0.2\",\n    \"sqlite3\": \"5.1.7\",\n    \"typescript\": \"5.7.3\"\n  },\n  \"files\": [\n    \"build/**/*\",\n    \"src/**/*\",\n    \"README.md\",\n    \"LICENSE\"\n  ],\n  \"publishConfig\": {\n    \"access\": \"public\"\n  },\n  \"repository\": {\n    \"type\": \"git\",\n    \"url\": \"https://github.com/decentralized-identity/veramo.git\",\n    \"directory\": \"packages/data-store\"\n  },\n  \"author\": \"Consensys Mesh R&D <hello@veramo.io>\",\n  \"contributors\": [\n    \"Simonas Karuzas <simonas.karuzas@mesh.xyz>\",\n    \"Mircea Nistor <mircea.nistor@mesh.xyz>\"\n  ],\n  \"keywords\": [\n    \"Veramo\",\n    \"DID\",\n    \"Verifiable Credential\",\n    \"data store\",\n    \"TypeORM\",\n    \"database\",\n    \"veramo-plugin\"\n  ],\n  \"license\": \"Apache-2.0\",\n  \"type\": \"module\"\n}\n"
  },
  {
    "path": "packages/data-store/src/__tests__/data-store-orm.test.ts",
    "content": "// noinspection ES6PreferShortImport\n\nimport {\n  FindArgs,\n  IDataStore,\n  IDataStoreORM,\n  IMessage,\n  TAgent,\n  TCredentialColumns,\n  TMessageColumns,\n  TPresentationColumns,\n  VerifiableCredential,\n  VerifiablePresentation,\n} from '../../../core-types/src'\nimport { Agent } from '../../../core/src'\nimport { DataSource } from 'typeorm'\nimport { DataStoreORM } from '../data-store-orm.js'\nimport { DataStore } from '../data-store.js'\nimport { Entities } from '../index.js'\nimport * as fs from 'fs'\n\nconst did1 = 'did:test:111'\nconst did2 = 'did:test:222'\nconst did3 = 'did:test:333'\nconst did4 = 'did:test:444'\n\nasync function populateDB(agent: TAgent<IDataStore & IDataStoreORM>) {\n  const vc1: VerifiableCredential = {\n    '@context': ['https://www.w3.org/2018/credentials/v1323', 'https://www.w3.org/2020/demo/4342323'],\n    type: ['VerifiableCredential', 'PublicProfile'],\n    issuer: { id: did1 },\n    issuanceDate: new Date().toISOString(),\n    id: 'vc1',\n    credentialSubject: {\n      id: did2,\n      name: 'Alice',\n      profilePicture: 'https://example.com/a.png',\n      address: {\n        street: 'Some str.',\n        house: 1,\n      },\n    },\n    proof: {\n      jwt: 'mockJWT',\n    },\n  }\n\n  const vp1: VerifiablePresentation = {\n    '@context': ['https://www.w3.org/2018/credentials/v1323', 'https://www.w3.org/2020/demo/4342323'],\n    type: ['VerifiablePresentation', 'PublicProfile'],\n    holder: did1,\n    verifier: [did2],\n    issuanceDate: new Date().toISOString(),\n    verifiableCredential: [vc1],\n    proof: {\n      jwt: 'mockJWT',\n    },\n  }\n\n  const vp2: VerifiablePresentation = {\n    '@context': ['https://www.w3.org/2018/credentials/v1323', 'https://www.w3.org/2020/demo/4342323'],\n    type: ['VerifiablePresentation', 'PublicProfileMultiAudience'],\n    holder: did1,\n    verifier: [did2, did4],\n    issuanceDate: new Date().toISOString(),\n    verifiableCredential: [vc1],\n    proof: {\n      jwt: 'mockJWT',\n    },\n  }\n\n  const m1: IMessage = {\n    id: 'm1',\n    from: did1,\n    to: did2,\n    createdAt: '2020-06-16T11:06:51.680Z',\n    type: 'mock',\n    raw: 'mock',\n    credentials: [vc1],\n    presentations: [vp1],\n  }\n\n  const m2: IMessage = {\n    id: 'm2',\n    from: did1,\n    to: did1,\n    createdAt: '2020-06-16T11:07:51.680Z',\n    type: 'mock',\n    raw: 'mock234',\n  }\n\n  const m3: IMessage = {\n    id: 'm3',\n    from: did3,\n    to: did2,\n    createdAt: '2020-06-16T11:08:51.680Z',\n    type: 'mock',\n    raw: 'mock678',\n  }\n\n  const m4: IMessage = {\n    id: 'm4',\n    from: did1,\n    to: did2,\n    createdAt: '2020-06-16T11:09:51.680Z',\n    type: 'mock',\n    raw: 'mockmoreaudienct',\n    credentials: [vc1],\n    presentations: [vp2],\n  }\n  await agent.dataStoreSaveMessage({ message: m1 })\n  await agent.dataStoreSaveMessage({ message: m2 })\n  await agent.dataStoreSaveMessage({ message: m3 })\n  await agent.dataStoreSaveMessage({ message: m4 })\n}\n\ndescribe('@veramo/data-store queries', () => {\n  let dbConnection: Promise<DataSource>\n  const databaseFile = './tmp/test-db2.sqlite'\n\n  function makeAgent(context?: Record<string, any>): TAgent<IDataStore & IDataStoreORM> {\n    // @ts-ignore\n    return new Agent({\n      context,\n      plugins: [new DataStore(dbConnection), new DataStoreORM(dbConnection)],\n    })\n  }\n\n  beforeAll(async () => {\n    dbConnection = new DataSource({\n      type: 'sqlite',\n      database: databaseFile,\n      entities: Entities,\n    }).initialize()\n  })\n\n  beforeEach(async () => {\n    await (await dbConnection).dropDatabase()\n    await (await dbConnection).synchronize()\n    await populateDB(makeAgent())\n  })\n\n  afterAll(async () => {\n    ;(await dbConnection).close()\n    fs.unlinkSync(databaseFile)\n  })\n\n  test('search presentations by verifier', async () => {\n    const agent = makeAgent()\n    const args: FindArgs<TPresentationColumns> = {\n      where: [\n        {\n          column: 'verifier',\n          value: [did4],\n          op: 'In',\n        },\n      ],\n    }\n\n    let presentations = await makeAgent().dataStoreORMGetVerifiablePresentations(args)\n    expect(presentations.length).toBe(1)\n    let count = await makeAgent().dataStoreORMGetVerifiablePresentationsCount(args)\n    expect(count).toBe(1)\n    // search when authenticated as the issuer\n    let authorizedDID = did1\n\n    presentations = await makeAgent({ authorizedDID }).dataStoreORMGetVerifiablePresentations(args)\n    expect(presentations.length).toBe(1)\n    count = await makeAgent({ authorizedDID }).dataStoreORMGetVerifiablePresentationsCount(args)\n    expect(count).toBe(1)\n\n    // search when authenticated as another did\n    authorizedDID = did3\n\n    presentations = await makeAgent({ authorizedDID }).dataStoreORMGetVerifiablePresentations(args)\n    expect(presentations.length).toBe(0)\n    count = await makeAgent({ authorizedDID }).dataStoreORMGetVerifiablePresentationsCount(args)\n    expect(count).toBe(0)\n  })\n\n  test('without auth it fetches all messages that match the query', async () => {\n    const args: FindArgs<TMessageColumns> = {\n      where: [\n        {\n          column: 'type',\n          value: ['mock'],\n          op: 'In',\n        },\n      ],\n    }\n\n    const messages = await makeAgent().dataStoreORMGetMessages(args)\n    expect(messages.length).toBe(4)\n\n    const count = await makeAgent().dataStoreORMGetMessagesCount(args)\n    expect(count).toBe(4)\n  })\n\n  test('with auth it only gets messages for the authorized identifier', async () => {\n    const args: FindArgs<TMessageColumns> = {\n      where: [\n        {\n          column: 'type',\n          value: ['mock'],\n          op: 'In',\n        },\n      ],\n    }\n    const authorizedDID = did1\n\n    const messages = await makeAgent({ authorizedDID }).dataStoreORMGetMessages(args)\n    expect(messages.length).toBe(3)\n    const count = await makeAgent({ authorizedDID }).dataStoreORMGetMessagesCount(args)\n    expect(count).toBe(3)\n  })\n\n  test('supports ordering', async () => {\n    const agent = makeAgent()\n    const args: FindArgs<TMessageColumns> = {\n      where: [\n        {\n          column: 'type',\n          value: ['mock'],\n          op: 'In',\n        },\n      ],\n      order: [\n        {\n          column: 'createdAt',\n          direction: 'DESC',\n        },\n      ],\n    }\n\n    const messages = await agent.dataStoreORMGetMessages(args)\n    expect(new Date('' + messages[0].createdAt).getTime()).toBeGreaterThan(\n      new Date('' + messages[1].createdAt).getTime(),\n    )\n\n    const args2: FindArgs<TMessageColumns> = {\n      where: [\n        {\n          column: 'type',\n          value: ['mock'],\n          op: 'In',\n        },\n      ],\n      order: [\n        {\n          column: 'createdAt',\n          direction: 'ASC',\n        },\n      ],\n    }\n\n    const messages2 = await agent.dataStoreORMGetMessages(args2)\n    expect(new Date('' + messages2[0].createdAt).getTime()).toBeLessThan(\n      new Date('' + messages2[1].createdAt).getTime(),\n    )\n  })\n\n  test('works with relations', async () => {\n    const credentials = await makeAgent().dataStoreORMGetVerifiableCredentialsByClaims({})\n    expect(credentials.length).toBe(1)\n    expect(credentials[0].verifiableCredential.id).toBe('vc1')\n    const count = await makeAgent().dataStoreORMGetVerifiableCredentialsByClaimsCount({})\n    expect(count).toBe(3)\n\n    const credentials2 = await makeAgent({\n      authorizedDID: did3,\n    }).dataStoreORMGetVerifiableCredentialsByClaims({})\n    expect(credentials2.length).toBe(0)\n    const count2 = await makeAgent({\n      authorizedDID: did3,\n    }).dataStoreORMGetVerifiableCredentialsByClaimsCount({})\n    expect(count2).toBe(0)\n  })\n\n  test('multiple audience members can retrieve a credential', async () => {\n    const args: FindArgs<TPresentationColumns> = {\n      where: [\n        {\n          column: 'type',\n          value: ['VerifiablePresentation,PublicProfileMultiAudience'],\n          op: 'Equal',\n        },\n      ],\n    }\n\n    let presentations = await makeAgent({ authorizedDID: did1 }).dataStoreORMGetVerifiablePresentations(args)\n    expect(presentations.length).toBe(1)\n\n    presentations = await makeAgent({ authorizedDID: did2 }).dataStoreORMGetVerifiablePresentations(args)\n    expect(presentations.length).toBe(1)\n\n    presentations = await makeAgent({ authorizedDID: did4 }).dataStoreORMGetVerifiablePresentations(args)\n    expect(presentations.length).toBe(1)\n\n    presentations = await makeAgent({ authorizedDID: did3 }).dataStoreORMGetVerifiablePresentations(args)\n    expect(presentations.length).toBe(0)\n  })\n\n  test('store credential and retrieve by id', async () => {\n    const vc5: VerifiableCredential = {\n      '@context': ['https://www.w3.org/2018/credentials/v1323', 'https://www.w3.org/2020/demo/4342323'],\n      type: ['VerifiableCredential', 'PublicProfile'],\n      issuer: { id: did1 },\n      issuanceDate: new Date().toISOString(),\n      id: 'vc5',\n      credentialSubject: {\n        id: did2,\n        name: 'Alice',\n        profilePicture: 'https://example.com/a.png',\n        address: {\n          street: 'Some str.',\n          house: 1,\n        },\n      },\n      proof: {\n        jwt: 'mockJWT',\n      },\n    }\n\n    const agent = makeAgent()\n    await agent.dataStoreSaveVerifiableCredential({ verifiableCredential: vc5 })\n\n    const args: FindArgs<TCredentialColumns> = {\n      where: [\n        {\n          column: 'id',\n          value: ['vc5'],\n        },\n      ],\n      order: [{ column: 'issuanceDate', direction: 'DESC' }],\n    }\n\n    const credentials = await agent.dataStoreORMGetVerifiableCredentials(args)\n    expect(credentials[0].verifiableCredential.id).toEqual('vc5')\n    const count = await agent.dataStoreORMGetVerifiableCredentialsCount(args)\n    expect(count).toEqual(1)\n  })\n\n  test('store presentation and retrieve by context and type', async () => {\n    const vc6: VerifiableCredential = {\n      '@context': ['https://www.w3.org/2018/credentials/v1323', 'https://www.w3.org/2020/demo/666'],\n      type: ['VerifiableCredential', 'PublicProfile6'],\n      issuer: { id: did1 },\n      issuanceDate: new Date().toISOString(),\n      id: 'vc6',\n      credentialSubject: {\n        id: did2,\n        name: 'Alice',\n        profilePicture: 'https://example.com/a.png',\n        address: {\n          street: 'Some str.',\n          house: 1,\n        },\n      },\n      proof: {\n        jwt: 'mockJWT',\n      },\n    }\n\n    const vp6: VerifiablePresentation = {\n      '@context': ['https://www.w3.org/2018/credentials/v1323', 'https://www.w3.org/2020/demo/99999966666'],\n      type: ['VerifiablePresentation', 'PublicProfile6666'],\n      holder: did1,\n      verifier: [did2],\n      issuanceDate: new Date().toISOString(),\n      verifiableCredential: [vc6],\n      proof: {\n        jwt: 'mockJWT',\n      },\n    }\n\n    const agent = makeAgent()\n    await agent.dataStoreSaveVerifiablePresentation({ verifiablePresentation: vp6 })\n\n    const args: FindArgs<TPresentationColumns> = {\n      where: [\n        {\n          column: 'type',\n          value: ['VerifiablePresentation,PublicProfile6666'],\n        },\n        {\n          column: 'context',\n          value: ['https://www.w3.org/2018/credentials/v1323,https://www.w3.org/2020/demo/99999966666'],\n        },\n      ],\n    }\n\n    const presentations = await agent.dataStoreORMGetVerifiablePresentations(args)\n    const cred0 = presentations[0].verifiablePresentation.verifiableCredential?.[0] as VerifiableCredential\n    expect(cred0.id).toEqual('vc6')\n  })\n\n  it('should query identifiers', async () => {\n    const agent = makeAgent()\n    const identifiers = await agent.dataStoreORMGetIdentifiers()\n    expect(identifiers.length).toEqual(4)\n\n    const count = await agent.dataStoreORMGetIdentifiersCount()\n    expect(count).toEqual(4)\n  })\n})\n"
  },
  {
    "path": "packages/data-store/src/__tests__/entities.test.ts",
    "content": "import { createCredentialEntity, Credential } from '../entities/credential.js'\nimport { createPresentationEntity } from '../entities/presentation.js'\nimport { Claim, Entities, Identifier, Message } from '../index.js'\nimport { DataSource, In } from 'typeorm'\nimport * as fs from 'fs'\nimport { computeEntryHash } from '../../../utils/src'\n\ndescribe('DB entities test', () => {\n  let connection: DataSource\n  const databaseFile = './tmp/test-db.sqlite'\n\n  beforeAll(\n    async () =>\n      (connection = await new DataSource({\n        type: 'sqlite',\n        database: databaseFile,\n        entities: Entities,\n      }).initialize()),\n  )\n\n  beforeEach(async () => {\n    await connection.dropDatabase()\n    await connection.synchronize()\n  })\n\n  afterAll(async () => {\n    await connection.close()\n    fs.unlinkSync(databaseFile)\n  })\n\n  it('Saves identifier to DB', async () => {\n    const identifier = new Identifier()\n    identifier.did = 'did:test:123'\n    await identifier.save()\n\n    const fromDb = await Identifier.findOneBy({ did: identifier.did })\n    expect(fromDb?.did).toEqual(identifier.did)\n  })\n\n  it('Saves credential with claims', async () => {\n    const did1 = 'did:test:111'\n    const did2 = 'did:test:222'\n\n    const entity = createCredentialEntity({\n      '@context': ['https://www.w3.org/2018/credentials/v1323', 'https://www.w3.org/2020/demo/4342323'],\n      type: ['VerifiableCredential', 'PublicProfile'],\n      issuer: { id: did1 },\n      issuanceDate: new Date().toISOString(),\n      credentialSubject: {\n        id: did2,\n        name: 'Alice',\n        profilePicture: 'https://example.com/a.png',\n        address: {\n          street: 'Some str.',\n          house: 1,\n        },\n      },\n      proof: {\n        jwt: 'mockJWT',\n      },\n    })\n    await entity.save()\n\n    const credential = await Credential.findOne({\n      where: { hash: entity.hash },\n      relations: ['issuer', 'subject', 'claims', 'claims.issuer', 'claims.subject'],\n    })\n    expect(credential?.issuer.did).toEqual(did1)\n    expect(credential?.subject?.did).toEqual(did2)\n    expect(credential?.claims.length).toEqual(3)\n    expect(credential?.claims[0]?.issuer?.did).toEqual(did1)\n    expect(credential?.claims[0]?.subject?.did).toEqual(did2)\n  })\n\n  it('Saves message with credentials', async () => {\n    const did1 = 'did:test:111'\n    const did2 = 'did:test:222'\n    const did3 = 'did:test:333'\n\n    const vc = createCredentialEntity({\n      '@context': ['https://www.w3.org/2018/credentials/v1323', 'https://www.w3.org/2020/demo/4342323'],\n      type: ['VerifiableCredential', 'PublicProfile'],\n      issuer: { id: did1 },\n      issuanceDate: new Date().toISOString(),\n      credentialSubject: {\n        id: did2,\n        name: 'Alice',\n        profilePicture: 'https://example.com/a.png',\n        address: {\n          street: 'Some str.',\n          house: 1,\n        },\n      },\n      proof: {\n        jwt: 'mockJWT',\n      },\n    })\n\n    const vp = createPresentationEntity({\n      '@context': ['https://www.w3.org/2018/credentials/v1323', 'https://www.w3.org/2020/demo/4342323'],\n      type: ['VerifiablePresentation', 'PublicProfile'],\n      holder: did1,\n      verifier: [did2],\n      issuanceDate: new Date().toISOString(),\n      verifiableCredential: [vc.raw],\n      proof: {\n        jwt: 'mockJWT',\n      },\n    })\n\n    const vp2 = createPresentationEntity({\n      '@context': ['https://www.w3.org/2018/credentials/v1323', 'https://www.w3.org/2020/demo/4342323'],\n      type: ['VerifiablePresentation', 'PublicProfile'],\n      holder: did1,\n      verifier: [did3],\n      issuanceDate: new Date().toISOString(),\n      verifiableCredential: [vc.raw],\n      proof: {\n        jwt: 'mockJWT',\n      },\n    })\n\n    await vp2.save()\n\n    const m = new Message()\n    m.from = new Identifier()\n    m.from.did = did1\n    m.to = new Identifier()\n    m.to.did = did2\n    m.type = 'mock'\n    m.raw = 'mock'\n    m.createdAt = new Date()\n    m.credentials = [vc]\n    m.presentations = [vp]\n\n    await m.save()\n\n    const message = await Message.findOne({\n      where: { id: m.id },\n      relations: [\n        'credentials',\n        'credentials.issuer',\n        'credentials.subject',\n        'credentials.claims',\n        'presentations',\n        'presentations.credentials',\n      ],\n    })\n\n    expect(message?.credentials.length).toEqual(1)\n    expect(message?.credentials[0].claims.length).toEqual(3)\n    expect(message?.presentations.length).toEqual(1)\n    expect(message?.presentations[0].credentials.length).toEqual(1)\n\n    const claims = await Claim.find({\n      relations: ['credential', 'credential.issuer', 'credential.subject'],\n      where: {\n        issuer: In([did1]),\n        subject: In([did2]),\n        type: 'name',\n      },\n    })\n\n    expect(claims[0].type).toEqual('name')\n    expect(claims[0].value).toEqual('Alice')\n  })\n\n  it('Message can have externally set id', async () => {\n    const customId = computeEntryHash('hash123')\n\n    const message = new Message()\n    message.type = 'custom'\n    message.id = customId\n\n    await message.save()\n\n    const fromDb = await Message.findOneBy({ id: customId })\n\n    expect(fromDb?.id).toEqual(customId)\n    expect(fromDb?.type).toEqual('custom')\n  })\n\n  it('enforces unique alias/provider for an identifier', async () => {\n    const identifier = new Identifier()\n    identifier.did = 'did:test:123'\n    identifier.alias = 'test'\n    identifier.provider = 'testProvider'\n    const id1Result = await identifier.save()\n\n    const identifier2 = new Identifier()\n    identifier2.did = 'did:test:456'\n    identifier2.alias = 'test'\n    identifier2.provider = 'testProvider'\n    await expect(identifier2.save()).rejects.toThrow()\n  })\n})\n"
  },
  {
    "path": "packages/data-store/src/data-store-orm.ts",
    "content": "import {\n  ALLOWED_COLUMNS,\n  AuthorizedDIDContext,\n  FindArgs,\n  IAgentPlugin,\n  IDataStoreORM,\n  IIdentifier,\n  IMessage,\n  PartialIdentifier,\n  TClaimsColumns,\n  TCredentialColumns,\n  TIdentifiersColumns,\n  TMessageColumns,\n  TPresentationColumns,\n  UniqueVerifiableCredential,\n  UniqueVerifiablePresentation,\n  Where,\n} from '@veramo/core-types'\nimport { schema } from '@veramo/core-types'\nimport { createMessage, Message } from './entities/message.js'\nimport { Claim } from './entities/claim.js'\nimport { Credential } from './entities/credential.js'\nimport { Presentation } from './entities/presentation.js'\nimport { Identifier } from './entities/identifier.js'\nimport {\n  Any,\n  Between,\n  Brackets,\n  DataSource,\n  Equal,\n  In,\n  IsNull,\n  LessThan,\n  LessThanOrEqual,\n  Like,\n  MoreThan,\n  MoreThanOrEqual,\n  Not,\n  SelectQueryBuilder,\n} from 'typeorm'\nimport { getConnectedDb } from './utils.js'\nimport { OrPromise } from '@veramo/utils'\n\n/**\n * This class implements the {@link @veramo/core-types#IDataStoreORM} query interface using a TypeORM compatible database.\n *\n * This allows you to filter Verifiable Credentials, Presentations and Messages by some common properties that are\n * parsed and stored in database tables.\n *\n * This class is designed to work with {@link @veramo/data-store#DataStore} which is the default way to populate the\n * database with Credentials, Presentations and Messages in such a way that they can be queried by this class.\n * These two classes MUST also share the same database connection.\n *\n * @see {@link @veramo/core-types#IDataStoreORM}\n * @see {@link @veramo/core-types#IDataStore}\n *\n * @beta This API may change without a BREAKING CHANGE notice.\n */\nexport class DataStoreORM implements IAgentPlugin {\n  readonly methods: IDataStoreORM\n  readonly schema = schema.IDataStoreORM\n  private dbConnection: OrPromise<DataSource>\n\n  constructor(dbConnection: OrPromise<DataSource>) {\n    this.dbConnection = dbConnection\n\n    this.methods = {\n      dataStoreORMGetIdentifiers: this.dataStoreORMGetIdentifiers.bind(this),\n      dataStoreORMGetIdentifiersCount: this.dataStoreORMGetIdentifiersCount.bind(this),\n      dataStoreORMGetMessages: this.dataStoreORMGetMessages.bind(this),\n      dataStoreORMGetMessagesCount: this.dataStoreORMGetMessagesCount.bind(this),\n      dataStoreORMGetVerifiableCredentialsByClaims:\n        this.dataStoreORMGetVerifiableCredentialsByClaims.bind(this),\n      dataStoreORMGetVerifiableCredentialsByClaimsCount:\n        this.dataStoreORMGetVerifiableCredentialsByClaimsCount.bind(this),\n      dataStoreORMGetVerifiableCredentials: this.dataStoreORMGetVerifiableCredentials.bind(this),\n      dataStoreORMGetVerifiableCredentialsCount: this.dataStoreORMGetVerifiableCredentialsCount.bind(this),\n      dataStoreORMGetVerifiablePresentations: this.dataStoreORMGetVerifiablePresentations.bind(this),\n      dataStoreORMGetVerifiablePresentationsCount:\n        this.dataStoreORMGetVerifiablePresentationsCount.bind(this),\n    }\n  }\n\n  // Identifiers\n\n  private async identifiersQuery(\n    args: FindArgs<TIdentifiersColumns>,\n    context?: AuthorizedDIDContext,\n  ): Promise<SelectQueryBuilder<Identifier>> {\n    const where = createWhereObject(args)\n    let qb = (await getConnectedDb(this.dbConnection))\n      .getRepository(Identifier)\n      .createQueryBuilder('identifier')\n      .leftJoinAndSelect('identifier.keys', 'keys')\n      .leftJoinAndSelect('identifier.services', 'services')\n      .where(where)\n    qb = decorateQB(qb, 'message', args)\n    return qb\n  }\n\n  async dataStoreORMGetIdentifiers(\n    args: FindArgs<TIdentifiersColumns>,\n    context: AuthorizedDIDContext,\n  ): Promise<PartialIdentifier[]> {\n    const identifiers = await (await this.identifiersQuery(args)).getMany()\n    return identifiers.map((i) => {\n      const identifier: PartialIdentifier = i as PartialIdentifier\n      if (identifier.controllerKeyId === null) {\n        delete identifier.controllerKeyId\n      }\n      if (identifier.alias === null) {\n        delete identifier.alias\n      }\n      if (identifier.provider === null) {\n        delete identifier.provider\n      }\n      return identifier as IIdentifier\n    })\n  }\n\n  async dataStoreORMGetIdentifiersCount(\n    args: FindArgs<TIdentifiersColumns>,\n    context: AuthorizedDIDContext,\n  ): Promise<number> {\n    return await (await this.identifiersQuery(args, context)).getCount()\n  }\n\n  // Messages\n\n  private async messagesQuery(\n    args: FindArgs<TMessageColumns>,\n    context: AuthorizedDIDContext,\n  ): Promise<SelectQueryBuilder<Message>> {\n    const where = createWhereObject(args)\n    let qb = (await getConnectedDb(this.dbConnection))\n      .getRepository(Message)\n      .createQueryBuilder('message')\n      .leftJoinAndSelect('message.from', 'from')\n      .leftJoinAndSelect('message.to', 'to')\n      .leftJoinAndSelect('message.credentials', 'credentials')\n      .leftJoinAndSelect('message.presentations', 'presentations')\n      .where(where)\n    qb = decorateQB(qb, 'message', args)\n    if (context.authorizedDID) {\n      qb = qb.andWhere(\n        new Brackets((qb) => {\n          qb.where('message.to = :ident', { ident: context.authorizedDID }).orWhere('message.from = :ident', {\n            ident: context.authorizedDID,\n          })\n        }),\n      )\n    }\n    return qb\n  }\n\n  async dataStoreORMGetMessages(\n    args: FindArgs<TMessageColumns>,\n    context: AuthorizedDIDContext,\n  ): Promise<IMessage[]> {\n    const messages = await (await this.messagesQuery(args, context)).getMany()\n    return messages.map(createMessage)\n  }\n\n  async dataStoreORMGetMessagesCount(\n    args: FindArgs<TMessageColumns>,\n    context: AuthorizedDIDContext,\n  ): Promise<number> {\n    return (await this.messagesQuery(args, context)).getCount()\n  }\n\n  // Claims\n\n  private async claimsQuery(\n    args: FindArgs<TClaimsColumns>,\n    context: AuthorizedDIDContext,\n  ): Promise<SelectQueryBuilder<Claim>> {\n    const where = createWhereObject(args)\n    let qb = (await getConnectedDb(this.dbConnection))\n      .getRepository(Claim)\n      .createQueryBuilder('claim')\n      .leftJoinAndSelect('claim.issuer', 'issuer')\n      .leftJoinAndSelect('claim.subject', 'subject')\n      .where(where)\n    qb = decorateQB(qb, 'claim', args)\n    qb = qb.leftJoinAndSelect('claim.credential', 'credential')\n    if (context.authorizedDID) {\n      qb = qb.andWhere(\n        new Brackets((qb) => {\n          qb.where('claim.subject = :ident', { ident: context.authorizedDID }).orWhere(\n            'claim.issuer = :ident',\n            {\n              ident: context.authorizedDID,\n            },\n          )\n        }),\n      )\n    }\n    return qb\n  }\n\n  async dataStoreORMGetVerifiableCredentialsByClaims(\n    args: FindArgs<TClaimsColumns>,\n    context: AuthorizedDIDContext,\n  ): Promise<Array<UniqueVerifiableCredential>> {\n    const claims = await (await this.claimsQuery(args, context)).getMany()\n    return claims\n      .map((claim) => ({\n        hash: claim.credential.hash,\n        verifiableCredential: claim.credential.raw,\n      }))\n      .reduce((acc: UniqueVerifiableCredential[], current: UniqueVerifiableCredential) => {\n        if (!acc.some((item) => item.hash === current.hash)) {\n          acc.push(current)\n        }\n        return acc\n      }, [])\n  }\n\n  async dataStoreORMGetVerifiableCredentialsByClaimsCount(\n    args: FindArgs<TClaimsColumns>,\n    context: AuthorizedDIDContext,\n  ): Promise<number> {\n    return (await this.claimsQuery(args, context)).getCount()\n  }\n\n  // Credentials\n\n  private async credentialsQuery(\n    args: FindArgs<TCredentialColumns>,\n    context: AuthorizedDIDContext,\n  ): Promise<SelectQueryBuilder<Credential>> {\n    const where = createWhereObject(args)\n    let qb = (await getConnectedDb(this.dbConnection))\n      .getRepository(Credential)\n      .createQueryBuilder('credential')\n      .leftJoinAndSelect('credential.issuer', 'issuer')\n      .leftJoinAndSelect('credential.subject', 'subject')\n      .where(where)\n    qb = decorateQB(qb, 'credential', args)\n    if (context.authorizedDID) {\n      qb = qb.andWhere(\n        new Brackets((qb) => {\n          qb.where('credential.subject = :ident', { ident: context.authorizedDID }).orWhere(\n            'credential.issuer = :ident',\n            {\n              ident: context.authorizedDID,\n            },\n          )\n        }),\n      )\n    }\n    return qb\n  }\n\n  async dataStoreORMGetVerifiableCredentials(\n    args: FindArgs<TCredentialColumns>,\n    context: AuthorizedDIDContext,\n  ): Promise<Array<UniqueVerifiableCredential>> {\n    const credentials = await (await this.credentialsQuery(args, context)).getMany()\n    return credentials.map((vc) => ({\n      hash: vc.hash,\n      verifiableCredential: vc.raw,\n    }))\n  }\n\n  async dataStoreORMGetVerifiableCredentialsCount(\n    args: FindArgs<TCredentialColumns>,\n    context: AuthorizedDIDContext,\n  ): Promise<number> {\n    return (await this.credentialsQuery(args, context)).getCount()\n  }\n\n  // Presentations\n\n  private async presentationsQuery(\n    args: FindArgs<TPresentationColumns>,\n    context: AuthorizedDIDContext,\n  ): Promise<SelectQueryBuilder<Presentation>> {\n    const where = createWhereObject(args)\n    let qb = (await getConnectedDb(this.dbConnection))\n      .getRepository(Presentation)\n      .createQueryBuilder('presentation')\n      .leftJoinAndSelect('presentation.holder', 'holder')\n      .leftJoinAndSelect('presentation.verifier', 'verifier')\n      .where(where)\n    qb = decorateQB(qb, 'presentation', args)\n    qb = addVerifierQuery(args, qb)\n    if (context.authorizedDID) {\n      qb = qb.andWhere(\n        new Brackets((qb) => {\n          qb.where('verifier.did = :ident', {\n            ident: context.authorizedDID,\n          }).orWhere('presentation.holder = :ident', { ident: context.authorizedDID })\n        }),\n      )\n    }\n    return qb\n  }\n\n  async dataStoreORMGetVerifiablePresentations(\n    args: FindArgs<TPresentationColumns>,\n    context: AuthorizedDIDContext,\n  ): Promise<Array<UniqueVerifiablePresentation>> {\n    const presentations = await (await this.presentationsQuery(args, context)).getMany()\n    return presentations.map((vp) => ({\n      hash: vp.hash,\n      verifiablePresentation: vp.raw,\n    }))\n  }\n\n  async dataStoreORMGetVerifiablePresentationsCount(\n    args: FindArgs<TPresentationColumns>,\n    context: AuthorizedDIDContext,\n  ): Promise<number> {\n    return (await this.presentationsQuery(args, context)).getCount()\n  }\n}\n\nfunction opToSQL(item: Where<any>): any[] {\n  switch (item.op) {\n    case 'IsNull':\n      return ['IS NULL', '']\n    case 'Like':\n      if (item.value?.length != 1) throw Error('Operation Equal requires one value')\n      return ['LIKE :value', item.value[0]]\n    case 'Equal':\n      if (item.value?.length != 1) throw Error('Operation Equal requires one value')\n      return ['= :value', item.value[0]]\n    case 'Any':\n    case 'Between':\n    case 'LessThan':\n    case 'LessThanOrEqual':\n    case 'MoreThan':\n    case 'MoreThanOrEqual':\n      throw new Error(`${item.op} not compatible with DID argument`)\n    case 'In':\n    default:\n      return ['IN (:...value)', item.value]\n  }\n}\n\nfunction addVerifierQuery(input: FindArgs<any>, qb: SelectQueryBuilder<any>): SelectQueryBuilder<any> {\n  if (!input) {\n    return qb\n  }\n  if (!Array.isArray(input.where)) {\n    return qb\n  }\n  const verifierWhere = input.where.find((item) => item.column === 'verifier')\n  if (!verifierWhere) {\n    return qb\n  }\n  const [op, value] = opToSQL(verifierWhere)\n  return qb.andWhere(`verifier.did ${op}`, { value })\n}\n\nfunction createWhereObject(\n  input: FindArgs<\n    TMessageColumns | TClaimsColumns | TCredentialColumns | TPresentationColumns | TIdentifiersColumns\n  >,\n): any {\n  const where: Record<string, any> = {}\n  if (input?.where) {\n    for (const item of input.where) {\n      if (item.column === 'verifier') {\n        continue\n      }\n      switch (item.op) {\n        case 'Any':\n          if (!Array.isArray(item.value)) throw Error('Operator Any requires value to be an array')\n          where[item.column] = Any(item.value)\n          break\n        case 'Between':\n          if (item.value?.length != 2) throw Error('Operation Between requires two values')\n          where[item.column] = Between(item.value[0], item.value[1])\n          break\n        case 'Equal':\n          if (item.value?.length != 1) throw Error('Operation Equal requires one value')\n          where[item.column] = Equal(item.value[0])\n          break\n        case 'IsNull':\n          where[item.column] = IsNull()\n          break\n        case 'LessThan':\n          if (item.value?.length != 1) throw Error('Operation LessThan requires one value')\n          where[item.column] = LessThan(item.value[0])\n          break\n        case 'LessThanOrEqual':\n          if (item.value?.length != 1) throw Error('Operation LessThanOrEqual requires one value')\n          where[item.column] = LessThanOrEqual(item.value[0])\n          break\n        case 'Like':\n          if (item.value?.length != 1) throw Error('Operation Like requires one value')\n          where[item.column] = Like(item.value[0])\n          break\n        case 'MoreThan':\n          if (item.value?.length != 1) throw Error('Operation MoreThan requires one value')\n          where[item.column] = MoreThan(item.value[0])\n          break\n        case 'MoreThanOrEqual':\n          if (item.value?.length != 1) throw Error('Operation MoreThanOrEqual requires one value')\n          where[item.column] = MoreThanOrEqual(item.value[0])\n          break\n        case 'In':\n        default:\n          if (!Array.isArray(item.value)) throw Error('Operator IN requires value to be an array')\n          where[item.column] = In(item.value)\n      }\n      if (item.not === true) {\n        where[item.column] = Not(where[item.column])\n      }\n    }\n  }\n  return where\n}\n\nfunction decorateQB(\n  qb: SelectQueryBuilder<any>,\n  tableName: string,\n  input: FindArgs<any>,\n): SelectQueryBuilder<any> {\n  if (input?.skip) qb = qb.offset(input.skip)\n  if (input?.take) qb = qb.limit(input.take)\n\n  if (input?.order) {\n    const allowedColumns = getAllowedColumnsForTable(tableName)\n    for (const item of input.order) {\n      if (!allowedColumns.includes(item.column)) {\n        throw new Error(`Invalid column name: ${item.column}`)\n      }\n      qb = qb.addSelect(\n        qb.connection.driver.escape(tableName) + '.' + qb.connection.driver.escape(item.column),\n        item.column,\n      )\n      qb = qb.orderBy(qb.connection.driver.escape(item.column), item.direction)\n    }\n  }\n  return qb\n}\n\nfunction getAllowedColumnsForTable(tableName: string): readonly string[] {\n  return ALLOWED_COLUMNS[tableName as keyof typeof ALLOWED_COLUMNS] || []\n}\n"
  },
  {
    "path": "packages/data-store/src/data-store.ts",
    "content": "import {\n  IAgentPlugin,\n  IDataStore,\n  IDataStoreDeleteVerifiableCredentialArgs,\n  IDataStoreGetMessageArgs,\n  IDataStoreDeleteMessageArgs,\n  IDataStoreGetVerifiableCredentialArgs,\n  IDataStoreGetVerifiablePresentationArgs,\n  IDataStoreSaveMessageArgs,\n  IDataStoreSaveVerifiableCredentialArgs,\n  IDataStoreSaveVerifiablePresentationArgs,\n  IMessage,\n  VerifiableCredential,\n  VerifiablePresentation,\n} from '@veramo/core-types'\nimport { schema } from '@veramo/core-types'\nimport { createMessage, createMessageEntity, Message } from './entities/message.js'\nimport { createCredentialEntity, Credential } from './entities/credential.js'\nimport { Claim } from './entities/claim.js'\nimport { createPresentationEntity, Presentation } from './entities/presentation.js'\nimport { DataSource } from 'typeorm'\nimport { getConnectedDb } from './utils.js'\nimport { OrPromise } from '@veramo/utils'\n\n/**\n * This class implements the {@link @veramo/core-types#IDataStore} interface using a TypeORM compatible database.\n *\n * This allows you to store and retrieve Verifiable Credentials, Presentations and Messages by their IDs.\n *\n * For more complex queries you should use {@link @veramo/data-store#DataStoreORM} which is the default way to query\n * the stored data by some common properties. These two classes MUST also share the same database connection.\n *\n * @see {@link @veramo/core-types#IDataStoreORM}\n * @see {@link @veramo/core-types#IDataStore}\n *\n * @beta This API may change without a BREAKING CHANGE notice.\n */\nexport class DataStore implements IAgentPlugin {\n  readonly methods: IDataStore\n  readonly schema = schema.IDataStore\n  private dbConnection: OrPromise<DataSource>\n\n  constructor(dbConnection: OrPromise<DataSource>) {\n    this.dbConnection = dbConnection\n\n    this.methods = {\n      dataStoreSaveMessage: this.dataStoreSaveMessage.bind(this),\n      dataStoreGetMessage: this.dataStoreGetMessage.bind(this),\n      dataStoreDeleteMessage: this.dataStoreDeleteMessage.bind(this),\n      dataStoreDeleteVerifiableCredential: this.dataStoreDeleteVerifiableCredential.bind(this),\n      dataStoreSaveVerifiableCredential: this.dataStoreSaveVerifiableCredential.bind(this),\n      dataStoreGetVerifiableCredential: this.dataStoreGetVerifiableCredential.bind(this),\n      dataStoreSaveVerifiablePresentation: this.dataStoreSaveVerifiablePresentation.bind(this),\n      dataStoreGetVerifiablePresentation: this.dataStoreGetVerifiablePresentation.bind(this),\n    }\n  }\n\n  async dataStoreSaveMessage(args: IDataStoreSaveMessageArgs): Promise<string> {\n    const message = await (await getConnectedDb(this.dbConnection))\n      .getRepository(Message)\n      .save(createMessageEntity(args.message))\n    return message.id\n  }\n\n  async dataStoreGetMessage(args: IDataStoreGetMessageArgs): Promise<IMessage> {\n    const [messageEntity] = await (await getConnectedDb(this.dbConnection)).getRepository(Message).find({\n      where: { id: args.id },\n      relations: ['credentials', 'presentations'],\n    })\n    if (!messageEntity) throw new Error('not_found: Message not found')\n\n    return createMessage(messageEntity)\n  }\n\n  async dataStoreDeleteMessage(args: IDataStoreDeleteMessageArgs): Promise<boolean> {\n    const [messageEntity] = await (await getConnectedDb(this.dbConnection)).getRepository(Message).find({\n      where: { id: args.id },\n      relations: ['credentials', 'presentations'],\n    })\n    if (!messageEntity) {\n      return false\n    }\n\n    await (await getConnectedDb(this.dbConnection)).getRepository(Message).remove(messageEntity)\n\n    return true\n  }\n\n  async dataStoreDeleteVerifiableCredential(\n    args: IDataStoreDeleteVerifiableCredentialArgs,\n  ): Promise<boolean> {\n    const credentialEntity = await (await getConnectedDb(this.dbConnection))\n      .getRepository(Credential)\n      .findOneBy({ hash: args.hash })\n    if (!credentialEntity) {\n      return false\n    }\n\n    const claims = await (await getConnectedDb(this.dbConnection))\n      .getRepository(Claim)\n      .find({ where: { credential: { hash: credentialEntity.hash } } })\n\n    await (await getConnectedDb(this.dbConnection)).getRepository(Claim).remove(claims)\n\n    await (await getConnectedDb(this.dbConnection)).getRepository(Credential).remove(credentialEntity)\n\n    return true\n  }\n\n  async dataStoreSaveVerifiableCredential(args: IDataStoreSaveVerifiableCredentialArgs): Promise<string> {\n    const verifiableCredential = await (await getConnectedDb(this.dbConnection))\n      .getRepository(Credential)\n      .save(createCredentialEntity(args.verifiableCredential))\n    return verifiableCredential.hash\n  }\n\n  async dataStoreGetVerifiableCredential(\n    args: IDataStoreGetVerifiableCredentialArgs,\n  ): Promise<VerifiableCredential> {\n    const credentialEntity = await (await getConnectedDb(this.dbConnection))\n      .getRepository(Credential)\n      .findOneBy({ hash: args.hash })\n    if (!credentialEntity) throw new Error('not_found: Verifiable credential not found')\n\n    return credentialEntity.raw\n  }\n\n  async dataStoreSaveVerifiablePresentation(args: IDataStoreSaveVerifiablePresentationArgs): Promise<string> {\n    const verifiablePresentation = await (await getConnectedDb(this.dbConnection))\n      .getRepository(Presentation)\n      .save(createPresentationEntity(args.verifiablePresentation))\n    return verifiablePresentation.hash\n  }\n\n  async dataStoreGetVerifiablePresentation(\n    args: IDataStoreGetVerifiablePresentationArgs,\n  ): Promise<VerifiablePresentation> {\n    const presentationEntity = await (await getConnectedDb(this.dbConnection))\n      .getRepository(Presentation)\n      .findOneBy({ hash: args.hash })\n    if (!presentationEntity) throw new Error('not_found: Verifiable presentation not found')\n\n    return presentationEntity.raw\n  }\n}\n"
  },
  {
    "path": "packages/data-store/src/did-discovery-provider.ts",
    "content": "import { IAgentContext, IDataStoreORM } from '@veramo/core-types'\nimport {\n  AbstractDidDiscoveryProvider,\n  IDIDDiscoverMatch,\n  IDIDDiscoveryProviderResult,\n  IDIDDiscoveryDiscoverDidArgs,\n} from '@veramo/did-discovery'\n\n/**\n * This implementation of {@link @veramo/did-discovery#AbstractDidDiscoveryProvider | AbstractDidDiscoveryProvider}\n * helps you discover DIDs based on data that is stored by a local plugin that implements\n * {@link @veramo/core-types#IDataStoreORM | IDataStoreORM}.\n *\n * DIDs can be discovered by partial matches of `name` from `Profile` credentials, by partial matches of `alias` of\n * managed DIDs as well as partial matches of DIDs that are issuer or subject of credentials.\n *\n * @beta This API may change without a BREAKING CHANGE notice.\n */\nexport class DataStoreDiscoveryProvider implements AbstractDidDiscoveryProvider {\n  readonly name = 'data-store-discovery'\n\n  async discoverDid(\n    args: IDIDDiscoveryDiscoverDidArgs,\n    context: IAgentContext<IDataStoreORM>,\n  ): Promise<IDIDDiscoveryProviderResult> {\n    const matches: IDIDDiscoverMatch[] = []\n\n    const credentialsByName = await context.agent.dataStoreORMGetVerifiableCredentialsByClaims({\n      where: [\n        { column: 'type', value: ['name'] },\n        { column: 'value', value: [`%${args.query}%`], op: 'Like' },\n        { column: 'credentialType', value: ['VerifiableCredential,Profile'] },\n      ],\n    })\n\n    credentialsByName.forEach((vc) => {\n      matches.push({\n        did: vc.verifiableCredential.credentialSubject.id as string,\n        metaData: {\n          verifiableCredential: vc.verifiableCredential,\n        },\n      })\n    })\n\n    const credentialsByDID = await context.agent.dataStoreORMGetVerifiableCredentialsByClaims({\n      where: [\n        { column: 'type', value: ['name'] },\n        { column: 'subject', value: [`%${args.query}%`], op: 'Like' },\n        { column: 'credentialType', value: ['VerifiableCredential,Profile'] },\n      ],\n    })\n\n    credentialsByDID.forEach((vc) => {\n      matches.push({\n        did: vc.verifiableCredential.credentialSubject.id as string,\n        metaData: {\n          verifiableCredential: vc.verifiableCredential,\n        },\n      })\n    })\n\n    const identifiersByDID = await context.agent.dataStoreORMGetIdentifiers({\n      where: [{ column: 'did', value: [`%${args.query}%`], op: 'Like' }],\n    })\n\n    identifiersByDID.forEach((identifier) => {\n      matches.push({\n        did: identifier.did as string,\n        metaData: {\n          alias: identifier.alias,\n        },\n      })\n    })\n\n    const identifiersByAlias = await context.agent.dataStoreORMGetIdentifiers({\n      where: [{ column: 'alias', value: [`%${args.query}%`], op: 'Like' }],\n    })\n\n    identifiersByAlias.forEach((identifier) => {\n      matches.push({\n        did: identifier.did as string,\n        metaData: {\n          alias: identifier.alias,\n        },\n      })\n    })\n\n    return {\n      provider: this.name,\n      matches,\n    }\n  }\n}\n"
  },
  {
    "path": "packages/data-store/src/entities/PreMigrationEntities.ts",
    "content": "import { Column, Entity, PrimaryColumn } from 'typeorm'\nimport { Key } from './key.js'\n\n/**\n * This represents the private key data of keys that were stored by {@link @veramo/data-store#KeyStore} before Veramo\n * 3.0. During database migration this key material is moved to a different table and accessible by\n * {@link @veramo/data-store#PrivateKeyStore}.\n *\n * @beta This API may change without a BREAKING CHANGE notice.\n */\n@Entity('key', )\nexport class PreMigrationKey extends Key {\n  // Key contains all the other columns present needed for successful migrations\n\n  @PrimaryColumn()\n    // @ts-ignore\n  kid: string\n\n  @Column({ nullable: true })\n  privateKeyHex?: string\n}\n"
  },
  {
    "path": "packages/data-store/src/entities/claim.ts",
    "content": "import { Entity, Column, BaseEntity, ManyToOne, PrimaryColumn, Relation } from 'typeorm'\nimport { Identifier } from './identifier.js'\nimport { Credential } from './credential.js'\n\n/**\n * Represents the properties of a claim extracted from a Verifiable Credential `credentialSubject`, and stored in a\n * TypeORM database for querying.\n *\n * @see {@link @veramo/core-types#IDataStoreORM} for the interface defining how this can be queried.\n * @see {@link @veramo/data-store#DataStoreORM} for the implementation of the query interface.\n *\n * @beta This API may change without a BREAKING CHANGE notice.\n */\n@Entity('claim')\nexport class Claim extends BaseEntity {\n  @PrimaryColumn()\n  // @ts-ignore\n  hash: string\n\n  @ManyToOne((type) => Identifier, (identifier) => identifier.issuedClaims, {\n    eager: true,\n    onDelete: 'CASCADE',\n  })\n  // @ts-ignore\n  issuer: Relation<Identifier>\n\n  @ManyToOne((type) => Identifier, (identifier) => identifier.receivedClaims, {\n    eager: true,\n    nullable: true,\n  })\n  subject?: Relation<Identifier>\n\n  @ManyToOne((type) => Credential, (credential) => credential.claims, {\n    onDelete: 'CASCADE',\n  })\n  // @ts-ignore\n  credential: Relation<Credential>\n\n  @Column()\n  // @ts-ignore\n  issuanceDate: Date\n\n  @Column({ nullable: true })\n  expirationDate?: Date\n\n  @Column('simple-array')\n  // @ts-ignore\n  context: string[]\n\n  @Column('simple-array')\n  // @ts-ignore\n  credentialType: string[]\n\n  @Column()\n  // @ts-ignore\n  type: string\n\n  @Column('text', { nullable: true })\n  // @ts-ignore\n  value: string | null\n\n  @Column()\n  // @ts-ignore\n  isObj: boolean\n}\n"
  },
  {
    "path": "packages/data-store/src/entities/credential.ts",
    "content": "import { VerifiableCredential } from '@veramo/core-types'\nimport {\n  BaseEntity,\n  Column,\n  Entity,\n  ManyToMany,\n  ManyToOne,\n  OneToMany,\n  PrimaryColumn,\n  Relation,\n} from 'typeorm'\nimport { Identifier } from './identifier.js'\nimport { Message } from './message.js'\nimport { Presentation } from './presentation.js'\nimport { Claim } from './claim.js'\nimport { asArray, computeEntryHash, extractIssuer } from '@veramo/utils'\n\n/**\n * Represents some common properties of a Verifiable Credential that are stored in a TypeORM database for querying.\n *\n * @see {@link @veramo/core-types#IDataStoreORM.dataStoreORMGetVerifiableCredentials | dataStoreORMGetVerifiableCredentials}\n *   for the interface defining how this can be queried.\n *\n * @see {@link @veramo/data-store#DataStoreORM | DataStoreORM} for the implementation of the query interface.\n *\n * @see {@link @veramo/core-types#IDataStoreORM.dataStoreORMGetVerifiableCredentialsByClaims | dataStoreORMGetVerifiableCredentialsByClaims} for the interface defining how to query credentials by the claims they contain.\n *\n * @beta This API may change without a BREAKING CHANGE notice.\n */\n@Entity('credential')\nexport class Credential extends BaseEntity {\n  @PrimaryColumn()\n  // @ts-ignore\n  hash: string\n\n  // @ts-ignore\n  private _raw: VerifiableCredential\n\n  set raw(raw: VerifiableCredential) {\n    this._raw = raw\n    this.hash = computeEntryHash(raw)\n  }\n\n  @Column('simple-json')\n  get raw(): VerifiableCredential {\n    return this._raw\n  }\n\n  @ManyToOne((type) => Identifier, (identifier) => identifier.issuedCredentials, {\n    cascade: ['insert'],\n    eager: true,\n    onDelete: 'CASCADE',\n  })\n  // @ts-ignore\n  issuer: Relation<Identifier>\n\n  // Subject can be null https://www.w3.org/TR/vc-data-model-1.1/#credential-uniquely-identifies-a-subject\n  @ManyToOne((type) => Identifier, (identifier) => identifier?.receivedCredentials, {\n    cascade: ['insert'],\n    eager: true,\n    nullable: true,\n  })\n  subject?: Relation<Identifier>\n\n  @Column({ nullable: true })\n  id?: string\n\n  @Column()\n  // @ts-ignore\n  issuanceDate: Date\n\n  @Column({ nullable: true })\n  expirationDate?: Date\n\n  @Column('simple-array')\n  // @ts-ignore\n  context: string[]\n\n  @Column('simple-array')\n  // @ts-ignore\n  type: string[]\n\n  @OneToMany((type) => Claim, (claim) => claim.credential, {\n    cascade: ['insert'],\n  })\n  // @ts-ignore\n  claims: Relation<Claim[]>\n\n  @ManyToMany((type) => Presentation, (presentation) => presentation.credentials)\n  // @ts-ignore\n  presentations: Relation<Presentation[]>\n\n  @ManyToMany((type) => Message, (message) => message.credentials)\n  // @ts-ignore\n  messages: Relation<Message[]>\n}\n\nexport const createCredentialEntity = (vci: VerifiableCredential): Credential => {\n  const vc = vci\n  const credential = new Credential()\n  credential.context = asArray(vc['@context'])\n  credential.type = asArray(vc.type || [])\n  credential.id = vc.id\n\n  if (vc.issuanceDate) {\n    credential.issuanceDate = new Date(vc.issuanceDate)\n  }\n\n  if (vc.expirationDate) {\n    credential.expirationDate = new Date(vc.expirationDate)\n  }\n\n  const issuer = new Identifier()\n  issuer.did = extractIssuer(vc)\n  credential.issuer = issuer\n\n  if (vc.credentialSubject.id) {\n    const subject = new Identifier()\n    subject.did = vc.credentialSubject.id\n    credential.subject = subject\n  }\n  credential.claims = []\n  for (const type in vc.credentialSubject) {\n    if (vc.credentialSubject.hasOwnProperty(type)) {\n      const value = vc.credentialSubject[type]\n\n      if (type !== 'id') {\n        const isObj = typeof value === 'function' || (typeof value === 'object' && !!value)\n        const claim = new Claim()\n        claim.hash = computeEntryHash(JSON.stringify(vc) + type)\n        claim.type = type\n        claim.value = isObj ? JSON.stringify(value) : value\n        claim.isObj = isObj\n        claim.issuer = credential.issuer\n        claim.subject = credential.subject\n        claim.expirationDate = credential.expirationDate\n        claim.issuanceDate = credential.issuanceDate\n        claim.credentialType = credential.type\n        claim.context = credential.context\n        credential.claims.push(claim)\n      }\n    }\n  }\n\n  credential.raw = vci\n  return credential\n}\n"
  },
  {
    "path": "packages/data-store/src/entities/identifier.ts",
    "content": "import {\n  Entity,\n  Column,\n  Connection,\n  PrimaryColumn,\n  BaseEntity,\n  OneToMany,\n  ManyToMany,\n  Index,\n  BeforeInsert,\n  BeforeUpdate,\n} from 'typeorm'\nimport { Key } from './key.js'\nimport { Service } from './service.js'\nimport { Message } from './message.js'\nimport { Presentation } from './presentation.js'\nimport { Credential } from './credential.js'\nimport { Claim } from './claim.js'\n\n/**\n * Represents some properties and relationships of an {@link @veramo/core-types#IIdentifier} that are stored in a TypeORM\n * database for the purpose of keeping track of keys and services associated with a DID managed by a Veramo agent.\n *\n * @see {@link @veramo/data-store#DIDStore | DIDStore} for the implementation used by the\n *   {@link @veramo/did-manager#DIDManager | DIDManager}.\n * @see {@link @veramo/data-store#DataStoreORM | DataStoreORM} for the implementation of the query interface.\n *\n * @beta This API may change without a BREAKING CHANGE notice.\n */\n@Entity('identifier')\n@Index(['alias', 'provider'], { unique: true })\nexport class Identifier extends BaseEntity {\n  @PrimaryColumn()\n  // @ts-ignore\n  did: string\n\n  @Column({ nullable: true })\n  // @ts-ignore\n  provider?: string\n\n  @Column({ nullable: true })\n  // @ts-ignore\n  alias?: string\n\n  @BeforeInsert()\n  setSaveDate() {\n    this.saveDate = new Date()\n    this.updateDate = new Date()\n  }\n\n  @BeforeUpdate()\n  setUpdateDate() {\n    this.updateDate = new Date()\n  }\n\n  @Column({ select: false })\n  // @ts-ignore\n  saveDate: Date\n\n  @Column({ select: false })\n  // @ts-ignore\n  updateDate: Date\n\n  @Column({ nullable: true })\n  // @ts-ignore\n  controllerKeyId?: string\n\n  @OneToMany((type) => Key, (key) => key.identifier)\n  // @ts-ignore\n  keys: Key[]\n\n  @OneToMany((type) => Service, (service) => service.identifier, {\n    cascade: true,\n  })\n  // @ts-ignore\n  services: Service[]\n\n  @OneToMany((type) => Message, (message) => message.from)\n  // @ts-ignore\n  sentMessages: Message[]\n\n  @OneToMany((type) => Message, (message) => message.to)\n  // @ts-ignore\n  receivedMessages: Message[]\n\n  @OneToMany((type) => Presentation, (presentation) => presentation.holder)\n  // @ts-ignore\n  issuedPresentations: Presentation[]\n\n  @ManyToMany((type) => Presentation, (presentation) => presentation.verifier)\n  // @ts-ignore\n  receivedPresentations: Presentation[]\n\n  @OneToMany((type) => Credential, (credential) => credential.issuer)\n  // @ts-ignore\n  issuedCredentials: Credential[]\n\n  @OneToMany((type) => Credential, (credential) => credential.subject)\n  // @ts-ignore\n  receivedCredentials: Credential[]\n\n  @OneToMany((type) => Claim, (claim) => claim.issuer)\n  // @ts-ignore\n  issuedClaims: Claim[]\n\n  @OneToMany((type) => Claim, (claim) => claim.subject)\n  // @ts-ignore\n  receivedClaims: Claim[]\n\n  /**\n   * Convenience method to get the most recent information about a subject DID as described by Verifiable Credential\n   * claims.\n   *\n   * Example:\n   * ```typescript\n   * // get the latest claim value for credentials containing `credentialSubject.name` and this Identifier as subject.\n   * const name = await identifier.getLatestClaimValue({type: 'name'})\n   * ```\n   *\n   * @param where - The TypeORM `where` filter to use.\n   */\n  async getLatestClaimValue(\n    dbConnection: Promise<Connection>,\n    where: any,\n  ): Promise<string | null | undefined> {\n    const claim = await (await dbConnection).getRepository(Claim).findOne({\n      where: {\n        ...where,\n        subject: this.did,\n      },\n      order: {\n        issuanceDate: 'DESC',\n      },\n    })\n    return claim?.value\n  }\n\n  shortDid() {\n    return `${this.did.slice(0, 15)}...${this.did.slice(-4)}`\n  }\n}\n"
  },
  {
    "path": "packages/data-store/src/entities/key.ts",
    "content": "import { KeyMetadata, TKeyType } from '@veramo/core-types'\nimport { Entity, Column, PrimaryColumn, BaseEntity, ManyToOne, Relation } from 'typeorm'\nimport { Identifier } from './identifier.js'\n\n/**\n * Mirrors {@link @veramo/core-types#TKeyType | TKeyType}\n *\n * @beta - This API may change without a BREAKING CHANGE notice.\n */\nexport type KeyType = TKeyType\n\n/**\n * Represents some properties of a {@link @veramo/core-types#IKey | IKey} that are stored in a TypeORM\n * database for the purpose of keeping track of the {@link @veramo/key-manager#AbstractKeyManagementSystem}\n * implementations and the keys they are able to use.\n *\n * @see {@link @veramo/data-store#KeyStore | KeyStore} for the implementation used by the\n *   {@link @veramo/key-manager#KeyManager | KeyManager}.\n *\n * @beta This API may change without a BREAKING CHANGE notice.\n */\n@Entity('key')\nexport class Key extends BaseEntity {\n  @PrimaryColumn()\n  // @ts-ignore\n  kid: string\n\n  @Column()\n  // @ts-ignore\n  kms: string\n\n  @Column()\n  // @ts-ignore\n  type: KeyType\n\n  @Column()\n  // @ts-ignore\n  publicKeyHex: string\n\n  @Column({\n    type: 'simple-json',\n    nullable: true,\n    transformer: {\n      to: (value: any): KeyMetadata | null => {\n        return value\n      },\n      from: (value: KeyMetadata | null): object | null => {\n        return value\n      },\n    },\n  })\n  meta?: KeyMetadata | null\n\n  @ManyToOne((type) => Identifier, (identifier) => identifier?.keys, { onDelete: 'CASCADE' })\n  identifier?: Relation<Identifier>\n}\n"
  },
  {
    "path": "packages/data-store/src/entities/message.ts",
    "content": "import {\n  BaseEntity,\n  BeforeInsert,\n  BeforeUpdate,\n  Column,\n  Entity,\n  JoinTable,\n  ManyToMany,\n  ManyToOne,\n  PrimaryColumn,\n  Relation,\n} from 'typeorm'\nimport { IMessage } from '@veramo/core-types'\nimport { Identifier } from './identifier.js'\nimport { createPresentationEntity, Presentation } from './presentation.js'\nimport { createCredentialEntity, Credential } from './credential.js'\nimport { computeEntryHash } from '@veramo/utils'\nimport { v4 as uuidv4 } from 'uuid'\n\n/**\n * Represents message metadata as it is stored by {@link @veramo/data-store#DataStore | DataStore}.\n *\n * This metadata is most often used by {@link @veramo/message-handler#MessageHandler | MessageHandler} and\n * {@link @veramo/core-types#IMessageHandler | IMessageHandler} implementations to decorate messages that are interpreted and\n * decoded, but not returned as final, as they pass through the message handler chain.\n *\n * @beta - This API may change without a BREAKING CHANGE notice.\n */\nexport interface MetaData {\n  type: string\n  value?: string\n}\n\n/**\n * Represents some common properties of an {@link @veramo/core-types#IMessage} that are stored in a TypeORM database for\n * querying.\n *\n * @see {@link @veramo/core-types#IDataStoreORM.dataStoreORMGetMessages | dataStoreORMGetMessages}\n *   for the interface defining how this can be queried\n *\n * @see {@link @veramo/data-store#DataStoreORM | DataStoreORM} for the implementation of the query interface.\n *\n * @beta This API may change without a BREAKING CHANGE notice.\n */\n@Entity('message')\nexport class Message extends BaseEntity {\n  @BeforeInsert()\n  setId() {\n    if (!this.id) {\n      this.id = computeEntryHash(this.raw || uuidv4())\n    }\n  }\n\n  @PrimaryColumn()\n  // @ts-ignore\n  id: string\n\n  @BeforeInsert()\n  setSaveDate() {\n    this.saveDate = new Date()\n    this.updateDate = new Date()\n  }\n\n  @BeforeUpdate()\n  setUpdateDate() {\n    this.updateDate = new Date()\n  }\n\n  @Column({ select: false })\n  // @ts-ignore\n  saveDate: Date\n\n  @Column({ select: false })\n  // @ts-ignore\n  updateDate: Date\n\n  @Column({ nullable: true })\n  createdAt?: Date\n\n  @Column({ nullable: true })\n  expiresAt?: Date\n\n  @Column({ nullable: true })\n  threadId?: string\n\n  @Column()\n  // @ts-ignore\n  type: string\n\n  @Column({ nullable: true })\n  raw?: string\n\n  @Column('simple-json', { nullable: true })\n  data?: object | null\n\n  // https://github.com/decentralized-identifier/didcomm-messaging/blob/41f35f992275dd71d459504d14eb8d70b4185533/jwm.md#jwm-profile\n\n  @Column('simple-array', { nullable: true })\n  replyTo?: string[]\n\n  @Column({ nullable: true })\n  replyUrl?: string\n\n  @ManyToOne((type) => Identifier, (identifier) => identifier.sentMessages, {\n    nullable: true,\n    cascade: ['insert'],\n    eager: true,\n    onDelete: 'CASCADE',\n  })\n  from?: Relation<Identifier>\n\n  @ManyToOne((type) => Identifier, (identifier) => identifier.receivedMessages, {\n    nullable: true,\n    cascade: ['insert'],\n    eager: true,\n    onDelete: 'CASCADE',\n  })\n  to?: Relation<Identifier>\n\n  @Column('simple-json', { nullable: true })\n  metaData?: MetaData[] | null\n\n  @ManyToMany((type) => Presentation, (presentation) => presentation.messages, {\n    cascade: true,\n  })\n  @JoinTable()\n  // @ts-ignore\n  presentations: Relation<Presentation[]>\n\n  @ManyToMany((type) => Credential, (credential) => credential.messages, { cascade: true })\n  @JoinTable()\n  // @ts-ignore\n  credentials: Relation<Credential[]>\n}\n\nexport const createMessageEntity = (args: IMessage): Message => {\n  const message = new Message()\n  message.id = args.id\n  message.threadId = args.threadId\n  message.type = args.type\n  message.raw = args.raw\n  message.data = args.data\n  message.metaData = args.metaData\n\n  if (args.replyTo) {\n    message.replyTo = args.replyTo\n  }\n  if (args.replyUrl) {\n    message.replyUrl = args.replyUrl\n  }\n\n  if (args.createdAt) {\n    message.createdAt = new Date(args.createdAt)\n  }\n\n  if (args.expiresAt) {\n    message.createdAt = new Date(args.expiresAt)\n  }\n\n  if (args.from) {\n    const from = new Identifier()\n    from.did = args.from\n    message.from = from\n  }\n\n  if (args.to) {\n    const to = new Identifier()\n    to.did = args.to\n    message.to = to\n  }\n\n  if (args.presentations) {\n    message.presentations = args.presentations.map(createPresentationEntity)\n  }\n\n  if (args.credentials) {\n    message.credentials = args.credentials.map(createCredentialEntity)\n  }\n\n  return message\n}\n\nexport const createMessage = (args: Message): IMessage => {\n  const message: Partial<IMessage> = {\n    id: args.id,\n    type: args.type,\n    raw: args.raw,\n    data: args.data,\n    metaData: args.metaData,\n  }\n\n  if (args.threadId) {\n    message.threadId = args.threadId\n  }\n\n  if (args.replyTo) {\n    message.replyTo = args.replyTo\n  }\n\n  if (args.replyTo) {\n    message.replyUrl = args.replyUrl\n  }\n\n  if (args.createdAt) {\n    message.createdAt = args.createdAt.toISOString()\n  }\n\n  if (args.expiresAt) {\n    message.expiresAt = args.expiresAt.toISOString()\n  }\n\n  if (args.from) {\n    message.from = args.from.did\n  }\n\n  if (args.to) {\n    message.to = args.to.did\n  }\n\n  if (args.presentations) {\n    message.presentations = args.presentations.map((vp) => vp.raw)\n  }\n\n  if (args.credentials) {\n    message.credentials = args.credentials.map((vc) => vc.raw)\n  }\n\n  return message as IMessage\n}\n"
  },
  {
    "path": "packages/data-store/src/entities/presentation.ts",
    "content": "import { VerifiableCredential, VerifiablePresentation } from '@veramo/core-types'\n\nimport {\n  BaseEntity,\n  Column,\n  Entity,\n  JoinTable,\n  ManyToMany,\n  ManyToOne,\n  PrimaryColumn,\n  Relation,\n} from 'typeorm'\nimport { Identifier } from './identifier.js'\nimport { Message } from './message.js'\nimport { createCredentialEntity, Credential } from './credential.js'\nimport { asArray, computeEntryHash } from '@veramo/utils'\nimport { normalizeCredential } from 'did-jwt-vc'\n\n/**\n * Represents some common properties of a Verifiable Presentation that are stored in a TypeORM database for querying.\n *\n * @see {@link @veramo/core-types#IDataStoreORM.dataStoreORMGetVerifiablePresentations | dataStoreORMGetVerifiablePresentations} for the interface defining how this can be queried.\n *\n * @see {@link @veramo/data-store#DataStoreORM | DataStoreORM} for the implementation of the query interface.\n *\n * @beta This API may change without a BREAKING CHANGE notice.\n */\n@Entity('presentation')\nexport class Presentation extends BaseEntity {\n  @PrimaryColumn()\n  // @ts-ignore\n  hash: string\n\n  // @ts-ignore\n  private _raw: IVerifiablePresentation\n\n  set raw(raw: VerifiablePresentation) {\n    this._raw = raw\n    this.hash = computeEntryHash(raw)\n  }\n\n  @Column({ type: 'simple-json' })\n  get raw(): VerifiablePresentation {\n    return this._raw\n  }\n\n  @ManyToOne((type) => Identifier, (identifier) => identifier.issuedPresentations, {\n    cascade: ['insert'],\n    eager: true,\n    onDelete: 'CASCADE',\n  })\n  // @ts-ignore\n  holder: Relation<Identifier>\n\n  @ManyToMany((type) => Identifier, (identifier) => identifier?.receivedPresentations, {\n    cascade: ['insert'],\n    eager: true,\n    nullable: true,\n  })\n  @JoinTable()\n  // @ts-ignore\n  verifier?: Relation<Identifier[]>\n\n  @Column({ nullable: true })\n  id?: String\n\n  @Column()\n  // @ts-ignore\n  issuanceDate: Date\n\n  @Column({ nullable: true })\n  expirationDate?: Date\n\n  @Column('simple-array')\n  // @ts-ignore\n  context: string[]\n\n  @Column('simple-array')\n  // @ts-ignore\n  type: string[]\n\n  @ManyToMany((type) => Credential, (credential) => credential.presentations, {\n    cascade: true,\n  })\n  @JoinTable()\n  // @ts-ignore\n  credentials: Relation<Credential[]>\n\n  @ManyToMany((type) => Message, (message) => message.presentations)\n  // @ts-ignore\n  messages: Relation<Message[]>\n}\n\nexport const createPresentationEntity = (vpi: VerifiablePresentation): Presentation => {\n  const vp = vpi\n  const presentation = new Presentation()\n  presentation.context = asArray(vp['@context'])\n  presentation.type = asArray(vp.type || [])\n  presentation.id = vp.id\n\n  if (vp.issuanceDate) {\n    presentation.issuanceDate = new Date(vp.issuanceDate)\n  }\n\n  if (vp.expirationDate) {\n    presentation.expirationDate = new Date(vp.expirationDate)\n  }\n\n  const holder = new Identifier()\n  holder.did = vp.holder\n  presentation.holder = holder\n\n  presentation.verifier = asArray(vp.verifier || []).map((verifierDid) => {\n    const id = new Identifier()\n    id.did = verifierDid\n    return id\n  })\n\n  presentation.raw = vpi\n\n  presentation.credentials = (vp.verifiableCredential || [])\n    .map((cred) => {\n      if (typeof cred === 'string') {\n        return normalizeCredential(cred)\n      } else {\n        return <VerifiableCredential>cred\n      }\n    })\n    .map(createCredentialEntity)\n  return presentation\n}\n"
  },
  {
    "path": "packages/data-store/src/entities/private-key.ts",
    "content": "import { KeyType } from './key.js'\nimport { Entity, Column, PrimaryColumn, BaseEntity } from 'typeorm'\n\n/**\n * Represents some properties of a {@link @veramo/key-manager#ManagedPrivateKey | ManagedPrivateKey} that are stored in\n * a TypeORM database when using a {@link @veramo/data-store#PrivateKeyStore | PrivateKeyStore} to store private key\n * data.\n *\n * @see {@link @veramo/kms-local#KeyManagementSystem | KeyManagementSystem} for an implementation of a KMS that can\n *   make use of such stored keys.\n *\n * @beta This API may change without a BREAKING CHANGE notice.\n */\n@Entity('private-key')\nexport class PrivateKey extends BaseEntity {\n  @PrimaryColumn()\n    // @ts-ignore\n  alias: string\n\n  @Column()\n    // @ts-ignore\n  type: KeyType\n\n  @Column()\n    // @ts-ignore\n  privateKeyHex: string\n}\n"
  },
  {
    "path": "packages/data-store/src/entities/service.ts",
    "content": "import { Entity, Column, PrimaryColumn, BaseEntity, ManyToOne, Relation } from 'typeorm'\nimport { Identifier } from './identifier.js'\n\n/**\n * Represents some properties of a {@link did-resolver#ServiceEndpoint | ServiceEndpoint} as it is stored in a TypeORM\n * database. This is used by {@link @veramo/data-store#DIDStore | DIDStore} to provide information to\n * {@link @veramo/did-manager#DIDManager | DIDManager} when DID management information is stored in a local TypeORM\n * database.\n *\n * @beta This API may change without a BREAKING CHANGE notice.\n */\n@Entity('service')\nexport class Service extends BaseEntity {\n  @PrimaryColumn()\n    // @ts-ignore\n  id: string\n\n  @Column()\n    // @ts-ignore\n  type: string\n\n  @Column()\n    // @ts-ignore\n  serviceEndpoint: string\n\n  @Column({ nullable: true })\n  description?: string\n\n  @ManyToOne((type) => Identifier, (identifier) => identifier?.services, { onDelete: 'CASCADE' })\n    // @ts-ignore\n  identifier?: Relation<Identifier>\n}\n"
  },
  {
    "path": "packages/data-store/src/identifier/did-store.ts",
    "content": "import { IIdentifier, IKey } from '@veramo/core-types'\nimport { AbstractDIDStore } from '@veramo/did-manager'\nimport { Identifier } from '../entities/identifier.js'\nimport { Credential } from '../entities/credential.js'\nimport { Key } from '../entities/key.js'\nimport { Service } from '../entities/service.js'\nimport { DataSource, IsNull, Not } from 'typeorm'\n\nimport Debug from 'debug'\nimport { Presentation } from '../entities/presentation.js'\nimport { OrPromise } from \"@veramo/utils\";\nimport { getConnectedDb } from \"../utils.js\";\n\nconst debug = Debug('veramo:typeorm:identifier-store')\n\n/**\n * An implementation of {@link @veramo/did-manager#AbstractDIDStore | AbstractDIDStore} that uses a TypeORM database to\n * store the relationships between DIDs, their providers and controllers and their keys and services as they are known\n * and managed by a Veramo agent.\n *\n * An instance of this class can be used by {@link @veramo/did-manager#DIDManager} as the data storage layer.\n *\n * To make full use of this class, it should use the same database as the one used by\n * {@link @veramo/data-store#KeyStore | KeyStore}.\n *\n * @public\n */\nexport class DIDStore extends AbstractDIDStore {\n  constructor(private dbConnection: OrPromise<DataSource>) {\n    super()\n  }\n\n  async getDID({\n    did,\n    alias,\n    provider,\n  }: {\n    did: string\n    alias: string\n    provider: string\n  }): Promise<IIdentifier> {\n    let where: { did?: string; alias?: string; provider?: string } = {}\n    if (did !== undefined && alias === undefined) {\n      where = { did }\n    } else if (did === undefined && alias !== undefined) {\n      where = { alias }\n    } else {\n      throw Error('[veramo:data-store:identifier-store] Get requires did or (alias and provider)')\n    }\n\n    const [identifier] = await (await getConnectedDb(this.dbConnection)).getRepository(Identifier).find({\n      where,\n      relations: ['keys', 'services'],\n    })\n\n    if (!identifier) throw Error('Identifier not found')\n    const result: IIdentifier = {\n      did: identifier.did,\n      controllerKeyId: identifier.controllerKeyId,\n      provider: identifier.provider!!,\n      services: identifier.services.map((service) => {\n        let endpoint = service.serviceEndpoint.toString()\n        try {\n          endpoint = JSON.parse(service.serviceEndpoint)\n        } catch {}\n        return {\n          id: service.id,\n          type: service.type,\n          serviceEndpoint: endpoint,\n          description: service.description,\n        }\n      }),\n      keys: identifier.keys.map(\n        (k) =>\n          ({\n            kid: k.kid,\n            type: k.type,\n            kms: k.kms,\n            publicKeyHex: k.publicKeyHex,\n            meta: k.meta,\n          } as IKey),\n      ),\n    }\n    if (identifier.alias) {\n      result.alias = identifier.alias\n    }\n    return result\n  }\n\n  async deleteDID({ did }: { did: string }) {\n    const [identifier] = await (await getConnectedDb(this.dbConnection)).getRepository(Identifier).find({\n      where: { did },\n      relations: ['keys', 'services', 'issuedCredentials', 'issuedPresentations'],\n    })\n    if (!identifier || typeof identifier === 'undefined') {\n      return true\n    }\n    // some drivers don't support cascading so we delete these manually\n\n    //unlink existing keys that are no longer tied to this identifier\n    let existingKeys = identifier.keys.map((key) => {\n      delete key.identifier\n      return key\n    })\n    await (await getConnectedDb(this.dbConnection)).getRepository(Key).save(existingKeys)\n\n    if (identifier.issuedCredentials || typeof identifier.issuedCredentials !== 'undefined') {\n      await (await getConnectedDb(this.dbConnection)).getRepository(Credential).remove(identifier.issuedCredentials)\n    }\n\n    if (identifier.issuedPresentations || typeof identifier.issuedPresentations !== 'undefined') {\n      await (await getConnectedDb(this.dbConnection)).getRepository(Presentation).remove(identifier.issuedPresentations)\n    }\n\n    //delete existing services that are no longer tied to this identifier\n    let oldServices = identifier.services\n    const srvRepo = await (await getConnectedDb(this.dbConnection)).getRepository(Service).remove(oldServices)\n\n    if (!identifier) throw Error('Identifier not found')\n    debug('Deleting', did)\n    await (await getConnectedDb(this.dbConnection)).getRepository(Identifier).remove(identifier)\n\n    return true\n  }\n\n  async importDID(args: IIdentifier) {\n    const identifier = new Identifier()\n    identifier.did = args.did\n    if (args.controllerKeyId) {\n      identifier.controllerKeyId = args.controllerKeyId\n    }\n    identifier.provider = args.provider\n    if (args.alias) {\n      identifier.alias = args.alias\n    }\n\n    identifier.keys = []\n    for (const argsKey of args.keys) {\n      const key = new Key()\n      key.kid = argsKey.kid\n      key.publicKeyHex = argsKey.publicKeyHex\n      key.kms = argsKey.kms\n      key.meta = argsKey.meta\n      identifier.keys.push(key)\n    }\n\n    identifier.services = []\n    for (const argsService of args.services) {\n      const service = new Service()\n      service.id = argsService.id\n      service.type = argsService.type\n      service.serviceEndpoint = (typeof argsService.serviceEndpoint === 'string') ? argsService.serviceEndpoint : JSON.stringify(argsService.serviceEndpoint)\n      service.description = argsService.description\n      identifier.services.push(service)\n    }\n\n    await (await getConnectedDb(this.dbConnection)).getRepository(Identifier).save(identifier)\n\n    debug('Saving', args.did)\n    return true\n  }\n\n  async listDIDs(args: { alias?: string; provider?: string }): Promise<IIdentifier[]> {\n    const where: any = { provider: args?.provider || Not(IsNull()) }\n    if (args?.alias) {\n      where['alias'] = args.alias\n    }\n    const identifiers = await (await getConnectedDb(this.dbConnection)).getRepository(Identifier).find({\n      where,\n      relations: ['keys', 'services'],\n    })\n    return identifiers.map((identifier) => {\n      const i = identifier\n      if (i.alias === null) {\n        delete i.alias\n      }\n      return i as IIdentifier\n    })\n  }\n}\n"
  },
  {
    "path": "packages/data-store/src/identifier/key-store.ts",
    "content": "import { IKey, ManagedKeyInfo } from '@veramo/core-types'\nimport { AbstractKeyStore } from '@veramo/key-manager'\nimport { DataSource } from 'typeorm'\n\nimport { Key } from '../entities/key.js'\n\nimport Debug from 'debug'\nimport { OrPromise } from \"@veramo/utils\";\nimport { getConnectedDb } from \"../utils.js\";\nconst debug = Debug('veramo:typeorm:key-store')\n\n/**\n * An implementation of {@link @veramo/key-manager#AbstractKeyStore | AbstractKeyStore} that uses a TypeORM database to\n * store the relationships between keys, their IDs, aliases and\n * {@link @veramo/key-manager#AbstractKeyManagementSystem | KMS implementations}, as they are known and managed by a\n * Veramo agent.\n *\n * An instance of this class can be used by {@link @veramo/key-manager#KeyManager} as the data storage layer.\n *\n * To make full use of this class, it should use the same database as the one used by\n * {@link @veramo/data-store#DIDStore | DIDStore}.\n *\n * @public\n */\nexport class KeyStore extends AbstractKeyStore {\n  constructor(private dbConnection: OrPromise<DataSource>) {\n    super()\n  }\n\n  async getKey({ kid }: { kid: string }): Promise<IKey> {\n    const key = await (await getConnectedDb(this.dbConnection)).getRepository(Key).findOneBy({ kid })\n    if (!key) throw Error('Key not found')\n    return key as IKey\n  }\n\n  async deleteKey({ kid }: { kid: string }) {\n    const key = await (await getConnectedDb(this.dbConnection)).getRepository(Key).findOneBy({ kid })\n    if (!key) throw Error('Key not found')\n    debug('Deleting key', kid)\n    await (await getConnectedDb(this.dbConnection)).getRepository(Key).remove(key)\n    return true\n  }\n\n  async importKey(args: IKey) {\n    const key = new Key()\n    key.kid = args.kid\n    key.publicKeyHex = args.publicKeyHex\n    key.type = args.type\n    key.kms = args.kms\n    key.meta = args.meta\n    debug('Saving key', args.kid)\n    await (await getConnectedDb(this.dbConnection)).getRepository(Key).save(key)\n    return true\n  }\n\n  async listKeys(args: {} = {}): Promise<ManagedKeyInfo[]> {\n    const keys = await (await getConnectedDb(this.dbConnection)).getRepository(Key).find()\n    const managedKeys: ManagedKeyInfo[] = keys.map((key) => {\n      const { kid, publicKeyHex, type, meta, kms } = key\n      return { kid, publicKeyHex, type, meta, kms } as IKey\n    })\n    return managedKeys\n  }\n}\n"
  },
  {
    "path": "packages/data-store/src/identifier/private-key-store.ts",
    "content": "import {\n  AbstractPrivateKeyStore,\n  AbstractSecretBox,\n  ImportablePrivateKey,\n  ManagedPrivateKey,\n} from '@veramo/key-manager'\nimport { DataSource } from 'typeorm'\nimport { PrivateKey } from '../entities/private-key.js'\nimport { v4 as uuid4 } from 'uuid'\nimport Debug from 'debug'\nimport { OrPromise } from '@veramo/utils'\nimport { getConnectedDb } from '../utils.js'\n\nconst debug = Debug('veramo:typeorm:key-store')\n\n/**\n * An implementation of {@link @veramo/key-manager#AbstractPrivateKeyStore | AbstractPrivateKeyStore} that uses a\n * TypeORM database connection to store private key material.\n *\n * The keys can be encrypted while at rest if this class is initialized with an\n * {@link @veramo/key-manager#AbstractSecretBox | AbstractSecretBox} implementation.\n *\n * @public\n */\nexport class PrivateKeyStore extends AbstractPrivateKeyStore {\n  constructor(private dbConnection: OrPromise<DataSource>, private secretBox?: AbstractSecretBox) {\n    super()\n    if (!secretBox) {\n      console.warn('Please provide SecretBox to the KeyStore')\n    }\n  }\n\n  async getKey({ alias }: { alias: string }): Promise<ManagedPrivateKey> {\n    const key = await (await getConnectedDb(this.dbConnection)).getRepository(PrivateKey).findOneBy({ alias })\n    if (!key) throw Error('Key not found')\n    if (this.secretBox && key.privateKeyHex) {\n      key.privateKeyHex = await this.secretBox.decrypt(key.privateKeyHex)\n    }\n    return key as ManagedPrivateKey\n  }\n\n  async deleteKey({ alias }: { alias: string }) {\n    const key = await (await getConnectedDb(this.dbConnection)).getRepository(PrivateKey).findOneBy({ alias })\n    if (!key) throw Error(`not_found: Private Key data not found for alias=${alias}`)\n    debug('Deleting private key data', alias)\n    await (await getConnectedDb(this.dbConnection)).getRepository(PrivateKey).remove(key)\n    return true\n  }\n\n  async importKey(args: ImportablePrivateKey): Promise<ManagedPrivateKey> {\n    const key = new PrivateKey()\n    key.alias = args.alias || uuid4()\n    key.privateKeyHex = args.privateKeyHex\n    key.type = args.type\n    debug('Saving private key data', args.alias)\n    const keyRepo = await (await getConnectedDb(this.dbConnection)).getRepository(PrivateKey)\n    const existingKey = await keyRepo.findOneBy({ alias: key.alias })\n    if (existingKey && this.secretBox) {\n      existingKey.privateKeyHex = await this.secretBox.decrypt(existingKey.privateKeyHex)\n    }\n    if (existingKey && existingKey.privateKeyHex !== key.privateKeyHex) {\n      throw new Error(\n        `key_already_exists: A key with this alias exists but with different data. Please use a different alias.`,\n      )\n    }\n    if (this.secretBox && key.privateKeyHex) {\n      key.privateKeyHex = await this.secretBox.encrypt(key.privateKeyHex)\n    }\n    await keyRepo.save(key)\n    return key\n  }\n\n  async listKeys(): Promise<Array<ManagedPrivateKey>> {\n    let keys = await (await getConnectedDb(this.dbConnection)).getRepository(PrivateKey).find()\n    if (this.secretBox) {\n      for (const key of keys) {\n        key.privateKeyHex = await this.secretBox?.decrypt(key.privateKeyHex) as string\n      }\n    }\n    return keys\n  }\n}\n"
  },
  {
    "path": "packages/data-store/src/index.ts",
    "content": "/**\n * {@link https://typeorm.io/ | TypeORM } backed plugins. {@link @veramo/core#Agent}\n * {@link @veramo/data-store#DataStore | plugin} that implements {@link @veramo/core-types#IDataStore } interface.\n * {@link @veramo/core#Agent} {@link @veramo/data-store#DataStoreORM | plugin} that implements\n * {@link @veramo/core-types#IDataStoreORM} interface. Provides {@link @veramo/data-store#KeyStore} for\n * {@link @veramo/key-manager#KeyManager} and {@link @veramo/data-store#DIDStore} for\n * {@link @veramo/did-manager#DIDManager}\n *\n * @packageDocumentation\n */\n\nexport { DIDStore } from './identifier/did-store.js'\nexport { KeyStore } from './identifier/key-store.js'\nexport { PrivateKeyStore } from './identifier/private-key-store.js'\nexport { DataStore } from './data-store.js'\nexport { DataStoreORM } from './data-store-orm.js'\nexport { DataStoreDiscoveryProvider } from './did-discovery-provider.js'\nimport { Key, KeyType } from './entities/key.js'\nimport { Identifier } from './entities/identifier.js'\nimport { Claim } from './entities/claim.js'\nimport { Credential } from './entities/credential.js'\nimport { Presentation } from './entities/presentation.js'\nimport { Service } from './entities/service.js'\nimport { Message, MetaData } from './entities/message.js'\nimport { PrivateKey } from './entities/private-key.js'\nimport { PreMigrationKey } from './entities/PreMigrationEntities.js'\n\n/**\n * The TypeORM entities used by this package.\n *\n * This array SHOULD be used when creating a TypeORM connection.\n *\n * @public\n */\nexport const Entities = [\n  Key,\n  Identifier,\n  Message,\n  Claim,\n  Credential,\n  Presentation,\n  Service,\n  PrivateKey,\n  PreMigrationKey,\n]\n\n/**\n * Helper function to concatenate multiple arrays of TypeORM entities.\n *\n * This array CAN be used when creating a TypeORM connection.\n *\n * @public\n */\nexport const entitiesConcat = (...entityArrays: unknown[][]) =>\n  entityArrays.reduce((acc, entityArray) => acc.concat(entityArray), [])\nexport {\n  KeyType,\n  Key,\n  Identifier,\n  Message,\n  Claim,\n  Credential,\n  Presentation,\n  MetaData,\n  Service,\n  PrivateKey,\n  PreMigrationKey,\n}\nexport { migrations, migrationConcat } from './migrations/index.js'\n\n// re-export the interfaces that were moved to core for backward compatibility\nexport { IDataStore, IDataStoreORM } from '@veramo/core-types'\n"
  },
  {
    "path": "packages/data-store/src/migrations/1.createDatabase.ts",
    "content": "import { MigrationInterface, QueryRunner, Table } from 'typeorm'\nimport Debug from 'debug'\nimport { migrationGetTableName } from './migration-functions.js'\n\nconst debug = Debug('veramo:data-store:initial-migration')\n\n/**\n * Create the database layout for Veramo 3.0\n *\n * @public\n */\nexport class CreateDatabase1447159020001 implements MigrationInterface {\n  name = 'CreateDatabase1447159020001' // Used in case this class gets minified, which would change the classname\n\n  async up(queryRunner: QueryRunner): Promise<void> {\n    const dateTimeType: string = queryRunner.connection.driver.mappedDataTypes.createDate as string\n\n    debug(`creating identifier table`)\n    // \"CREATE TABLE \\\"identifier\\\" (\\\"did\\\" varchar PRIMARY KEY NOT NULL, \\\"provider\\\" varchar, \\\"alias\\\" varchar, \\\"saveDate\\\" datetime NOT NULL DEFAULT (datetime('now')), \\\"updateDate\\\" datetime NOT NULL DEFAULT (datetime('now')), \\\"controllerKeyId\\\" varchar)\",\n    // \"CREATE UNIQUE INDEX \\\"IDX_6098cca69c838d91e55ef32fe1\\\" ON \\\"identifier\\\" (\\\"alias\\\", \\\"provider\\\")\",\n    await queryRunner.createTable(\n      new Table({\n        name: migrationGetTableName(queryRunner, 'identifier'),\n        columns: [\n          { name: 'did', type: 'varchar', isPrimary: true },\n          { name: 'provider', type: 'varchar', isNullable: true },\n          { name: 'alias', type: 'varchar', isNullable: true },\n          { name: 'saveDate', type: dateTimeType },\n          { name: 'updateDate', type: dateTimeType },\n          { name: 'controllerKeyId', type: 'varchar', isNullable: true },\n        ],\n        indices: [\n          {\n            columnNames: ['alias', 'provider'],\n            isUnique: true,\n          },\n        ],\n      }),\n      true,\n    )\n\n    debug(`creating key table`)\n    // \"CREATE TABLE \\\"key\\\" (\\\"kid\\\" varchar PRIMARY KEY NOT NULL, \\\"kms\\\" varchar NOT NULL, \\\"type\\\" varchar NOT NULL, \\\"publicKeyHex\\\" varchar NOT NULL, \\\"privateKeyHex\\\" varchar NOT NULL, \\\"meta\\\" text, \\\"identifierDid\\\" varchar, CONSTRAINT \\\"FK_3f40a9459b53adf1729dbd3b787\\\" FOREIGN KEY (\\\"identifierDid\\\") REFERENCES \\\"identifier\\\" (\\\"did\\\") ON DELETE NO ACTION ON UPDATE NO ACTION)\",\n    await queryRunner.createTable(\n      new Table({\n        name: migrationGetTableName(queryRunner, 'key'),\n        columns: [\n          { name: 'kid', type: 'varchar', isPrimary: true },\n          { name: 'kms', type: 'varchar' },\n          { name: 'type', type: 'varchar' },\n          { name: 'publicKeyHex', type: 'varchar' },\n          { name: 'privateKeyHex', type: 'varchar', isNullable: true },\n          { name: 'meta', type: 'text', isNullable: true },\n          { name: 'identifierDid', type: 'varchar' },\n        ],\n        foreignKeys: [\n          {\n            columnNames: ['identifierDid'],\n            referencedColumnNames: ['did'],\n            referencedTableName: migrationGetTableName(queryRunner, 'identifier'),\n          },\n        ],\n      }),\n      true,\n    )\n\n    debug(`creating service table`)\n    // \"CREATE TABLE \\\"service\\\" (\\\"id\\\" varchar PRIMARY KEY NOT NULL, \\\"type\\\" varchar NOT NULL, \\\"serviceEndpoint\\\" varchar NOT NULL, \\\"description\\\" varchar, \\\"identifierDid\\\" varchar, CONSTRAINT \\\"FK_e16e0280d906951809f95dd09f1\\\" FOREIGN KEY (\\\"identifierDid\\\") REFERENCES \\\"identifier\\\" (\\\"did\\\") ON DELETE NO ACTION ON UPDATE NO ACTION)\",\n    await queryRunner.createTable(\n      new Table({\n        name: migrationGetTableName(queryRunner, 'service'),\n        columns: [\n          { name: 'id', type: 'varchar', isPrimary: true },\n          { name: 'type', type: 'varchar' },\n          { name: 'serviceEndpoint', type: 'varchar' },\n          { name: 'description', type: 'varchar', isNullable: true },\n          { name: 'identifierDid', type: 'varchar' },\n        ],\n        foreignKeys: [\n          {\n            columnNames: ['identifierDid'],\n            referencedColumnNames: ['did'],\n            referencedTableName: migrationGetTableName(queryRunner, 'identifier'),\n            onDelete: 'cascade',\n          },\n        ],\n      }),\n      true,\n    )\n\n    debug(`creating credentials table`)\n    // \"CREATE TABLE \\\"credential\\\" (\\\"hash\\\" varchar PRIMARY KEY NOT NULL, \\\"raw\\\" text NOT NULL, \\\"id\\\" varchar, \\\"issuanceDate\\\" datetime NOT NULL, \\\"expirationDate\\\" datetime, \\\"context\\\" text NOT NULL, \\\"type\\\" text NOT NULL, \\\"issuerDid\\\" varchar, \\\"subjectDid\\\" varchar, CONSTRAINT \\\"FK_123d0977e0976565ee0932c0b9e\\\" FOREIGN KEY (\\\"issuerDid\\\") REFERENCES \\\"identifier\\\" (\\\"did\\\") ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT \\\"FK_b790831f44e2fa7f9661a017b0a\\\" FOREIGN KEY (\\\"subjectDid\\\") REFERENCES \\\"identifier\\\" (\\\"did\\\") ON DELETE NO ACTION ON UPDATE NO ACTION)\",\n    await queryRunner.createTable(\n      new Table({\n        name: migrationGetTableName(queryRunner, 'credential'),\n        columns: [\n          { name: 'hash', type: 'varchar', isPrimary: true },\n          { name: 'raw', type: 'text' },\n          { name: 'id', type: 'varchar', isNullable: true },\n          { name: 'issuanceDate', type: dateTimeType },\n          { name: 'expirationDate', type: dateTimeType, isNullable: true },\n          { name: 'context', type: 'text' },\n          { name: 'type', type: 'text' },\n          { name: 'issuerDid', type: 'varchar' },\n          { name: 'subjectDid', type: 'varchar', isNullable: true },\n        ],\n        foreignKeys: [\n          {\n            columnNames: ['issuerDid'],\n            referencedColumnNames: ['did'],\n            referencedTableName: migrationGetTableName(queryRunner, 'identifier'),\n            onDelete: 'cascade',\n          },\n          {\n            columnNames: ['subjectDid'],\n            referencedColumnNames: ['did'],\n            referencedTableName: migrationGetTableName(queryRunner, 'identifier'),\n          },\n        ],\n      }),\n      true,\n    )\n\n    debug(`creating claims table`)\n    // \"CREATE TABLE \\\"claim\\\" (\\\"hash\\\" varchar PRIMARY KEY NOT NULL, \\\"issuanceDate\\\" datetime NOT NULL, \\\"expirationDate\\\" datetime, \\\"context\\\" text NOT NULL, \\\"credentialType\\\" text NOT NULL, \\\"type\\\" varchar NOT NULL, \\\"value\\\" text, \\\"isObj\\\" boolean NOT NULL, \\\"issuerDid\\\" varchar, \\\"subjectDid\\\" varchar, \\\"credentialHash\\\" varchar, CONSTRAINT \\\"FK_d972c73d0f875c0d14c35b33baa\\\" FOREIGN KEY (\\\"issuerDid\\\") REFERENCES \\\"identifier\\\" (\\\"did\\\") ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT \\\"FK_f411679379d373424100a1c73f4\\\" FOREIGN KEY (\\\"subjectDid\\\") REFERENCES \\\"identifier\\\" (\\\"did\\\") ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT \\\"FK_3d494b79143de3d0e793883e351\\\" FOREIGN KEY (\\\"credentialHash\\\") REFERENCES \\\"credential\\\" (\\\"hash\\\") ON DELETE NO ACTION ON UPDATE NO ACTION)\",\n    await queryRunner.createTable(\n      new Table({\n        name: migrationGetTableName(queryRunner, 'claim'),\n        columns: [\n          { name: 'hash', type: 'varchar', isPrimary: true },\n          { name: 'issuanceDate', type: dateTimeType },\n          { name: 'expirationDate', type: dateTimeType, isNullable: true },\n          { name: 'context', type: 'text' },\n          { name: 'credentialType', type: 'text' },\n          { name: 'value', type: 'text' },\n          { name: 'type', type: 'varchar' },\n          { name: 'isObj', type: 'boolean' },\n          { name: 'issuerDid', type: 'varchar', isNullable: true },\n          { name: 'subjectDid', type: 'varchar', isNullable: true },\n          { name: 'credentialHash', type: 'varchar' },\n        ],\n        foreignKeys: [\n          {\n            columnNames: ['issuerDid'],\n            referencedColumnNames: ['did'],\n            referencedTableName: migrationGetTableName(queryRunner, 'identifier'),\n            onDelete: 'cascade',\n          },\n          {\n            columnNames: ['subjectDid'],\n            referencedColumnNames: ['did'],\n            referencedTableName: migrationGetTableName(queryRunner, 'identifier'),\n          },\n          {\n            columnNames: ['credentialHash'],\n            referencedColumnNames: ['hash'],\n            referencedTableName: migrationGetTableName(queryRunner, 'credential'),\n            onDelete: 'cascade',\n          },\n        ],\n      }),\n      true,\n    )\n\n    debug(`creating presentations table`)\n    // \"CREATE TABLE \\\"presentation\\\" (\\\"hash\\\" varchar PRIMARY KEY NOT NULL, \\\"raw\\\" text NOT NULL, \\\"id\\\" varchar, \\\"issuanceDate\\\" datetime NOT NULL, \\\"expirationDate\\\" datetime, \\\"context\\\" text NOT NULL, \\\"type\\\" text NOT NULL, \\\"holderDid\\\" varchar, CONSTRAINT \\\"FK_a5e418449d9f527776a3bd0ca61\\\" FOREIGN KEY (\\\"holderDid\\\") REFERENCES \\\"identifier\\\" (\\\"did\\\") ON DELETE NO ACTION ON UPDATE NO ACTION)\",\n    await queryRunner.createTable(\n      new Table({\n        name: migrationGetTableName(queryRunner, 'presentation'),\n        columns: [\n          { name: 'hash', type: 'varchar', isPrimary: true },\n          { name: 'raw', type: 'text' },\n          { name: 'id', type: 'varchar', isNullable: true },\n          { name: 'issuanceDate', type: dateTimeType },\n          { name: 'expirationDate', type: dateTimeType, isNullable: true },\n          { name: 'context', type: 'text' },\n          { name: 'type', type: 'text' },\n          { name: 'holderDid', type: 'varchar', isNullable: true },\n        ],\n        foreignKeys: [\n          {\n            columnNames: ['holderDid'],\n            referencedColumnNames: ['did'],\n            referencedTableName: migrationGetTableName(queryRunner, 'identifier'),\n            onDelete: 'cascade',\n          },\n        ],\n      }),\n      true,\n    )\n\n    debug(`creating message table`)\n    // \"CREATE TABLE \\\"message\\\" (\\\"id\\\" varchar PRIMARY KEY NOT NULL, \\\"saveDate\\\" datetime NOT NULL DEFAULT (datetime('now')), \\\"updateDate\\\" datetime NOT NULL DEFAULT (datetime('now')), \\\"createdAt\\\" datetime, \\\"expiresAt\\\" datetime, \\\"threadId\\\" varchar, \\\"type\\\" varchar NOT NULL, \\\"raw\\\" varchar, \\\"data\\\" text, \\\"replyTo\\\" text, \\\"replyUrl\\\" varchar, \\\"metaData\\\" text, \\\"fromDid\\\" varchar, \\\"toDid\\\" varchar, CONSTRAINT \\\"FK_63bf73143b285c727bd046e6710\\\" FOREIGN KEY (\\\"fromDid\\\") REFERENCES \\\"identifier\\\" (\\\"did\\\") ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT \\\"FK_1a666b2c29bb2b68d91259f55df\\\" FOREIGN KEY (\\\"toDid\\\") REFERENCES \\\"identifier\\\" (\\\"did\\\") ON DELETE NO ACTION ON UPDATE NO ACTION)\",\n    await queryRunner.createTable(\n      new Table({\n        name: migrationGetTableName(queryRunner, 'message'),\n        columns: [\n          { name: 'id', type: 'varchar', isPrimary: true },\n          { name: 'saveDate', type: dateTimeType },\n          { name: 'updateDate', type: dateTimeType },\n          { name: 'createdAt', type: dateTimeType, isNullable: true },\n          { name: 'expiresAt', type: dateTimeType, isNullable: true },\n          { name: 'threadId', type: 'varchar', isNullable: true },\n          { name: 'type', type: 'varchar', isNullable: true },\n          { name: 'raw', type: 'varchar', isNullable: true },\n          { name: 'data', type: 'text', isNullable: true },\n          { name: 'replyTo', type: 'text', isNullable: true },\n          { name: 'replyUrl', type: 'varchar', isNullable: true },\n          { name: 'metaData', type: 'text', isNullable: true },\n          { name: 'fromDid', type: 'varchar', isNullable: true },\n          { name: 'toDid', type: 'varchar', isNullable: true },\n        ],\n        foreignKeys: [\n          {\n            columnNames: ['fromDid'],\n            referencedColumnNames: ['did'],\n            referencedTableName: migrationGetTableName(queryRunner, 'identifier'),\n          },\n          {\n            columnNames: ['toDid'],\n            referencedColumnNames: ['did'],\n            referencedTableName: migrationGetTableName(queryRunner, 'identifier'),\n          },\n        ],\n      }),\n      true,\n    )\n\n    debug(`creating presentation_verifier_identifier many to many table`)\n    // \"CREATE TABLE \\\"presentation_verifier_identifier\\\" (\\\"presentationHash\\\" varchar NOT NULL, \\\"identifierDid\\\" varchar NOT NULL, CONSTRAINT \\\"FK_05b1eda0f6f5400cb173ebbc086\\\" FOREIGN KEY (\\\"presentationHash\\\") REFERENCES \\\"presentation\\\" (\\\"hash\\\") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT \\\"FK_3a460e48557bad5564504ddad90\\\" FOREIGN KEY (\\\"identifierDid\\\") REFERENCES \\\"identifier\\\" (\\\"did\\\") ON DELETE CASCADE ON UPDATE NO ACTION, PRIMARY KEY (\\\"presentationHash\\\", \\\"identifierDid\\\"))\",\n    // \"CREATE INDEX \\\"IDX_05b1eda0f6f5400cb173ebbc08\\\" ON \\\"presentation_verifier_identifier\\\" (\\\"presentationHash\\\")\",\n    // \"CREATE INDEX \\\"IDX_3a460e48557bad5564504ddad9\\\" ON \\\"presentation_verifier_identifier\\\" (\\\"identifierDid\\\")\",\n    await queryRunner.createTable(\n      new Table({\n        name: migrationGetTableName(queryRunner, 'presentation_verifier_identifier'),\n        columns: [\n          { name: 'presentationHash', type: 'varchar', isPrimary: true },\n          { name: 'identifierDid', type: 'varchar', isPrimary: true },\n        ],\n        indices: [\n          {\n            columnNames: ['presentationHash', 'identifierDid'],\n          },\n        ],\n        foreignKeys: [\n          {\n            columnNames: ['presentationHash'],\n            referencedColumnNames: ['hash'],\n            referencedTableName: migrationGetTableName(queryRunner, 'presentation'),\n            onDelete: 'cascade',\n          },\n          {\n            columnNames: ['identifierDid'],\n            referencedColumnNames: ['did'],\n            referencedTableName: migrationGetTableName(queryRunner, 'identifier'),\n            onDelete: 'cascade',\n          },\n        ],\n      }),\n      true,\n    )\n\n    debug(`creating presentation_credentials_credential many to many table`)\n    // \"CREATE TABLE \\\"presentation_credentials_credential\\\" (\\\"presentationHash\\\" varchar NOT NULL, \\\"credentialHash\\\" varchar NOT NULL, CONSTRAINT \\\"FK_d796bcde5e182136266b2a6b72c\\\" FOREIGN KEY (\\\"presentationHash\\\") REFERENCES \\\"presentation\\\" (\\\"hash\\\") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT \\\"FK_ef88f92988763fee884c37db63b\\\" FOREIGN KEY (\\\"credentialHash\\\") REFERENCES \\\"credential\\\" (\\\"hash\\\") ON DELETE CASCADE ON UPDATE NO ACTION, PRIMARY KEY (\\\"presentationHash\\\", \\\"credentialHash\\\"))\",\n    // \"CREATE INDEX \\\"IDX_d796bcde5e182136266b2a6b72\\\" ON \\\"presentation_credentials_credential\\\" (\\\"presentationHash\\\")\",\n    // \"CREATE INDEX \\\"IDX_ef88f92988763fee884c37db63\\\" ON \\\"presentation_credentials_credential\\\" (\\\"credentialHash\\\")\",\n    await queryRunner.createTable(\n      new Table({\n        name: migrationGetTableName(queryRunner, 'presentation_credentials_credential'),\n        columns: [\n          { name: 'presentationHash', type: 'varchar', isPrimary: true },\n          { name: 'credentialHash', type: 'varchar', isPrimary: true },\n        ],\n        indices: [\n          {\n            columnNames: ['presentationHash', 'credentialHash'],\n          },\n        ],\n        foreignKeys: [\n          {\n            columnNames: ['presentationHash'],\n            referencedColumnNames: ['hash'],\n            referencedTableName: migrationGetTableName(queryRunner, 'presentation'),\n            onDelete: 'cascade',\n          },\n          {\n            columnNames: ['credentialHash'],\n            referencedColumnNames: ['hash'],\n            referencedTableName: migrationGetTableName(queryRunner, 'credential'),\n            onDelete: 'cascade',\n          },\n        ],\n      }),\n      true,\n    )\n\n    debug(`creating message_presentations_presentation many to many table`)\n    // \"CREATE TABLE \\\"message_presentations_presentation\\\" (\\\"messageId\\\" varchar NOT NULL, \\\"presentationHash\\\" varchar NOT NULL, CONSTRAINT \\\"FK_7e7094f2cd6e5ec93914ac5138f\\\" FOREIGN KEY (\\\"messageId\\\") REFERENCES \\\"message\\\" (\\\"id\\\") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT \\\"FK_a13b5cf828c669e61faf489c182\\\" FOREIGN KEY (\\\"presentationHash\\\") REFERENCES \\\"presentation\\\" (\\\"hash\\\") ON DELETE CASCADE ON UPDATE NO ACTION, PRIMARY KEY (\\\"messageId\\\", \\\"presentationHash\\\"))\",\n    // \"CREATE INDEX \\\"IDX_7e7094f2cd6e5ec93914ac5138\\\" ON \\\"message_presentations_presentation\\\" (\\\"messageId\\\")\",\n    // \"CREATE INDEX \\\"IDX_a13b5cf828c669e61faf489c18\\\" ON \\\"message_presentations_presentation\\\" (\\\"presentationHash\\\")\",\n    await queryRunner.createTable(\n      new Table({\n        name: migrationGetTableName(queryRunner, 'message_presentations_presentation'),\n        columns: [\n          { name: 'messageId', type: 'varchar', isPrimary: true },\n          { name: 'presentationHash', type: 'varchar', isPrimary: true },\n        ],\n        indices: [\n          {\n            columnNames: ['messageId', 'presentationHash'],\n          },\n        ],\n        foreignKeys: [\n          {\n            columnNames: ['messageId'],\n            referencedColumnNames: ['id'],\n            referencedTableName: migrationGetTableName(queryRunner, 'message'),\n            onDelete: 'cascade',\n          },\n          {\n            columnNames: ['presentationHash'],\n            referencedColumnNames: ['hash'],\n            referencedTableName: migrationGetTableName(queryRunner, 'presentation'),\n            onDelete: 'cascade',\n          },\n        ],\n      }),\n      true,\n    )\n\n    debug(`creating message_credentials_credential many to many table`)\n    // \"CREATE TABLE \\\"message_credentials_credential\\\" (\\\"messageId\\\" varchar NOT NULL, \\\"credentialHash\\\" varchar NOT NULL, CONSTRAINT \\\"FK_1c111357e73db91a08525914b59\\\" FOREIGN KEY (\\\"messageId\\\") REFERENCES \\\"message\\\" (\\\"id\\\") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT \\\"FK_8ae8195a94b667b185d2c023e33\\\" FOREIGN KEY (\\\"credentialHash\\\") REFERENCES \\\"credential\\\" (\\\"hash\\\") ON DELETE CASCADE ON UPDATE NO ACTION, PRIMARY KEY (\\\"messageId\\\", \\\"credentialHash\\\"))\",\n    // \"CREATE INDEX \\\"IDX_1c111357e73db91a08525914b5\\\" ON \\\"message_credentials_credential\\\" (\\\"messageId\\\")\",\n    // \"CREATE INDEX \\\"IDX_8ae8195a94b667b185d2c023e3\\\" ON \\\"message_credentials_credential\\\" (\\\"credentialHash\\\")\",\n    await queryRunner.createTable(\n      new Table({\n        name: migrationGetTableName(queryRunner, 'message_credentials_credential'),\n        columns: [\n          { name: 'messageId', type: 'varchar', isPrimary: true },\n          { name: 'credentialHash', type: 'varchar', isPrimary: true },\n        ],\n        indices: [\n          {\n            columnNames: ['messageId', 'credentialHash'],\n          },\n        ],\n        foreignKeys: [\n          {\n            columnNames: ['messageId'],\n            referencedColumnNames: ['id'],\n            referencedTableName: migrationGetTableName(queryRunner, 'message'),\n            onDelete: 'cascade',\n          },\n          {\n            columnNames: ['credentialHash'],\n            referencedColumnNames: ['hash'],\n            referencedTableName: migrationGetTableName(queryRunner, 'credential'),\n            onDelete: 'cascade',\n          },\n        ],\n      }),\n      true,\n    )\n  }\n\n  async down(queryRunner: QueryRunner): Promise<void> {\n    throw new Error('illegal_operation: cannot roll back initial migration')\n  }\n}\n"
  },
  {
    "path": "packages/data-store/src/migrations/2.simplifyRelations.ts",
    "content": "import { MigrationInterface, QueryRunner, TableColumn } from 'typeorm'\nimport { migrationGetExistingTableByName } from './migration-functions.js'\nimport { PreMigrationKey } from '../entities/PreMigrationEntities.js'\n\n/**\n * Fix inconsistencies between Entity data and column data.\n *\n * @public\n */\nexport class SimplifyRelations1447159020002 implements MigrationInterface {\n\n  name = 'SimplifyRelations1447159020002' // Used in case this class gets minified, which would change the classname\n\n  async up(queryRunner: QueryRunner): Promise<void> {\n    await queryRunner.changeColumn(\n      migrationGetExistingTableByName(queryRunner, 'PreMigrationKey', true),\n      'identifierDid',\n      new TableColumn({ name: 'identifierDid', type: 'varchar', isNullable: true }),\n    )\n    await queryRunner.changeColumn(\n      migrationGetExistingTableByName(queryRunner, 'service'),\n      'identifierDid',\n      new TableColumn({ name: 'identifierDid', type: 'varchar', isNullable: true }),\n    )\n\n  }\n\n  async down(queryRunner: QueryRunner): Promise<void> {\n    throw new Error('illegal_operation: cannot roll back initial migration')\n  }\n}\n"
  },
  {
    "path": "packages/data-store/src/migrations/3.createPrivateKeyStorage.ts",
    "content": "import { MigrationInterface, QueryRunner, Table, TableColumn } from 'typeorm'\nimport { PrivateKey } from '../index.js'\nimport { PreMigrationKey } from '../entities/PreMigrationEntities.js'\nimport Debug from 'debug'\nimport { migrationGetExistingTableByName, migrationGetTableName } from './migration-functions.js'\n\nconst debug = Debug('veramo:data-store:migrate-private-keys')\n\n/**\n * Migration of existing private keys from Veramo 2.x to Veramo 3.x\n *\n * @public\n */\nexport class CreatePrivateKeyStorage1629293428674 implements MigrationInterface {\n\n  name = 'CreatePrivateKeyStorage1629293428674' // Used in case this class gets minified, which would change the classname\n\n  async up(queryRunner: QueryRunner): Promise<void> {\n    // 1.create new table\n    debug(`creating new private-key table`)\n    await queryRunner.createTable(\n      new Table({\n        name: migrationGetTableName(queryRunner, 'private-key'),\n        columns: [\n          {\n            name: 'alias',\n            type: 'varchar',\n            isPrimary: true,\n          },\n          {\n            name: 'type',\n            type: 'varchar',\n          },\n          {\n            name: 'privateKeyHex',\n            type: 'varchar',\n          },\n        ],\n      }),\n      true,\n    )\n    // 2. copy key data\n    const keys: PreMigrationKey[] = await queryRunner.manager.find(PreMigrationKey)\n    debug(`got ${keys.length} potential keys to migrate`)\n    const privKeys = keys\n      .filter((key) => typeof key.privateKeyHex !== 'undefined' && key.privateKeyHex !== null)\n      .map((key) => ({\n        alias: key.kid,\n        type: key.type,\n        privateKeyHex: key.privateKeyHex,\n      }))\n    debug(`${privKeys.length} keys need to be migrated`)\n    await queryRunner.manager\n      .createQueryBuilder()\n      .insert()\n      .into(migrationGetTableName(queryRunner, 'private-key'))\n      .values(privKeys)\n      .execute()\n    // 3. drop old column\n    debug(`dropping privKeyHex column from old key table`)\n    await queryRunner.dropColumn(migrationGetExistingTableByName(queryRunner, 'PreMigrationKey', true), 'privateKeyHex')\n    //4. done\n    debug(`migrated ${privKeys.length} keys to private key storage`)\n\n  }\n\n  async down(queryRunner: QueryRunner): Promise<void> {\n\n    // 1. add old column back\n    debug(`adding back privateKeyHex column to key table`)\n    await queryRunner.addColumn(\n      'key',\n      new TableColumn({\n        name: 'privateKeyHex',\n        type: 'varchar',\n        isNullable: true,\n      }),\n    )\n    // 2. copy key data\n    debug(`checking keys to be rolled back`)\n    const keys: PrivateKey[] = await queryRunner.manager.find(PrivateKey)\n    debug(`copying ${keys.length} keys`)\n    for (const key of keys) {\n      await queryRunner.manager\n        .createQueryBuilder()\n        .update(PreMigrationKey)\n        .set({ privateKeyHex: key.privateKeyHex })\n        .where('kid = :alias', { alias: key.alias })\n        .execute()\n    }\n    debug(`dropping private-key table`)\n    // 3. drop the new private key table\n    await queryRunner.dropTable(migrationGetExistingTableByName(queryRunner, 'private-key'))\n    // 4. done\n    debug(`rolled back ${keys.length} keys`)\n  }\n}\n"
  },
  {
    "path": "packages/data-store/src/migrations/4.allowNullVPIssuanceDate.ts",
    "content": "import { MigrationInterface, QueryRunner } from 'typeorm'\nimport { Presentation } from '../index.js'\nimport Debug from 'debug'\nimport { migrationGetExistingTableByName } from './migration-functions.js'\n\nconst debug = Debug('veramo:data-store:migrate-presentation-issuance-date')\n\n/**\n * Reduce issuanceDate constraint of Presentations.\n *\n * @public\n */\nexport class AllowNullIssuanceDateForPresentations1637237492913 implements MigrationInterface {\n\n  name = 'AllowNullIssuanceDateForPresentations1637237492913' // Used in case this class gets minified, which would change the classname\n\n  async up(queryRunner: QueryRunner): Promise<void> {\n    if (queryRunner.connection.driver.options.type === 'sqlite') {\n      debug(`splitting migration into multiple transactions to allow sqlite table updates`)\n      await queryRunner.commitTransaction()\n      debug(`turning off foreign keys`)\n      await queryRunner.query('PRAGMA foreign_keys=off')\n      await queryRunner.startTransaction()\n    }\n\n    // update issuanceDate column\n    const table = migrationGetExistingTableByName(queryRunner, 'presentation')\n    const oldColumn = table?.findColumnByName('issuanceDate')!\n    const newColumn = oldColumn.clone()\n    newColumn.isNullable = true\n    debug(`updating issuanceDate for presentations to allow null`)\n    await queryRunner.changeColumn(table!, oldColumn, newColumn)\n    debug(`updated issuanceDate for presentations to allow null`)\n\n    if (queryRunner.connection.driver.options.type === 'sqlite') {\n      debug(`splitting migration into multiple transactions to allow sqlite table updates`)\n      await queryRunner.commitTransaction()\n      debug(`turning on foreign keys`)\n      await queryRunner.query('PRAGMA foreign_keys=on')\n      await queryRunner.startTransaction()\n    }\n  }\n\n  async down(queryRunner: QueryRunner): Promise<void> {\n    if (queryRunner.connection.driver.options.type === 'sqlite') {\n      debug(`splitting migration into multiple transactions to allow sqlite table updates`)\n      await queryRunner.commitTransaction()\n      debug(`turning off foreign keys`)\n      await queryRunner.query('PRAGMA foreign_keys=off')\n      await queryRunner.startTransaction()\n    }\n\n    const table = migrationGetExistingTableByName(queryRunner, 'presentation')\n    debug(`DOWN update NULL 'issuanceDate' with FAKE data for '${table.name}' table`)\n    await queryRunner.manager\n      .createQueryBuilder()\n      .update(Presentation)\n      .set({ issuanceDate: new Date(0) })\n      .where('issuanceDate is NULL')\n      .execute()\n    // update issuanceDate column\n\n    const oldColumn = table?.findColumnByName('issuanceDate')!\n    const newColumn = oldColumn.clone()\n    newColumn.isNullable = false\n    debug(`updating issuanceDate for presentations to NOT allow null`)\n    await queryRunner.changeColumn(table!, oldColumn, newColumn)\n    debug(`updated issuanceDate for presentations to NOT allow null`)\n\n    if (queryRunner.connection.driver.options.type === 'sqlite') {\n      debug(`splitting migration into multiple transactions to allow sqlite table updates`)\n      await queryRunner.commitTransaction()\n      debug(`turning on foreign keys`)\n      await queryRunner.query('PRAGMA foreign_keys=on')\n      await queryRunner.startTransaction()\n    }\n\n    debug(`DOWN updated issuanceDate for presentations to NOT allow null`)\n  }\n}\n"
  },
  {
    "path": "packages/data-store/src/migrations/index.ts",
    "content": "import { MigrationInterface } from 'typeorm'\nimport { CreateDatabase1447159020001 } from './1.createDatabase.js'\nimport { SimplifyRelations1447159020002 } from './2.simplifyRelations.js'\nimport { CreatePrivateKeyStorage1629293428674 } from './3.createPrivateKeyStorage.js'\nimport { AllowNullIssuanceDateForPresentations1637237492913 } from './4.allowNullVPIssuanceDate.js'\n\n/**\n * Allow others to use shared migration functions if they extend Veramo\n *\n * @public\n */\nexport * from './migration-functions.js'\n\n/**\n * The migrations array that SHOULD be used when initializing a TypeORM database connection.\n *\n * These ensure the correct creation of tables and the proper migrations of data when tables change between versions.\n *\n * @public\n */\nexport const migrations = [\n  CreateDatabase1447159020001,\n  SimplifyRelations1447159020002,\n  CreatePrivateKeyStorage1629293428674,\n  AllowNullIssuanceDateForPresentations1637237492913,\n]\n\n/**\n * The migrations helper that allows migrations from multiple sources to be combined into a single array.\n *\n * @public\n */\nexport function migrationConcat(...migrationArrays: MigrationInterface[][]) {\n  return migrationArrays.reduce<MigrationInterface[]>((acc, migrationArray) => acc.concat(migrationArray), [])\n}\n"
  },
  {
    "path": "packages/data-store/src/migrations/migration-functions.ts",
    "content": "import { QueryRunner, Table } from 'typeorm'\n\n/**\n * Get an existing table by name. Checks against givenTableName first, and tableName next. Throws an error if not found\n *\n * @param queryRunner The query runner object to use for querying\n * @param givenName The given name of the table to search for\n * @param strictClassName Whether the table name should strictly match the given name\n *\n * @public\n */\nexport function migrationGetExistingTableByName(queryRunner: QueryRunner, givenName: string, strictClassName?: boolean): Table {\n  const table = migrationGetTableByNameImpl(queryRunner, givenName, strictClassName)\n  if (!table) {\n    throw Error(`Could not find table with name ${givenName}`)\n  }\n  return table\n}\n\n/**\n * Get an existing table by name. Checks against givenTableName first, and tableName next. Returns undefined if not found\n *\n * @param queryRunner The query runner object to use for querying\n * @param givenName The given name of the table to search for\n * @param strictClassName Whether the table name should strictly match the given name\n *\n * @private\n */\nfunction migrationGetTableByNameImpl(queryRunner: QueryRunner, givenName: string, strictClassName?: boolean): Table | undefined {\n  let entityMetadata = queryRunner.connection.entityMetadatas.find((meta) => !!strictClassName ? meta.name === givenName : meta.givenTableName === givenName)\n  if (!entityMetadata && !strictClassName) {\n    // We are doing this separately as we don't want the above filter to use an or expression potentially matching first on tableName instead of givenTableName\n    entityMetadata = queryRunner.connection.entityMetadatas.find((meta) => meta.tableName === givenName)\n  }\n\n  return entityMetadata ? Table.create(entityMetadata, queryRunner.connection.driver) : undefined\n}\n\n/**\n * Get a table name. Checks against givenTableName first, and tableName next from existing tables. Then returns the name. If not found returns the givenName argument\n *\n * @param queryRunner The query runner object to use for querying\n * @param givenName The given name of the table to search for\n * @param strictClassName Whether the table name should strictly match the given name\n * @public\n */\nexport function migrationGetTableName(queryRunner: QueryRunner, givenName: string, strictClassName?: boolean): string {\n  const table = migrationGetTableByNameImpl(queryRunner, givenName, strictClassName)\n  return !!table ? table.name : givenName\n}\n"
  },
  {
    "path": "packages/data-store/src/utils.ts",
    "content": "import { DataSource } from 'typeorm'\nimport { OrPromise } from \"@veramo/utils\";\n\n/**\n *  Ensures that the provided DataSource is connected.\n *\n * @param dbConnection - a TypeORM DataSource or a Promise that resolves to a DataSource\n */\nexport async function getConnectedDb(dbConnection: OrPromise<DataSource>): Promise<DataSource> {\n  if (dbConnection instanceof Promise) {\n    return await dbConnection\n  } else if (!dbConnection.isInitialized) {\n    return await (<DataSource>dbConnection).initialize()\n  } else {\n    return dbConnection\n  }\n}\n"
  },
  {
    "path": "packages/data-store/tsconfig.json",
    "content": "{\n  \"extends\": \"../tsconfig.settings.json\",\n  \"compilerOptions\": {\n    \"rootDir\": \"src\",\n    \"outDir\": \"build\",\n    \"skipLibCheck\": true\n  },\n  \"references\": [\n    { \"path\": \"../core-types\" },\n    { \"path\": \"../did-discovery\" },\n    { \"path\": \"../did-manager\" },\n    { \"path\": \"../key-manager\" },\n    { \"path\": \"../utils\" }\n  ]\n}\n"
  },
  {
    "path": "packages/data-store-json/CHANGELOG.md",
    "content": "# Change Log\n\nAll notable changes to this project will be documented in this file.\nSee [Conventional Commits](https://conventionalcommits.org) for commit guidelines.\n\n# [7.0.0](https://github.com/decentralized-identity/veramo/compare/v6.0.2...v7.0.0) (2026-02-11)\n\n\n### Bug Fixes\n\n* **data-store:** validate sorted queries in data store ([#1482](https://github.com/decentralized-identity/veramo/issues/1482)) ([067e39d](https://github.com/decentralized-identity/veramo/commit/067e39dd76f11ee2d25b99c8361d4f02a4223e3b))\n* **deps:** update dependency uuid to v11 ([#1431](https://github.com/decentralized-identity/veramo/issues/1431)) ([6ad84d9](https://github.com/decentralized-identity/veramo/commit/6ad84d91f02794e741e4b770e29e1ee9a93edcfb))\n* **deps:** update devdeps and bump typeorm to 0.3.20 ([#1272](https://github.com/decentralized-identity/veramo/issues/1272)) ([7d17f37](https://github.com/decentralized-identity/veramo/commit/7d17f37ea7cc4e73a8cdae028681ae1be5c4d11c))\n\n\n\n\n\n## [6.0.2](https://github.com/decentralized-identity/veramo/compare/v6.0.1...v6.0.2) (2026-01-16)\n\n\n### Bug Fixes\n\n* **data-store:** validate sorted queries in data store ([#1482](https://github.com/decentralized-identity/veramo/issues/1482)) ([0807612](https://github.com/decentralized-identity/veramo/commit/080761254fba065c30989793dc14aec68eb5e677))\n\n\n\n\n\n## [6.0.1](https://github.com/decentralized-identity/veramo/compare/v6.0.0...v6.0.1) (2026-01-16)\n\n**Note:** Version bump only for package @veramo/data-store-json\n\n\n\n\n\n# [6.0.0](https://github.com/decentralized-identity/veramo/compare/v5.6.0...v6.0.0) (2024-04-02)\n\n\n### Bug Fixes\n\n* export const plugin schemas instead of defaults ([#1327](https://github.com/decentralized-identity/veramo/issues/1327)) ([7896cea](https://github.com/decentralized-identity/veramo/commit/7896ceaf2c79993eee44e46950814bea74bfe647)), closes [#1318](https://github.com/decentralized-identity/veramo/issues/1318) [#1317](https://github.com/decentralized-identity/veramo/issues/1317) [#1315](https://github.com/decentralized-identity/veramo/issues/1315)\n\n\n### Code Refactoring\n\n* generate plugin schemas as TS instead of JSON ([#1315](https://github.com/decentralized-identity/veramo/issues/1315)) ([65c2d4b](https://github.com/decentralized-identity/veramo/commit/65c2d4bc814daa9a3a89f4f7b8e8c6973b8ce2f0)), closes [#1254](https://github.com/decentralized-identity/veramo/issues/1254)\n\n\n### Features\n\n* add Multikey support ([#1316](https://github.com/decentralized-identity/veramo/issues/1316)) ([165de35](https://github.com/decentralized-identity/veramo/commit/165de3549ccfd3d7c84514608ac3ea9e56a7b807))\n\n\n### BREAKING CHANGES\n\n* The `plugin.schema.json` files are now generated as `plugin.schema.ts`.\n\n\n\n\n\n# [5.6.0](https://github.com/decentralized-identity/veramo/compare/v5.5.3...v5.6.0) (2024-01-16)\n\n\n### Features\n\n* **remote-client:** allow dynamic headers param for AgentRestClient constructor ([#1314](https://github.com/decentralized-identity/veramo/issues/1314)) ([1b8a0a2](https://github.com/decentralized-identity/veramo/commit/1b8a0a2718dd63492ad3a312a6ebe5f6e7849935)), closes [#1313](https://github.com/decentralized-identity/veramo/issues/1313)\n\n\n\n\n\n## [5.5.3](https://github.com/decentralized-identity/veramo/compare/v5.5.2...v5.5.3) (2023-10-09)\n\n\n### Bug Fixes\n\n* use DIF URLs in packages ([#1271](https://github.com/decentralized-identity/veramo/issues/1271)) ([3dfc601](https://github.com/decentralized-identity/veramo/commit/3dfc6014cdee7902c59d8db76b4c8507b870f227))\n\n\n\n\n\n# [5.5.0](https://github.com/uport-project/veramo/compare/v5.4.1...v5.5.0) (2023-09-19)\n\n\n### Bug Fixes\n\n* **data-store:** order skip take in orm and json ([#1243](https://github.com/uport-project/veramo/issues/1243)) ([28c1224](https://github.com/uport-project/veramo/commit/28c12247c4e4b5c94e5e92b481e3ccc71b2c4ec6))\n* **did-provider-key:** use compressed keys for creating Secp256k1 did:key ([#1217](https://github.com/uport-project/veramo/issues/1217)) ([ba8f6f5](https://github.com/uport-project/veramo/commit/ba8f6f5b9b701e57af86491504ecd209ca0c1c1d)), closes [#1213](https://github.com/uport-project/veramo/issues/1213)\n\n\n\n\n\n## [5.4.1](https://github.com/uport-project/veramo/compare/v5.4.0...v5.4.1) (2023-08-04)\n\n\n### Bug Fixes\n\n* **ci:** benign change meant to tag all packages for another patch release ([#1211](https://github.com/uport-project/veramo/issues/1211)) ([41b5c90](https://github.com/uport-project/veramo/commit/41b5c90277171b7b38c5cf49ca01db5cf75b6300))\n\n\n\n\n\n# [5.4.0](https://github.com/uport-project/veramo/compare/v5.3.0...v5.4.0) (2023-08-01)\n\n\n### Features\n\n* **did-comm:** add support for the AES based content and key encryption algorithms ([#1180](https://github.com/uport-project/veramo/issues/1180)) ([5294a81](https://github.com/uport-project/veramo/commit/5294a812ee578c0712b54f216416c3ef78c848da))\n\n\n\n\n\n# [5.3.0](https://github.com/uport-project/veramo/compare/v5.2.0...v5.3.0) (2023-07-27)\n\n**Note:** Version bump only for package @veramo/data-store-json\n\n\n\n\n\n# [5.2.0](https://github.com/uport-project/veramo/compare/v5.1.4...v5.2.0) (2023-05-02)\n\n**Note:** Version bump only for package @veramo/data-store-json\n\n\n\n\n\n## [5.1.2](https://github.com/uport-project/veramo/compare/v5.1.1...v5.1.2) (2023-02-25)\n\n**Note:** Version bump only for package @veramo/data-store-json\n\n\n\n\n\n# [5.1.0](https://github.com/uport-project/veramo/compare/v5.0.0...v5.1.0) (2023-02-24)\n\n\n### Bug Fixes\n\n* P256 key parity corrections ([#1137](https://github.com/uport-project/veramo/issues/1137)) ([d0eca2b](https://github.com/uport-project/veramo/commit/d0eca2b3cd9ca6741f7f056e28bb9799910bc5ec)), closes [#1136](https://github.com/uport-project/veramo/issues/1136) [#1135](https://github.com/uport-project/veramo/issues/1135)\n\n\n\n\n\n# [5.0.0](https://github.com/uport-project/veramo/compare/v4.3.0...v5.0.0) (2023-02-09)\n\n\n### Bug Fixes\n\n* **did-manager:** rename AbstractDIDStore methods for SES compatibility ([0287340](https://github.com/uport-project/veramo/commit/02873401508a8a7d8c999bc12dc1d107a4a5202f)), closes [#1090](https://github.com/uport-project/veramo/issues/1090)\n* **key-manager:** rename Abstract[Private]KeyStore methods for SES compatibility ([91631b6](https://github.com/uport-project/veramo/commit/91631b6d2a09d46accff6509f44792d88209b801)), closes [#1090](https://github.com/uport-project/veramo/issues/1090)\n\n\n### Build System\n\n* convert veramo modules to ESM instead of CommonJS ([#1103](https://github.com/uport-project/veramo/issues/1103)) ([b5cea3c](https://github.com/uport-project/veramo/commit/b5cea3c0d80d900a47bd1d9eea68f84b70a35e7b)), closes [#1099](https://github.com/uport-project/veramo/issues/1099)\n\n\n### Features\n\n* isolate `core-types` package from `core` ([#1116](https://github.com/uport-project/veramo/issues/1116)) ([ba7a303](https://github.com/uport-project/veramo/commit/ba7a303de91cf4cc568a3af1ddf8ca98ed022e9f))\n\n\n### BREAKING CHANGES\n\n* **did-manager:** implementations of AbstractDIDStore need to rename their methods to conform to the new API. Functionality remains the same.\n* **key-manager:** implementations of AbstractKeyStore and AbstractPrivateKeyStore need to rename their methods to conform to the new API. Functionality remains the same.\n* this is a breaking change as modules will have to be imported differently: \n* https://www.typescriptlang.org/docs/handbook/esm-node.html\n* https://nodejs.org/api/esm.html\n* https://caniuse.com/?search=modules\n\ntest(did-provider-ion): skip a couple of tests that fail with unreasonable errors\nchore: use ubuntu-latest on CI\nfix: temporarily remove puppeteer tests\nfix: use craco for test-react-app to enable babel config\ntest: fix unit and integration tests (browser tests still broken)\nfix: fix some build issues that prevented tests from working\nfix: missing deps flagged by pnpm\n\n\n\n\n\n# [4.3.0](https://github.com/uport-project/veramo/compare/v4.2.0...v4.3.0) (2023-01-27)\n\n**Note:** Version bump only for package @veramo/data-store-json\n\n\n\n\n\n# [4.2.0](https://github.com/uport-project/veramo/compare/v4.1.2...v4.2.0) (2022-12-05)\n\n\n### Bug Fixes\n\n* **deps:** bump dependencies ([701b8ed](https://github.com/uport-project/veramo/commit/701b8edf981ea11c7ddb6a81d2817dbbdbb022f3))\n\n\n\n\n\n## [4.1.1](https://github.com/uport-project/veramo/compare/v4.1.0...v4.1.1) (2022-11-01)\n\n**Note:** Version bump only for package @veramo/data-store-json\n\n\n\n\n\n# [4.1.0](https://github.com/uport-project/veramo/compare/v4.0.2...v4.1.0) (2022-10-31)\n\n**Note:** Version bump only for package @veramo/data-store-json\n\n\n\n\n\n## [4.0.2](https://github.com/uport-project/veramo/compare/v4.0.1...v4.0.2) (2022-10-04)\n\n**Note:** Version bump only for package @veramo/data-store-json\n\n\n\n\n\n# [4.0.0](https://github.com/uport-project/veramo/compare/v3.1.5...v4.0.0) (2022-09-22)\n\n\n### Bug Fixes\n\n* **data-store-json:** structuredClone ([5369c28](https://github.com/uport-project/veramo/commit/5369c28517bd6539870fd2f4fafd9e3a357a6cf3))\n* **data-store-json:** structuredClone ([#885](https://github.com/uport-project/veramo/issues/885)) ([cf14cae](https://github.com/uport-project/veramo/commit/cf14caecda1248af431e60841170611bc3d1e3b9)), closes [#857](https://github.com/uport-project/veramo/issues/857)\n* **deps:** update dependency @ungap/structured-clone to v1 ([3d2a57b](https://github.com/uport-project/veramo/commit/3d2a57ba10d096af5dea19a59fc790c39fa94a5d))\n* update and fix inline documentation of all exported types ([#921](https://github.com/uport-project/veramo/issues/921)) ([63e64e0](https://github.com/uport-project/veramo/commit/63e64e0e2693808c4704dca8cc511dc0bab3f3b1))\n\n\n### Features\n\n* **credential-ld:** add support for browser environments ([#916](https://github.com/uport-project/veramo/issues/916)) ([435e4d2](https://github.com/uport-project/veramo/commit/435e4d260b1774f96b182c1a75ab2f1c993f2291))\n* **data-store-json:** BrowserLocalStorageStore ([#914](https://github.com/uport-project/veramo/issues/914)) ([7b520ab](https://github.com/uport-project/veramo/commit/7b520ab311bf55107bb0b4e6693695337b3fe200))\n* **date-store-json:** add JSON object storage implementation ([#819](https://github.com/uport-project/veramo/issues/819)) ([934b34a](https://github.com/uport-project/veramo/commit/934b34a18b194928f90e7797289cc6f2243789ec))\n"
  },
  {
    "path": "packages/data-store-json/LICENSE",
    "content": "                                 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 2022 Consensys AG\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"
  },
  {
    "path": "packages/data-store-json/README.md",
    "content": "# Veramo data store using JSON trees\n\nVeramo data storage based on JSON trees.\nThis package provides several plugins that relate to data storage that is backed up by a JSON tree.\n\n### `DataStoreJSON`\nA plugin that exposes simple store/get methods for messages, credentials and presentations.\nThis implements the `@veramo/data-store#DataStore` plugin interface.\n\n### `DataStoreORMJson`\nA plugin that provides more querying options using TypeORM.\nThis implements the `@veramo/data-store#DataStoreORM` plugin interface.\n\n### `KeyStore` and `DIDStore`\n\nImplementations of `AbstractKeyStore` and `AbstractDIDStore`\n"
  },
  {
    "path": "packages/data-store-json/api-extractor.json",
    "content": "{\n  \"$schema\": \"https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json\",\n  \"apiReport\": {\n    \"enabled\": true,\n    \"reportFolder\": \"./api\",\n    \"reportTempFolder\": \"./api\"\n  },\n\n  \"docModel\": {\n    \"enabled\": true,\n    \"apiJsonFilePath\": \"./api/<unscopedPackageName>.api.json\"\n  },\n\n  \"dtsRollup\": {\n    \"enabled\": false\n  },\n  \"mainEntryPointFilePath\": \"<projectFolder>/build/index.d.ts\"\n}\n"
  },
  {
    "path": "packages/data-store-json/package.json",
    "content": "{\n  \"name\": \"@veramo/data-store-json\",\n  \"description\": \"Veramo data storage based on a JSON tree\",\n  \"version\": \"7.0.0\",\n  \"main\": \"build/index.js\",\n  \"exports\": \"./build/index.js\",\n  \"types\": \"build/index.d.ts\",\n  \"scripts\": {\n    \"build\": \"tsc\",\n    \"extract-api\": \"node ../cli/bin/veramo.js dev extract-api\"\n  },\n  \"dependencies\": {\n    \"@ungap/structured-clone\": \"^1.2.0\",\n    \"@veramo/core-types\": \"workspace:^\",\n    \"@veramo/did-manager\": \"workspace:^\",\n    \"@veramo/key-manager\": \"workspace:^\",\n    \"@veramo/utils\": \"workspace:^\",\n    \"debug\": \"^4.3.3\",\n    \"did-jwt-vc\": \"^4.0.0\",\n    \"uuid\": \"^11.0.0\"\n  },\n  \"devDependencies\": {\n    \"@types/debug\": \"4.1.8\",\n    \"@types/ungap__structured-clone\": \"1.2.0\",\n    \"@types/uuid\": \"9.0.2\",\n    \"typescript\": \"5.7.3\"\n  },\n  \"files\": [\n    \"build/**/*\",\n    \"src/**/*\",\n    \"README.md\",\n    \"LICENSE\"\n  ],\n  \"publishConfig\": {\n    \"access\": \"public\"\n  },\n  \"repository\": {\n    \"type\": \"git\",\n    \"url\": \"https://github.com/decentralized-identity/veramo.git\",\n    \"directory\": \"packages/data-store-json\"\n  },\n  \"author\": \"Consensys Mesh R&D <hello@veramo.io>\",\n  \"contributors\": [\n    \"Mircea Nistor <mircea.nistor@mesh.xyz>\",\n    \"Simonas Karuzas <simonas.karuzas@mesh.xyz>\"\n  ],\n  \"keywords\": [\n    \"Veramo\",\n    \"DID\",\n    \"Verifiable Credential\",\n    \"data store\",\n    \"database\",\n    \"JSON\",\n    \"veramo-plugin\",\n    \"local-storage\",\n    \"session-storage\"\n  ],\n  \"license\": \"Apache-2.0\",\n  \"type\": \"module\",\n  \"moduleDirectories\": [\n    \"node_modules\",\n    \"src\"\n  ]\n}\n"
  },
  {
    "path": "packages/data-store-json/src/__tests__/data-store-orm-json.test.ts",
    "content": "// noinspection ES6PreferShortImport\n\nimport {\n  FindArgs,\n  IDataStore,\n  IDataStoreORM,\n  IMessage,\n  TAgent,\n  TCredentialColumns,\n  TMessageColumns,\n  TPresentationColumns,\n  VerifiableCredential,\n  VerifiablePresentation,\n} from '../../../core-types/src'\nimport { Agent } from '../../../core/src'\nimport { DataStoreJson } from '../data-store-json.js'\nimport { VeramoJsonStore } from '../types.js'\n\nconst did1 = 'did:test:111'\nconst did2 = 'did:test:222'\nconst did3 = 'did:test:333'\nconst did4 = 'did:test:444'\n\nasync function populateDB(agent: TAgent<IDataStore & IDataStoreORM>) {\n  const vc1: VerifiableCredential = {\n    '@context': ['https://www.w3.org/2018/credentials/v1323', 'https://www.w3.org/2020/demo/4342323'],\n    type: ['VerifiableCredential', 'PublicProfile'],\n    issuer: { id: did1 },\n    issuanceDate: new Date().toISOString(),\n    id: 'vc1',\n    credentialSubject: {\n      id: did2,\n      name: 'Alice',\n      profilePicture: 'https://example.com/a.png',\n      address: {\n        street: 'Some str.',\n        house: 1,\n      },\n    },\n    proof: {\n      jwt: 'mockJWT',\n    },\n  }\n\n  const vp1: VerifiablePresentation = {\n    '@context': ['https://www.w3.org/2018/credentials/v1323', 'https://www.w3.org/2020/demo/4342323'],\n    type: ['VerifiablePresentation', 'PublicProfile'],\n    holder: did1,\n    verifier: [did2],\n    issuanceDate: new Date().toISOString(),\n    verifiableCredential: [vc1],\n    proof: {\n      jwt: 'mockJWT',\n    },\n  }\n\n  const vp2: VerifiablePresentation = {\n    '@context': ['https://www.w3.org/2018/credentials/v1323', 'https://www.w3.org/2020/demo/4342323'],\n    type: ['VerifiablePresentation', 'PublicProfileMultiAudience'],\n    holder: did1,\n    verifier: [did2, did4],\n    issuanceDate: new Date().toISOString(),\n    verifiableCredential: [vc1],\n    proof: {\n      jwt: 'mockJWT',\n    },\n  }\n\n  const m1: IMessage = {\n    id: 'm1',\n    from: did1,\n    to: did2,\n    createdAt: '2020-06-16T11:06:51.680Z',\n    type: 'mock',\n    raw: 'mock',\n    credentials: [vc1],\n    presentations: [vp1],\n  }\n\n  const m2: IMessage = {\n    id: 'm2',\n    from: did1,\n    to: did1,\n    createdAt: '2020-06-16T11:07:51.680Z',\n    type: 'mock',\n    raw: 'mock234',\n  }\n\n  const m3: IMessage = {\n    id: 'm3',\n    from: did3,\n    to: did2,\n    createdAt: '2020-06-16T11:08:51.680Z',\n    type: 'mock',\n    raw: 'mock678',\n  }\n\n  const m4: IMessage = {\n    id: 'm4',\n    from: did1,\n    to: did2,\n    createdAt: '2020-06-16T11:09:51.680Z',\n    type: 'mock',\n    raw: 'mockmoreaudienct',\n    credentials: [vc1],\n    presentations: [vp2],\n  }\n  await agent.dataStoreSaveMessage({ message: m1 })\n  await agent.dataStoreSaveMessage({ message: m2 })\n  await agent.dataStoreSaveMessage({ message: m3 })\n  await agent.dataStoreSaveMessage({ message: m4 })\n}\n\nlet dataStore: VeramoJsonStore\n\ndescribe('@veramo/data-store queries', () => {\n  function makeAgent(context?: Record<string, any>): TAgent<IDataStore & IDataStoreORM> {\n    // @ts-ignore\n    return new Agent({\n      context,\n      plugins: [new DataStoreJson(dataStore)],\n    })\n  }\n\n  beforeEach(async () => {\n    dataStore = { notifyUpdate: () => Promise.resolve() }\n    await populateDB(makeAgent())\n  })\n\n  test('search presentations by verifier', async () => {\n    const agent = makeAgent()\n    const args: FindArgs<TPresentationColumns> = {\n      where: [\n        {\n          column: 'verifier',\n          value: [did4],\n          op: 'In',\n        },\n      ],\n    }\n\n    let presentations = await makeAgent().dataStoreORMGetVerifiablePresentations(args)\n    expect(presentations.length).toBe(1)\n    let count = await agent.dataStoreORMGetVerifiablePresentationsCount(args)\n    expect(count).toBe(1)\n    // search when authenticated as the issuer\n    let authorizedDID = did1\n\n    presentations = await makeAgent({ authorizedDID }).dataStoreORMGetVerifiablePresentations(args)\n    expect(presentations.length).toBe(1)\n    count = await makeAgent({ authorizedDID }).dataStoreORMGetVerifiablePresentationsCount(args)\n    expect(count).toBe(1)\n\n    // search when authenticated as another did\n    authorizedDID = did3\n\n    presentations = await makeAgent({ authorizedDID }).dataStoreORMGetVerifiablePresentations(args)\n    expect(presentations.length).toEqual(0)\n    count = await makeAgent({ authorizedDID }).dataStoreORMGetVerifiablePresentationsCount(args)\n    expect(count).toBe(0)\n  })\n\n  test('without auth it fetches all messages that match the query', async () => {\n    const args: FindArgs<TMessageColumns> = {\n      where: [\n        {\n          column: 'type',\n          value: ['mock'],\n          op: 'In',\n        },\n      ],\n    }\n\n    const messages = await makeAgent().dataStoreORMGetMessages(args)\n    expect(messages.length).toBe(4)\n\n    const count = await makeAgent().dataStoreORMGetMessagesCount(args)\n    expect(count).toBe(4)\n  })\n\n  test('with auth it only gets messages for the authorized identifier', async () => {\n    const args: FindArgs<TMessageColumns> = {\n      where: [\n        {\n          column: 'type',\n          value: ['mock'],\n          op: 'In',\n        },\n      ],\n    }\n    const authorizedDID = did1\n\n    const messages = await makeAgent({ authorizedDID }).dataStoreORMGetMessages(args)\n    expect(messages.length).toBe(3)\n    const count = await makeAgent({ authorizedDID }).dataStoreORMGetMessagesCount(args)\n    expect(count).toBe(3)\n  })\n\n  test('supports ordering', async () => {\n    const agent = makeAgent()\n    const args: FindArgs<TMessageColumns> = {\n      where: [\n        {\n          column: 'type',\n          value: ['mock'],\n          op: 'In',\n        },\n      ],\n      order: [\n        {\n          column: 'createdAt',\n          direction: 'DESC',\n        },\n      ],\n    }\n\n    const messages = await agent.dataStoreORMGetMessages(args)\n    expect(new Date('' + messages[0].createdAt).getTime()).toBeGreaterThan(\n      new Date('' + messages[1].createdAt).getTime(),\n    )\n\n    const args2: FindArgs<TMessageColumns> = {\n      where: [\n        {\n          column: 'type',\n          value: ['mock'],\n          op: 'In',\n        },\n      ],\n      order: [\n        {\n          column: 'createdAt',\n          direction: 'ASC',\n        },\n      ],\n    }\n\n    const messages2 = await agent.dataStoreORMGetMessages(args2)\n    expect(new Date('' + messages2[0].createdAt).getTime()).toBeLessThan(\n      new Date('' + messages2[1].createdAt).getTime(),\n    )\n  })\n\n  test('works with relations', async () => {\n    const credentials = await makeAgent().dataStoreORMGetVerifiableCredentialsByClaims({})\n    expect(credentials.length).toBe(1)\n    expect(credentials[0].verifiableCredential.id).toBe('vc1')\n    const count = await makeAgent().dataStoreORMGetVerifiableCredentialsByClaimsCount({})\n    expect(count).toBe(1)\n\n    const credentials2 = await makeAgent({\n      authorizedDID: did3,\n    }).dataStoreORMGetVerifiableCredentialsByClaims({})\n    expect(credentials2.length).toBe(0)\n    const count2 = await makeAgent({\n      authorizedDID: did3,\n    }).dataStoreORMGetVerifiableCredentialsByClaimsCount({})\n    expect(count2).toBe(0)\n  })\n\n  test('multiple audience members can retrieve a credential', async () => {\n    const args: FindArgs<TPresentationColumns> = {\n      where: [\n        {\n          column: 'type',\n          value: ['VerifiablePresentation,PublicProfileMultiAudience'],\n          op: 'Equal',\n        },\n      ],\n    }\n\n    let presentations = await makeAgent({ authorizedDID: did1 }).dataStoreORMGetVerifiablePresentations(args)\n    expect(presentations.length).toBe(1)\n\n    presentations = await makeAgent({ authorizedDID: did2 }).dataStoreORMGetVerifiablePresentations(args)\n    expect(presentations.length).toBe(1)\n\n    presentations = await makeAgent({ authorizedDID: did4 }).dataStoreORMGetVerifiablePresentations(args)\n    expect(presentations.length).toBe(1)\n\n    presentations = await makeAgent({ authorizedDID: did3 }).dataStoreORMGetVerifiablePresentations(args)\n    expect(presentations.length).toBe(0)\n  })\n\n  test('store credential and retrieve by id', async () => {\n    const vc5: VerifiableCredential = {\n      '@context': ['https://www.w3.org/2018/credentials/v1323', 'https://www.w3.org/2020/demo/4342323'],\n      type: ['VerifiableCredential', 'PublicProfile'],\n      issuer: { id: did1 },\n      issuanceDate: new Date().toISOString(),\n      id: 'vc5',\n      credentialSubject: {\n        id: did2,\n        name: 'Alice',\n        profilePicture: 'https://example.com/a.png',\n        address: {\n          street: 'Some str.',\n          house: 1,\n        },\n      },\n      proof: {\n        jwt: 'mockJWT',\n      },\n    }\n\n    const agent = makeAgent()\n    await agent.dataStoreSaveVerifiableCredential({ verifiableCredential: vc5 })\n\n    const args: FindArgs<TCredentialColumns> = {\n      where: [\n        {\n          column: 'id',\n          value: ['vc5'],\n        },\n      ],\n      order: [{ column: 'issuanceDate', direction: 'DESC' }],\n    }\n\n    const credentials = await agent.dataStoreORMGetVerifiableCredentials(args)\n    expect(credentials[0].verifiableCredential.id).toEqual('vc5')\n    const count = await agent.dataStoreORMGetVerifiableCredentialsCount(args)\n    expect(count).toEqual(1)\n  })\n\n  test('store presentation and retrieve by context and type', async () => {\n    const vc6: VerifiableCredential = {\n      '@context': ['https://www.w3.org/2018/credentials/v1323', 'https://www.w3.org/2020/demo/666'],\n      type: ['VerifiableCredential', 'PublicProfile6'],\n      issuer: { id: did1 },\n      issuanceDate: new Date().toISOString(),\n      id: 'vc6',\n      credentialSubject: {\n        id: did2,\n        name: 'Alice',\n        profilePicture: 'https://example.com/a.png',\n        address: {\n          street: 'Some str.',\n          house: 1,\n        },\n      },\n      proof: {\n        jwt: 'mockJWT',\n      },\n    }\n\n    const vp6: VerifiablePresentation = {\n      '@context': ['https://www.w3.org/2018/credentials/v1323', 'https://www.w3.org/2020/demo/99999966666'],\n      type: ['VerifiablePresentation', 'PublicProfile6666'],\n      holder: did1,\n      verifier: [did2],\n      issuanceDate: new Date().toISOString(),\n      verifiableCredential: [vc6],\n      proof: {\n        jwt: 'mockJWT',\n      },\n    }\n\n    const agent = makeAgent()\n    await agent.dataStoreSaveVerifiablePresentation({ verifiablePresentation: vp6 })\n\n    const args: FindArgs<TPresentationColumns> = {\n      where: [\n        {\n          column: 'type',\n          value: ['VerifiablePresentation,PublicProfile6666'],\n        },\n        {\n          column: 'context',\n          value: ['https://www.w3.org/2018/credentials/v1323,https://www.w3.org/2020/demo/99999966666'],\n        },\n      ],\n    }\n\n    const presentations = await agent.dataStoreORMGetVerifiablePresentations(args)\n    const cred0 = presentations[0].verifiablePresentation.verifiableCredential?.[0] as VerifiableCredential\n    expect(cred0.id).toEqual('vc6')\n  })\n\n  it('should query identifiers', async () => {\n    const agent = makeAgent()\n    const identifiers = await agent.dataStoreORMGetIdentifiers()\n    expect(identifiers.length).toEqual(4)\n\n    const count = await agent.dataStoreORMGetIdentifiersCount()\n    expect(count).toEqual(4)\n  })\n})\n"
  },
  {
    "path": "packages/data-store-json/src/browser-local-storage-store.ts",
    "content": "import { IIdentifier, IMessage, ManagedKeyInfo } from '@veramo/core-types'\nimport { ManagedPrivateKey } from '@veramo/key-manager'\nimport {\n  DiffCallback,\n  VeramoJsonCache,\n  ClaimTableEntry,\n  CredentialTableEntry,\n  PresentationTableEntry,\n  VeramoJsonStore,\n} from './types.js'\n\n/**\n * Implementation of {@link VeramoJsonStore} that uses browser localStorage to store data.\n * \n * @example\n * ```\n * const dataStore = BrowserLocalStorageStore.fromLocalStorage('veramo-state')\n * const plugin = new DataStoreJson(dataStore)\n * ```\n *\n * @public\n */\nexport class BrowserLocalStorageStore implements VeramoJsonStore {\n  notifyUpdate: DiffCallback\n  dids: Record<string, IIdentifier>\n  keys: Record<string, ManagedKeyInfo>\n  privateKeys: Record<string, ManagedPrivateKey>\n  credentials: Record<string, CredentialTableEntry>\n  claims: Record<string, ClaimTableEntry>\n  presentations: Record<string, PresentationTableEntry>\n  messages: Record<string, IMessage>\n\n  private constructor(private localStorageKey: string) {\n    this.notifyUpdate = async (\n      oldState: VeramoJsonCache,\n      newState: VeramoJsonCache,\n    ) => {\n      this.save(newState)\n    }\n    this.dids = {}\n    this.keys = {}\n    this.privateKeys = {}\n    this.credentials = {}\n    this.claims = {}\n    this.presentations = {}\n    this.messages = {}\n  }\n\n  public static fromLocalStorage(localStorageKey: string): BrowserLocalStorageStore {\n    const store = new BrowserLocalStorageStore(localStorageKey)\n    return store.load()\n  }\n\n  private load(): BrowserLocalStorageStore {\n    if (typeof window !== 'undefined') {\n      const rawCache = window.localStorage.getItem(this.localStorageKey) || '{}'\n      let cache: VeramoJsonCache\n      try {\n        cache = JSON.parse(rawCache)\n      } catch (e: any) {\n        cache = {}\n      }\n      ({\n        dids: this.dids,\n        keys: this.keys,\n        credentials: this.credentials,\n        claims: this.claims,\n        presentations: this.presentations,\n        messages: this.messages,\n        privateKeys: this.privateKeys,\n      } = {\n        dids: {},\n        keys: {},\n        credentials: {},\n        claims: {},\n        presentations: {},\n        messages: {},\n        privateKeys: {},\n        ...cache,\n      })\n    }\n    return this\n  }\n\n  private save(newState: VeramoJsonCache): void {\n    if (typeof window !== 'undefined') {\n      window.localStorage.setItem(this.localStorageKey, JSON.stringify(newState))\n    }\n  }\n\n}\n"
  },
  {
    "path": "packages/data-store-json/src/data-store-json.ts",
    "content": "import {\n  ALLOWED_COLUMNS,\n  AuthorizedDIDContext,\n  FindArgs,\n  IAgentPlugin,\n  IDataStore,\n  IDataStoreDeleteMessageArgs,\n  IDataStoreDeleteVerifiableCredentialArgs,\n  IDataStoreGetMessageArgs,\n  IDataStoreGetVerifiableCredentialArgs,\n  IDataStoreGetVerifiablePresentationArgs,\n  IDataStoreORM,\n  IDataStoreSaveMessageArgs,\n  IDataStoreSaveVerifiableCredentialArgs,\n  IDataStoreSaveVerifiablePresentationArgs,\n  IIdentifier,\n  IMessage,\n  TClaimsColumns,\n  TCredentialColumns,\n  TIdentifiersColumns,\n  TMessageColumns,\n  TPresentationColumns,\n  UniqueVerifiableCredential,\n  UniqueVerifiablePresentation,\n  VerifiableCredential,\n  VerifiablePresentation,\n  W3CVerifiableCredential,\n} from '@veramo/core-types'\nimport { schema } from '@veramo/core-types'\nimport { asArray, computeEntryHash, extractIssuer } from '@veramo/utils'\nimport { deserialize, serialize } from '@ungap/structured-clone'\nimport {\n  ClaimTableEntry,\n  CredentialTableEntry,\n  DiffCallback,\n  PresentationTableEntry,\n  VeramoJsonCache,\n  VeramoJsonStore,\n} from './types.js'\nimport { normalizeCredential } from 'did-jwt-vc'\n\ntype LocalRecords = Required<\n  Pick<VeramoJsonCache, 'dids' | 'credentials' | 'presentations' | 'claims' | 'messages'>\n>\n\n/**\n * A Veramo agent storage plugin that implements the {@link @veramo/core-types#IDataStore | IDataStore} and\n * {@link @veramo/core-types#IDataStoreORM | IDataStoreORM} methods using one big JSON object as a backend.\n *\n * Each update operation triggers a callback that can be used to either save the latest state of the agent data or\n * compute a diff and log only the changes.\n *\n * This plugin must be initialized with a {@link VeramoJsonStore}, which serves as the JSON object storing data in\n * memory as well as providing an update notification callback to persist this data.\n * The JSON object can be pre-populated with data from previous sessions.\n *\n * @beta This API may change without a BREAKING CHANGE notice.\n */\nexport class DataStoreJson implements IAgentPlugin {\n  readonly methods: IDataStore & IDataStoreORM\n  readonly schema = { ...schema.IDataStore, ...schema.IDataStoreORM }\n\n  private readonly cacheTree: LocalRecords\n  private readonly notifyUpdate: DiffCallback\n\n  /**\n   * @param jsonStore - A reference to the JSON object that holds the data in memory and implements an update callback.\n   *   This object can be pre-populated with data from previous sessions, and will be used by reference.\n   */\n  constructor(jsonStore: VeramoJsonStore) {\n    this.notifyUpdate = jsonStore.notifyUpdate\n    this.cacheTree = jsonStore as LocalRecords\n    const tables = ['dids', 'credentials', 'presentations', 'claims', 'messages'] as (keyof LocalRecords)[]\n    for (const table of tables) {\n      if (!this.cacheTree[table]) {\n        this.cacheTree[table] = {}\n      }\n    }\n\n    this.methods = {\n      // IDataStore methods\n      dataStoreSaveMessage: this.dataStoreSaveMessage.bind(this),\n      dataStoreGetMessage: this.dataStoreGetMessage.bind(this),\n      dataStoreDeleteMessage: this.dataStoreDeleteMessage.bind(this),\n      dataStoreSaveVerifiableCredential: this.dataStoreSaveVerifiableCredential.bind(this),\n      dataStoreGetVerifiableCredential: this.dataStoreGetVerifiableCredential.bind(this),\n      dataStoreDeleteVerifiableCredential: this.dataStoreDeleteVerifiableCredential.bind(this),\n      dataStoreSaveVerifiablePresentation: this.dataStoreSaveVerifiablePresentation.bind(this),\n      dataStoreGetVerifiablePresentation: this.dataStoreGetVerifiablePresentation.bind(this),\n\n      // IDataStoreORM methods\n      dataStoreORMGetIdentifiers: this.dataStoreORMGetIdentifiers.bind(this),\n      dataStoreORMGetIdentifiersCount: this.dataStoreORMGetIdentifiersCount.bind(this),\n      dataStoreORMGetMessages: this.dataStoreORMGetMessages.bind(this),\n      dataStoreORMGetMessagesCount: this.dataStoreORMGetMessagesCount.bind(this),\n      dataStoreORMGetVerifiableCredentialsByClaims:\n        this.dataStoreORMGetVerifiableCredentialsByClaims.bind(this),\n      dataStoreORMGetVerifiableCredentialsByClaimsCount:\n        this.dataStoreORMGetVerifiableCredentialsByClaimsCount.bind(this),\n      dataStoreORMGetVerifiableCredentials: this.dataStoreORMGetVerifiableCredentials.bind(this),\n      dataStoreORMGetVerifiableCredentialsCount: this.dataStoreORMGetVerifiableCredentialsCount.bind(this),\n      dataStoreORMGetVerifiablePresentations: this.dataStoreORMGetVerifiablePresentations.bind(this),\n      dataStoreORMGetVerifiablePresentationsCount:\n        this.dataStoreORMGetVerifiablePresentationsCount.bind(this),\n    }\n  }\n\n  async dataStoreSaveMessage(args: IDataStoreSaveMessageArgs): Promise<string> {\n    const id = args.message?.id || computeEntryHash(args.message)\n    const message = { ...args.message, id }\n    const oldTree = deserialize(serialize(this.cacheTree, { lossy: true }))\n    this.cacheTree.messages[id] = message\n    // TODO: deprecate automatic credential and presentation saving\n    const credentials = asArray(message.credentials)\n    const presentations = asArray(message.presentations)\n    for (const verifiableCredential of credentials) {\n      await this._dataStoreSaveVerifiableCredential({ verifiableCredential }, false)\n    }\n    for (const verifiablePresentation of presentations) {\n      await this._dataStoreSaveVerifiablePresentation({ verifiablePresentation }, false)\n    }\n    // adding dummy DIDs is required to make `dataStoreORMGetIdentifiers` work\n    if (message?.from && !this.cacheTree.dids[message.from]) {\n      this.cacheTree.dids[message.from] = { did: message.from, provider: '', keys: [], services: [] }\n    }\n    asArray(message.to).forEach((did: string) => {\n      if (!this.cacheTree.dids[did]) {\n        this.cacheTree.dids[did] = { did, provider: '', keys: [], services: [] }\n      }\n    })\n    await this.notifyUpdate(oldTree, this.cacheTree)\n    return message.id\n  }\n\n  async dataStoreGetMessage(args: IDataStoreGetMessageArgs): Promise<IMessage> {\n    const message = this.cacheTree.messages[args.id]\n    if (message) {\n      return message\n    } else {\n      throw Error('Message not found')\n    }\n  }\n\n  async dataStoreDeleteMessage(args: IDataStoreDeleteMessageArgs): Promise<boolean> {\n    const message = this.cacheTree.messages[args.id]\n    if (message) {\n      const oldTree = deserialize(serialize(this.cacheTree, { lossy: true }))\n      delete this.cacheTree.messages[args.id]\n      await this.notifyUpdate(oldTree, this.cacheTree)\n      return true\n    } else {\n      return false\n    }\n  }\n\n  private async _dataStoreSaveVerifiableCredential(\n    args: IDataStoreSaveVerifiableCredentialArgs,\n    postUpdates: boolean = true,\n  ): Promise<string> {\n    const canonicalCredential =\n      args?.verifiableCredential?.proof?.type === 'JwtProof2020' &&\n      typeof args?.verifiableCredential?.proof?.jwt === 'string'\n        ? args?.verifiableCredential?.proof?.jwt\n        : args.verifiableCredential\n    const vc = args.verifiableCredential\n    const id = vc.id\n    const hash = computeEntryHash(canonicalCredential)\n    const issuer = extractIssuer(vc)\n    const subject = vc.credentialSubject.id\n    const context = asArray(vc['@context'])\n    const type = asArray(vc.type)\n    let issuanceDate: Date | undefined = undefined\n    let expirationDate: Date | undefined = undefined\n\n    if (vc.issuanceDate) {\n      issuanceDate = new Date(vc.issuanceDate)\n    }\n    if (vc.expirationDate) {\n      expirationDate = new Date(vc.expirationDate)\n    }\n\n    const credential: CredentialTableEntry = {\n      hash,\n      id,\n      parsedCredential: vc,\n      canonicalCredential,\n      issuer,\n      subject,\n      issuanceDate,\n      expirationDate,\n      context,\n      type,\n    }\n\n    const claims: ClaimTableEntry[] = []\n\n    for (const claimType in vc.credentialSubject) {\n      if (vc.credentialSubject.hasOwnProperty(claimType)) {\n        const value = vc.credentialSubject[claimType]\n        if (claimType !== 'id') {\n          const claim = {\n            hash: computeEntryHash(hash + claimType),\n            type: claimType,\n            value,\n            issuer,\n            subject,\n            issuanceDate,\n            expirationDate,\n            context: context,\n            credentialType: type,\n            credentialHash: hash,\n          }\n          claims.push(claim)\n        }\n      }\n    }\n\n    let oldTree: VeramoJsonCache\n    if (postUpdates) {\n      oldTree = deserialize(serialize(this.cacheTree, { lossy: true }))\n    }\n    this.cacheTree.credentials[hash] = credential\n    for (const claim of claims) {\n      this.cacheTree.claims[claim.hash] = claim\n    }\n    // adding dummy DIDs is required to make `dataStoreORMGetIdentifiers` work\n    if (issuer && !this.cacheTree.dids[issuer]) {\n      this.cacheTree.dids[issuer] = { did: issuer, provider: '', keys: [], services: [] }\n    }\n    if (subject && !this.cacheTree.dids[subject]) {\n      this.cacheTree.dids[subject] = { did: subject, provider: '', keys: [], services: [] }\n    }\n    if (postUpdates) {\n      await this.notifyUpdate(oldTree!!, this.cacheTree)\n    }\n    return credential.hash\n  }\n\n  async dataStoreSaveVerifiableCredential(args: IDataStoreSaveVerifiableCredentialArgs): Promise<string> {\n    return this._dataStoreSaveVerifiableCredential(args)\n  }\n\n  async dataStoreDeleteVerifiableCredential(\n    args: IDataStoreDeleteVerifiableCredentialArgs,\n  ): Promise<boolean> {\n    const credential = this.cacheTree.credentials[args.hash]\n    if (credential) {\n      const claims = Object.values(this.cacheTree.claims)\n        .filter((claim) => claim.credentialHash === credential.hash)\n        .map((claim) => claim.hash)\n      const oldTree = deserialize(serialize(this.cacheTree, { lossy: true }))\n      delete this.cacheTree.credentials[args.hash]\n      for (const claimHash of claims) {\n        delete this.cacheTree.claims[claimHash]\n      }\n      await this.notifyUpdate(oldTree, this.cacheTree)\n      return true\n    }\n    return false\n  }\n\n  async dataStoreGetVerifiableCredential(\n    args: IDataStoreGetVerifiableCredentialArgs,\n  ): Promise<VerifiableCredential> {\n    const credentialEntity = this.cacheTree.credentials[args.hash]\n    if (credentialEntity) {\n      const { parsedCredential } = credentialEntity\n      return deserialize(serialize(parsedCredential))\n    } else {\n      throw Error('Verifiable credential not found')\n    }\n  }\n\n  private async _dataStoreSaveVerifiablePresentation(\n    args: IDataStoreSaveVerifiablePresentationArgs,\n    postUpdates: boolean = true,\n  ): Promise<string> {\n    const vp = args.verifiablePresentation\n    const canonicalPresentation =\n      vp?.proof?.type === 'JwtProof2020' && typeof vp?.proof?.jwt === 'string' ? vp?.proof?.jwt : vp\n\n    const id = vp.id\n    const hash = computeEntryHash(canonicalPresentation)\n    const holder = extractIssuer(vp)\n    const verifier = asArray(vp.verifier)\n    const context = asArray(vp['@context'])\n    const type = asArray(vp.type)\n    let issuanceDate: Date | undefined = undefined\n    let expirationDate: Date | undefined = undefined\n\n    if (vp.issuanceDate) {\n      issuanceDate = new Date(vp.issuanceDate)\n    }\n    if (vp.expirationDate) {\n      expirationDate = new Date(vp.expirationDate)\n    }\n\n    const credentials: VerifiableCredential[] = asArray(vp.verifiableCredential).map(\n      (cred: W3CVerifiableCredential) => {\n        if (typeof cred === 'string') {\n          return normalizeCredential(cred)\n        } else {\n          return <VerifiableCredential>cred\n        }\n      },\n    )\n\n    const presentation: PresentationTableEntry = {\n      hash,\n      id,\n      parsedPresentation: vp,\n      canonicalPresentation,\n      holder,\n      verifier,\n      issuanceDate,\n      expirationDate,\n      context,\n      type,\n      credentials,\n    }\n\n    let oldTree: VeramoJsonCache\n    if (postUpdates) {\n      oldTree = deserialize(serialize(this.cacheTree, { lossy: true }))\n    }\n\n    this.cacheTree.presentations[hash] = presentation\n    for (const verifiableCredential of credentials) {\n      await this._dataStoreSaveVerifiableCredential({ verifiableCredential }, false)\n    }\n    // adding dummy DIDs is required to make `dataStoreORMGetIdentifiers` work\n    if (holder && !this.cacheTree.dids[holder]) {\n      this.cacheTree.dids[holder] = { did: holder, provider: '', keys: [], services: [] }\n    }\n    asArray(verifier).forEach((did) => {\n      if (!this.cacheTree.dids[did]) {\n        this.cacheTree.dids[did] = { did, provider: '', keys: [], services: [] }\n      }\n    })\n    if (postUpdates) {\n      await this.notifyUpdate(oldTree!!, this.cacheTree)\n    }\n    return hash\n  }\n\n  async dataStoreSaveVerifiablePresentation(args: IDataStoreSaveVerifiablePresentationArgs): Promise<string> {\n    return this._dataStoreSaveVerifiablePresentation(args)\n  }\n\n  async dataStoreGetVerifiablePresentation(\n    args: IDataStoreGetVerifiablePresentationArgs,\n  ): Promise<VerifiablePresentation> {\n    const presentationEntry = this.cacheTree.presentations[args.hash]\n    if (presentationEntry) {\n      const { parsedPresentation } = presentationEntry\n      return parsedPresentation\n    } else {\n      throw Error('Verifiable presentation not found')\n    }\n  }\n\n  async dataStoreORMGetIdentifiers(\n    args: FindArgs<TIdentifiersColumns>,\n    context: AuthorizedDIDContext,\n  ): Promise<IIdentifier[]> {\n    const identifiers = buildQuery(Object.values(this.cacheTree.dids), args, ['did'], context.authorizedDID)\n    // FIXME: collect corresponding keys from `this.cacheTree.keys`?\n    return deserialize(serialize(identifiers))\n  }\n\n  async dataStoreORMGetIdentifiersCount(\n    args: FindArgs<TIdentifiersColumns>,\n    context: AuthorizedDIDContext,\n  ): Promise<number> {\n    return (await this.dataStoreORMGetIdentifiers(args, context)).length\n  }\n\n  async dataStoreORMGetMessages(\n    args: FindArgs<TMessageColumns>,\n    context: AuthorizedDIDContext,\n  ): Promise<IMessage[]> {\n    const messages = buildQuery(\n      Object.values(this.cacheTree.messages),\n      args,\n      ['to', 'from'],\n      context.authorizedDID,\n    )\n    return deserialize(serialize(messages))\n  }\n\n  async dataStoreORMGetMessagesCount(\n    args: FindArgs<TMessageColumns>,\n    context: AuthorizedDIDContext,\n  ): Promise<number> {\n    return (await this.dataStoreORMGetMessages(args, context)).length\n  }\n\n  async dataStoreORMGetVerifiableCredentialsByClaims(\n    args: FindArgs<TClaimsColumns>,\n    context: AuthorizedDIDContext,\n  ): Promise<Array<UniqueVerifiableCredential>> {\n    const filteredClaims = buildQuery(\n      Object.values(this.cacheTree.claims),\n      args,\n      ['issuer', 'subject'],\n      context.authorizedDID,\n    )\n\n    let filteredCredentials = new Set<CredentialTableEntry>()\n    filteredClaims.forEach((claim) => {\n      filteredCredentials.add(this.cacheTree.credentials[claim.credentialHash])\n    })\n\n    return deserialize(\n      serialize(\n        Array.from(filteredCredentials).map((cred) => {\n          const { hash, parsedCredential } = cred\n          return {\n            hash,\n            verifiableCredential: parsedCredential,\n          }\n        }),\n      ),\n    )\n  }\n\n  async dataStoreORMGetVerifiableCredentialsByClaimsCount(\n    args: FindArgs<TClaimsColumns>,\n    context: AuthorizedDIDContext,\n  ): Promise<number> {\n    return (await this.dataStoreORMGetVerifiableCredentialsByClaims(args, context)).length\n  }\n\n  async dataStoreORMGetVerifiableCredentials(\n    args: FindArgs<TCredentialColumns>,\n    context: AuthorizedDIDContext,\n  ): Promise<Array<UniqueVerifiableCredential>> {\n    const credentials = buildQuery(\n      Object.values(this.cacheTree.credentials),\n      args,\n      ['issuer', 'subject'],\n      context.authorizedDID,\n    )\n\n    return deserialize(\n      serialize(\n        credentials.map((cred: any) => {\n          const { hash, parsedCredential } = cred\n          return {\n            hash,\n            verifiableCredential: parsedCredential,\n          }\n        }),\n      ),\n    )\n  }\n\n  async dataStoreORMGetVerifiableCredentialsCount(\n    args: FindArgs<TCredentialColumns>,\n    context: AuthorizedDIDContext,\n  ): Promise<number> {\n    return (await this.dataStoreORMGetVerifiableCredentials(args, context)).length\n  }\n\n  async dataStoreORMGetVerifiablePresentations(\n    args: FindArgs<TPresentationColumns>,\n    context: AuthorizedDIDContext,\n  ): Promise<Array<UniqueVerifiablePresentation>> {\n    const presentations = buildQuery(\n      Object.values(this.cacheTree.presentations),\n      args,\n      ['holder', 'verifier'],\n      context.authorizedDID,\n    )\n\n    return deserialize(\n      serialize(\n        presentations.map((pres: any) => {\n          const { hash, parsedPresentation } = pres\n          return {\n            hash,\n            verifiablePresentation: parsedPresentation,\n          }\n        }),\n      ),\n    )\n  }\n\n  async dataStoreORMGetVerifiablePresentationsCount(\n    args: FindArgs<TPresentationColumns>,\n    context: AuthorizedDIDContext,\n  ): Promise<number> {\n    return (await this.dataStoreORMGetVerifiablePresentations(args, context)).length\n  }\n}\n\nfunction buildFilter<T extends Partial<Record<PossibleColumns, any>>>(\n  target: T,\n  input: FindArgs<PossibleColumns>,\n): boolean {\n  let condition = true\n  if (input?.where) {\n    for (const item of input.where) {\n      let newCondition: boolean\n      const targetValue = (target as any)[item.column]\n      switch (item.op) {\n        case 'Between':\n          if (item.value?.length != 2) throw Error('Operation Between requires two values')\n          newCondition = item.value[0] <= targetValue && targetValue <= item.value[1]\n          break\n        case 'Equal':\n          if (item.value?.length != 1) throw Error('Operation Equal requires one value')\n          newCondition = item.value[0] === targetValue\n          if (Array.isArray(targetValue)) {\n            // mimicking legacy SQL data-store behavior where array values are stored as joined strings\n            newCondition ||= targetValue.join(',').includes(item.value[0])\n          }\n          break\n        case 'IsNull':\n          newCondition = targetValue === null || typeof targetValue === 'undefined'\n          break\n        case 'LessThan':\n          if (item.value?.length != 1) throw Error('Operation LessThan requires one value')\n          newCondition = targetValue < item.value\n          break\n        case 'LessThanOrEqual':\n          if (item.value?.length != 1) throw Error('Operation LessThanOrEqual requires one value')\n          newCondition = targetValue <= item.value\n          break\n        case 'Like':\n          if (item.value?.length != 1) throw Error('Operation Like requires one value')\n          // FIXME: add support for escaping\n          const likeExpression = `^${(item.value?.[0] || '').replace(/_/g, '.').replace(/%/g, '.*')}$`\n          newCondition = new RegExp(likeExpression).test(targetValue)\n          break\n        case 'MoreThan':\n          if (item.value?.length != 1) throw Error('Operation MoreThan requires one value')\n          newCondition = targetValue > item.value\n          break\n        case 'MoreThanOrEqual':\n          if (item.value?.length != 1) throw Error('Operation MoreThanOrEqual requires one value')\n          newCondition = targetValue >= item.value\n          break\n        case 'Any':\n        case 'In':\n        default:\n          if (!Array.isArray(item.value)) throw Error('Operator Any requires value to be an array')\n\n          if (Array.isArray(targetValue)) {\n            newCondition = item.value.find((val) => targetValue.includes(val)) !== undefined\n            // mimicking legacy SQL data-store behavior where array values are stored as joined strings\n            newCondition ||= targetValue.join(',').includes(item.value.join(','))\n          } else {\n            newCondition = item.value.includes(targetValue)\n          }\n          break\n      }\n      if (item.not === true) {\n        newCondition = !newCondition\n      }\n      condition &&= newCondition\n    }\n  }\n  return condition\n}\n\ntype PossibleColumns =\n  | TMessageColumns\n  | TClaimsColumns\n  | TCredentialColumns\n  | TPresentationColumns\n  | TIdentifiersColumns\n\nfunction buildQuery<T extends Partial<Record<PossibleColumns, any>>>(\n  targetCollection: T[],\n  input: FindArgs<PossibleColumns>,\n  authFilterColumns: string[],\n  authFilterValue?: string,\n): T[] {\n  let filteredCollection = targetCollection.filter((target) => buildFilter(target, input))\n  if (authFilterValue) {\n    filteredCollection = filteredCollection.filter((target) => {\n      let columnValues: string[] = []\n      for (const column of authFilterColumns) {\n        columnValues = [...columnValues, ...asArray((target as any)[column])]\n      }\n      return columnValues.includes(authFilterValue)\n    })\n  }\n\n  const allowedColumns = Object.values(ALLOWED_COLUMNS).flat()\n\n  if (input.order && input.order.length > 0) {\n    filteredCollection.sort((a: T, b: T) => {\n      let result = 0\n      let orderIndex = 0\n      while (result == 0 && input.order?.[orderIndex]) {\n        const direction = input.order?.[orderIndex].direction === 'DESC' ? -1 : 1\n        const col: PossibleColumns = input.order?.[orderIndex]?.column\n        if (!col) {\n          break\n        }\n        if (!allowedColumns.includes(col)) {\n          throw new Error(`Invalid column name: ${col}`)\n        }\n        const colA = a[col]\n        const colB = b[col]\n        if (typeof colA?.getTime === 'function') {\n          const aTime = colA.getTime()\n          const bTime = typeof colB?.getTime === 'function' ? colB.getTime() : 0\n          result = direction * (aTime - bTime || 0)\n        } else if (typeof colA?.localeCompare === 'function') {\n          result = direction * colA.localeCompare(colB)\n        } else {\n          result = direction * (colA - colB || 0)\n        }\n        orderIndex++\n      }\n      return result\n    })\n  }\n\n  if (input.skip) {\n    filteredCollection = filteredCollection.slice(input.skip)\n  }\n  if (input.take) {\n    const start = (input.skip && input.skip - 1) || 0\n    const end = start + input.take\n    filteredCollection = filteredCollection.slice(start, end)\n  }\n\n  return filteredCollection\n}\n"
  },
  {
    "path": "packages/data-store-json/src/identifier/did-store.ts",
    "content": "import { IIdentifier } from '@veramo/core-types'\nimport { AbstractDIDStore } from '@veramo/did-manager'\n\nimport Debug from 'debug'\nimport { DiffCallback, VeramoJsonCache, VeramoJsonStore } from '../types.js'\nimport { serialize, deserialize } from '@ungap/structured-clone'\n\nconst debug = Debug('veramo:data-store-json:did-store')\n\n/**\n * An implementation of {@link @veramo/did-manager#AbstractDIDStore | AbstractDIDStore} that uses a JSON object to\n * store the relationships between DIDs, their providers and controllers and their keys and services as they are known\n * and managed by a Veramo agent.\n *\n * An instance of this class can be used by {@link @veramo/did-manager#DIDManager} as the data storage layer.\n *\n * This class must be initialized with a {@link VeramoJsonStore}, which serves as the JSON object storing data in\n * memory as well as providing an update notification callback to persist this data.\n * For correct usage, this MUST use the same {@link VeramoJsonStore} instance as the one used by\n * {@link @veramo/key-manager#KeyManager | KeyManager}.\n *\n * @beta This API may change without a BREAKING CHANGE notice.\n */\nexport class DIDStoreJson extends AbstractDIDStore {\n  private readonly cacheTree: Required<Pick<VeramoJsonCache, 'dids' | 'keys'>>\n  private readonly notifyUpdate: DiffCallback\n\n  constructor(jsonStore: VeramoJsonStore) {\n    super()\n    this.notifyUpdate = jsonStore.notifyUpdate\n    this.cacheTree = jsonStore as Required<Pick<VeramoJsonCache, 'dids' | 'keys'>>\n    if (!this.cacheTree.dids) {\n      this.cacheTree.dids = {}\n    }\n    if (!this.cacheTree.keys) {\n      this.cacheTree.keys = {}\n    }\n  }\n\n  async getDID({\n              did,\n              alias,\n              provider,\n            }: {\n    did?: string\n    alias?: string\n    provider?: string\n  }): Promise<IIdentifier> {\n    let where: { did?: string; alias?: string; provider?: string } = {}\n\n    if (did !== undefined && alias === undefined) {\n      where = { did }\n    } else if (did === undefined && alias !== undefined) {\n      where = { alias }\n    } else {\n      throw Error('invalid_arguments: DidStoreJson.get requires did or (alias and provider)')\n    }\n\n    let identifier: IIdentifier | undefined\n    if (where.did) {\n      identifier = this.cacheTree.dids[where.did]\n    } else {\n      identifier = Object.values(this.cacheTree.dids).find(\n        (iid: IIdentifier) => iid.alias === where.alias,\n      )\n    }\n\n    if (!identifier) throw Error('Identifier not found')\n\n    return deserialize(serialize(identifier))\n  }\n\n  async deleteDID({ did }: { did: string }) {\n    if (this.cacheTree.dids[did]) {\n      const oldTree = deserialize(serialize(this.cacheTree, { lossy: true }))\n      delete this.cacheTree.dids[did]\n      // FIXME: delete key associations?\n      await this.notifyUpdate(oldTree, this.cacheTree)\n      return true\n    }\n    return false\n  }\n\n  async importDID(args: IIdentifier) {\n    const oldTree = deserialize(serialize(this.cacheTree, { lossy: true }))\n    this.cacheTree.dids[args.did] = args\n    args.keys.forEach((key) => {\n      this.cacheTree.keys[key.kid] = {\n        ...key,\n        // FIXME: keys should be able to associate with multiple DIDs\n        meta: { ...key.meta, did: args.did },\n      }\n    })\n\n    await this.notifyUpdate(oldTree, this.cacheTree)\n    return true\n  }\n\n  async listDIDs(args: { alias?: string; provider?: string }): Promise<IIdentifier[]> {\n    const result = Object.values(this.cacheTree.dids).filter(\n      (iid: IIdentifier) =>\n        (!args.provider || (args.provider && iid.provider === args.provider)) &&\n        (!args.alias || (args.alias && iid.alias === args.alias)),\n    )\n    return deserialize(serialize(result))\n  }\n}\n"
  },
  {
    "path": "packages/data-store-json/src/identifier/key-store.ts",
    "content": "import { IKey, ManagedKeyInfo } from '@veramo/core-types'\nimport { AbstractKeyStore } from '@veramo/key-manager'\n\nimport Debug from 'debug'\nimport { DiffCallback, VeramoJsonCache, VeramoJsonStore } from '../types.js'\nimport { serialize, deserialize } from '@ungap/structured-clone'\n\nconst debug = Debug('veramo:data-store-json:key-store')\n\n/**\n * An implementation of {@link @veramo/key-manager#AbstractKeyStore | AbstractKeyStore} that uses a JSON object to\n * store the relationships between keys, their IDs, aliases and\n * {@link @veramo/key-manager#AbstractKeyManagementSystem | KMS implementations}, as they are known and managed by a\n * Veramo agent.\n *\n * An instance of this class can be used by {@link @veramo/key-manager#KeyManager} as the data storage layer.\n *\n * This class must be initialized with a {@link VeramoJsonStore}, which serves as the JSON object storing data in\n * memory as well as providing an update notification callback to persist this data.\n * For correct usage, this MUST use the same {@link VeramoJsonStore} instance as the one used by\n * {@link @veramo/did-manager#DIDManager | DIDManager}.\n *\n * @beta This API may change without a BREAKING CHANGE notice.\n */\nexport class KeyStoreJson extends AbstractKeyStore {\n  private readonly cacheTree: Required<Pick<VeramoJsonCache, 'keys'>>\n  private readonly notifyUpdate: DiffCallback\n\n  /**\n   * @param jsonStore - Serves as the JSON object storing data in memory as well as providing an update notification\n   *   callback to persist this data. For correct usage, this MUST use the same {@link VeramoJsonStore} instance as the\n   *   one used by {@link @veramo/did-manager#DIDManager | DIDManager}.\n   */\n  constructor(jsonStore: VeramoJsonStore) {\n    super()\n    this.notifyUpdate = jsonStore.notifyUpdate\n    this.cacheTree = jsonStore as Required<Pick<VeramoJsonCache, 'dids' | 'keys'>>\n    if (!this.cacheTree.keys) {\n      this.cacheTree.keys = {}\n    }\n  }\n\n  async getKey({ kid }: { kid: string }): Promise<IKey> {\n    if (this.cacheTree.keys[kid]) {\n      return deserialize(serialize(this.cacheTree.keys[kid]))\n    } else {\n      throw Error('not_found: Key not found')\n    }\n  }\n\n  async deleteKey({ kid }: { kid: string }) {\n    if (this.cacheTree.keys[kid]) {\n      const oldTree = deserialize(serialize(this.cacheTree, { lossy: true }))\n      delete this.cacheTree.keys[kid]\n      await this.notifyUpdate(oldTree, this.cacheTree)\n      return true\n    } else {\n      return false\n    }\n  }\n\n  async importKey(args: IKey) {\n    const oldTree = deserialize(serialize(this.cacheTree, { lossy: true }))\n    this.cacheTree.keys[args.kid] = args\n    await this.notifyUpdate(oldTree, this.cacheTree)\n    return true\n  }\n\n  async listKeys(args: {} = {}): Promise<ManagedKeyInfo[]> {\n    const keys = Object.values(this.cacheTree.keys).map((key: IKey) => {\n      const { kid, publicKeyHex, type, meta, kms } = key\n      return { kid, publicKeyHex, type, meta: deserialize(serialize(meta)), kms } as ManagedKeyInfo\n    })\n    return keys\n  }\n}\n"
  },
  {
    "path": "packages/data-store-json/src/identifier/private-key-store.ts",
    "content": "import { AbstractSecretBox, AbstractPrivateKeyStore } from '@veramo/key-manager'\nimport { ImportablePrivateKey, ManagedPrivateKey } from '@veramo/key-manager'\nimport { v4 as uuid4 } from 'uuid'\nimport Debug from 'debug'\nimport { DiffCallback, VeramoJsonCache, VeramoJsonStore } from '../types.js'\nimport { serialize, deserialize } from '@ungap/structured-clone'\n\nconst debug = Debug('veramo:data-store-json:private-key-store')\n\n/**\n * An implementation of {@link @veramo/key-manager#AbstractPrivateKeyStore | AbstractPrivateKeyStore} that uses a JSON\n * object to store the private key material needed by {@link @veramo/kms-local#KeyManagementSystem |\n * KeyManagementSystem}.\n *\n * This class must be initialized with a {@link VeramoJsonStore}, which serves as the JSON object storing data in\n * memory as well as providing an update notification callback to persist this data.\n * The JSON object does not have to be shared with other users of {@link VeramoJsonStore}, but it can be.\n *\n * If an {@link @veramo/key-manager#AbstractSecretBox | AbstractSecretBox} is used, then key material is encrypted,\n * even in memory.\n *\n * @beta This API may change without a BREAKING CHANGE notice.\n */\nexport class PrivateKeyStoreJson extends AbstractPrivateKeyStore {\n  private readonly cacheTree: Required<Pick<VeramoJsonCache, 'privateKeys'>>\n  private readonly notifyUpdate: DiffCallback\n\n  /**\n   * @param jsonStore - This serves as the JSON object storing data in memory as well as providing an update\n   *   notification callback to persist this data. The JSON object does not have to be shared with other users of\n   *   {@link VeramoJsonStore}, but it can be.\n   * @param secretBox - If this is used, then key material is encrypted, even in memory.\n   */\n  constructor(jsonStore: VeramoJsonStore, private secretBox?: AbstractSecretBox) {\n    super()\n    this.cacheTree = jsonStore as Required<Pick<VeramoJsonCache, 'privateKeys'>>\n    this.notifyUpdate = jsonStore.notifyUpdate\n    if (!this.cacheTree.privateKeys) {\n      this.cacheTree.privateKeys = {}\n    }\n    if (!secretBox) {\n      console.warn('Please provide SecretBox to the KeyStore')\n    }\n  }\n\n  async getKey({ alias }: { alias: string }): Promise<ManagedPrivateKey> {\n    const key = deserialize(serialize(this.cacheTree.privateKeys[alias]))\n    if (!key) throw Error('not_found: PrivateKey not found')\n    if (this.secretBox && key.privateKeyHex) {\n      key.privateKeyHex = await this.secretBox.decrypt(key.privateKeyHex)\n    }\n    return key\n  }\n\n  async deleteKey({ alias }: { alias: string }) {\n    debug(`Deleting private key data for alias=${alias}`)\n    const privateKeyEntry = this.cacheTree.privateKeys[alias]\n    if (privateKeyEntry) {\n      const oldTree = deserialize(serialize(this.cacheTree, { lossy: true }))\n      delete this.cacheTree.privateKeys[alias]\n      await this.notifyUpdate(oldTree, this.cacheTree)\n    }\n    return true\n  }\n\n  async importKey(args: ImportablePrivateKey): Promise<ManagedPrivateKey> {\n    debug('Saving private key data', args.alias)\n    const alias = args.alias || uuid4()\n    const key: ManagedPrivateKey = deserialize(\n      serialize({\n        ...args,\n        alias,\n      }),\n    )\n    const existingKey = this.cacheTree.privateKeys[key.alias]\n    if (existingKey && this.secretBox) {\n      existingKey.privateKeyHex = await this.secretBox.decrypt(existingKey.privateKeyHex)\n    }\n    if (existingKey && existingKey.privateKeyHex !== key.privateKeyHex) {\n      throw new Error(\n        `key_already_exists: A key with this alias exists but with different data. Please use a different alias.`,\n      )\n    }\n\n    if (this.secretBox && key.privateKeyHex) {\n      const copy = key.privateKeyHex\n      key.privateKeyHex = await this.secretBox.encrypt(copy)\n    }\n    const oldTree = deserialize(serialize(this.cacheTree, { lossy: true }))\n    this.cacheTree.privateKeys[key.alias] = key\n    await this.notifyUpdate(oldTree, this.cacheTree)\n\n    return key\n  }\n\n  async listKeys(): Promise<Array<ManagedPrivateKey>> {\n    const keys = Object.values(this.cacheTree.privateKeys)\n    if (this.secretBox) {\n      for (const key of keys) {\n        key.privateKeyHex = await this.secretBox.decrypt(key.privateKeyHex)\n      }\n    }\n    return deserialize(serialize(keys))\n  }\n}\n"
  },
  {
    "path": "packages/data-store-json/src/index.ts",
    "content": "/**\n * {@link @veramo/core#Agent} {@link @veramo/data-store-json#DataStoreJson | plugin} that implements\n * {@link @veramo/core-types#IDataStore } and\n * {@link @veramo/core-types#IDataStoreORM }interfaces and uses a JSON tree as a backend.\n *\n * The JSON tree backend can be persisted to any JSON compatible media using a callback that gets called when the agent\n * data is updated.\n *\n * @packageDocumentation\n */\n\nexport { DataStoreJson } from './data-store-json.js'\nexport {\n  DiffCallback,\n  ClaimTableEntry,\n  CredentialTableEntry,\n  PresentationTableEntry,\n  VeramoJsonCache,\n  VeramoJsonStore,\n} from './types.js'\nexport { DIDStoreJson } from './identifier/did-store.js'\nexport { KeyStoreJson } from './identifier/key-store.js'\nexport { PrivateKeyStoreJson } from './identifier/private-key-store.js'\nexport { BrowserLocalStorageStore } from './browser-local-storage-store.js'\n"
  },
  {
    "path": "packages/data-store-json/src/types.ts",
    "content": "import {\n  IIdentifier,\n  IMessage,\n  ManagedKeyInfo,\n  VerifiableCredential,\n  VerifiablePresentation,\n  W3CVerifiableCredential,\n  W3CVerifiablePresentation,\n} from '@veramo/core-types'\nimport { ManagedPrivateKey } from '@veramo/key-manager'\n\n/**\n * This is used internally by {@link @veramo/data-store-json#DataStoreJson | DataStoreJson} to represent a Verifiable\n * Credential in a way that facilitates querying using the {@link @veramo/core-types#IDataStoreORM} interface.\n *\n * @beta This API may change in future versions without a BREAKING CHANGE notice.\n */\nexport interface CredentialTableEntry {\n  hash: string\n  issuer: string\n  subject?: string\n  id?: string\n  issuanceDate?: Date\n  expirationDate?: Date\n  context: string[]\n  type: string[]\n  parsedCredential: VerifiableCredential\n  canonicalCredential: W3CVerifiableCredential\n}\n\n/**\n * This is used internally by {@link @veramo/data-store-json#DataStoreJson | DataStoreJson} to represent the claims\n * contained in a Verifiable Credential in a way that facilitates querying using the {@link @veramo/core-types#IDataStoreORM}\n * interface.\n *\n * @beta This API may change in future versions without a BREAKING CHANGE notice.\n */\nexport interface ClaimTableEntry {\n  hash: string\n  issuer: string\n  subject?: string\n  credentialHash: string\n  issuanceDate?: Date\n  expirationDate?: Date\n  context: string[]\n  credentialType: string[]\n  type: string\n  value: any\n}\n\n/**\n * This is used internally by {@link @veramo/data-store-json#DataStoreJson | DataStoreJson} to represent a Verifiable\n * Presentation in a way that facilitates querying using the {@link @veramo/core-types#IDataStoreORM} interface.\n *\n * @beta This API may change in future versions without a BREAKING CHANGE notice.\n */\nexport interface PresentationTableEntry {\n  hash: string\n  holder: string\n  verifier: string[]\n  parsedPresentation: VerifiablePresentation\n  canonicalPresentation: W3CVerifiablePresentation\n  id?: String\n  issuanceDate?: Date\n  expirationDate?: Date\n  context: string[]\n  type: string[]\n  credentials: VerifiableCredential[]\n}\n\n/**\n * A JSON data layout for data-store-json implementations.\n *\n * @beta This API may change in future versions without a BREAKING CHANGE notice.\n */\nexport interface VeramoJsonCache {\n  // usable for AbstractDIDStore implementations\n  dids?: Record<string, IIdentifier>\n  // usable for AbstractKeyStore implementations\n  keys?: Record<string, ManagedKeyInfo>\n  // usable for KMS implementations that opt to use the same storage for the private key material\n  privateKeys?: Record<string, ManagedPrivateKey>\n\n  // usable for IDataStore and IDataStoreORM implementations\n  credentials?: Record<string, CredentialTableEntry>\n  claims?: Record<string, ClaimTableEntry>\n  presentations?: Record<string, PresentationTableEntry>\n  messages?: Record<string, IMessage>\n}\n\n/**\n * An extension to {@link VeramoJsonCache} that bundles an update notification callback that allows implementors to\n * persist the {@link VeramoJsonCache} and any other data it may contain to another storage medium.\n *\n * @beta This API may change in future versions without a BREAKING CHANGE notice.\n */\nexport interface VeramoJsonStore extends VeramoJsonCache {\n  notifyUpdate: DiffCallback\n}\n\n/**\n * A callback method that is called when the data stored in a {@link VeramoJsonCache} is updated.\n *\n * @param oldState - The snapshot of the cache before the update.\n * @param newState - The new cache object, after the update. This object may reference the underlying storage.\n *\n * @beta This API may change in future versions without a BREAKING CHANGE notice.\n */\nexport type DiffCallback = (\n  oldState: Partial<VeramoJsonCache>,\n  newState: Partial<VeramoJsonCache>,\n) => Promise<void>\n"
  },
  {
    "path": "packages/data-store-json/tsconfig.json",
    "content": "{\n  \"extends\": \"../tsconfig.settings.json\",\n  \"compilerOptions\": {\n    \"rootDir\": \"src\",\n    \"outDir\": \"build\",\n    \"lib\": [\"dom\", \"esnext\"]\n  },\n  \"references\": [\n    { \"path\": \"../core-types\" },\n    { \"path\": \"../did-manager\" },\n    { \"path\": \"../key-manager\" },\n    { \"path\": \"../utils\" }\n  ]\n}\n"
  },
  {
    "path": "packages/did-comm/CHANGELOG.md",
    "content": "# Change Log\n\nAll notable changes to this project will be documented in this file.\nSee [Conventional Commits](https://conventionalcommits.org) for commit guidelines.\n\n# [7.0.0](https://github.com/decentralized-identity/veramo/compare/v6.0.2...v7.0.0) (2026-02-11)\n\n\n### Bug Fixes\n\n* **deps:** update dependency @noble/ciphers to v1 ([#1419](https://github.com/decentralized-identity/veramo/issues/1419)) ([b6363a1](https://github.com/decentralized-identity/veramo/commit/b6363a169b66b71e5051ebe1029121e3e1ce8f76))\n* **deps:** update dependency @stablelib/aes to v2 ([018e189](https://github.com/decentralized-identity/veramo/commit/018e189f322e713984419666dc92b6cb470ef4a0))\n* **deps:** update dependency @stablelib/aes-kw to v2 ([02f2008](https://github.com/decentralized-identity/veramo/commit/02f200855c61237e724222f3430d20d3e0a878c4))\n* **deps:** update dependency uuid to v11 ([#1431](https://github.com/decentralized-identity/veramo/issues/1431)) ([6ad84d9](https://github.com/decentralized-identity/veramo/commit/6ad84d91f02794e741e4b770e29e1ee9a93edcfb))\n* **deps:** update devdeps and bump typeorm to 0.3.20 ([#1272](https://github.com/decentralized-identity/veramo/issues/1272)) ([7d17f37](https://github.com/decentralized-identity/veramo/commit/7d17f37ea7cc4e73a8cdae028681ae1be5c4d11c))\n* **did-comm:** remove isomorphic-webcrypto dependency ([#1401](https://github.com/decentralized-identity/veramo/issues/1401)) ([85cc1ce](https://github.com/decentralized-identity/veramo/commit/85cc1ce1d567afcbc42e0fd89eb2515505044c83)), closes [#1381](https://github.com/decentralized-identity/veramo/issues/1381) [#1387](https://github.com/decentralized-identity/veramo/issues/1387)\n\n\n### Features\n\n* **credential-w3c:** refactor the ICredentialProvider API ([#1488](https://github.com/decentralized-identity/veramo/issues/1488)) ([cbd848d](https://github.com/decentralized-identity/veramo/commit/cbd848d4ce2b52497d99d335f1c93bd8b005cdb2))\n* **credential-w3c:** remove hardcoded proof formats ([#1395](https://github.com/decentralized-identity/veramo/issues/1395)) ([5b7d3fa](https://github.com/decentralized-identity/veramo/commit/5b7d3fad7d2ada4954f8020a6474df13d9fe51dc))\n\n\n### BREAKING CHANGES\n\n* **credential-w3c:** This changeset, along with the previous changes in #1395 modify the CredentialPlugin to support extensibility without modifications to the veramo repository. This plugin now acts as an orchestrator for other ICredentialProvider implementations that provide the actual support for various verifiable data formats. ICredentialProvider implementations can be implemented externally and used with this plugin.\n* **credential-w3c:** The credential plugins specializing in JSON-LD / EIP712 are no longer top level veramo plugins but are now managed by the `@veramo/credential-w3c` plugin which will be able to use multiple proof formats and multiplex accordingly. The constructor for the `CredentialPlugin` has changed to accept different implementations of proof formats.\n\n\n\n\n\n## [6.0.2](https://github.com/decentralized-identity/veramo/compare/v6.0.1...v6.0.2) (2026-01-16)\n\n**Note:** Version bump only for package @veramo/did-comm\n\n\n\n\n\n## [6.0.1](https://github.com/decentralized-identity/veramo/compare/v6.0.0...v6.0.1) (2026-01-16)\n\n**Note:** Version bump only for package @veramo/did-comm\n\n\n\n\n\n# [6.0.0](https://github.com/decentralized-identity/veramo/compare/v5.6.0...v6.0.0) (2024-04-02)\n\n\n### Bug Fixes\n\n* **credential-w3c:** forward DID resolution options to the resolver ([#1344](https://github.com/decentralized-identity/veramo/issues/1344)) ([0c22cc6](https://github.com/decentralized-identity/veramo/commit/0c22cc6a79e974214500e4440b0ea2977012377d)), closes [#1343](https://github.com/decentralized-identity/veramo/issues/1343)\n* export const plugin schemas instead of defaults ([#1327](https://github.com/decentralized-identity/veramo/issues/1327)) ([7896cea](https://github.com/decentralized-identity/veramo/commit/7896ceaf2c79993eee44e46950814bea74bfe647)), closes [#1318](https://github.com/decentralized-identity/veramo/issues/1318) [#1317](https://github.com/decentralized-identity/veramo/issues/1317) [#1315](https://github.com/decentralized-identity/veramo/issues/1315)\n* **utils:** bump did-jwt to 7.4.1 and reuse key conversion code from it ([#1261](https://github.com/decentralized-identity/veramo/issues/1261)) ([fb192e7](https://github.com/decentralized-identity/veramo/commit/fb192e72a0bcd38d97b14e9d584c1770961d88df)), closes [#1248](https://github.com/decentralized-identity/veramo/issues/1248) [#1245](https://github.com/decentralized-identity/veramo/issues/1245)\n\n\n### chore\n\n* **deps:** bump ethers ([#1242](https://github.com/decentralized-identity/veramo/issues/1242)) ([fbf5c69](https://github.com/decentralized-identity/veramo/commit/fbf5c69b8f747f37e60e98329a0dd0a2ba0b262e))\n\n\n### Code Refactoring\n\n* generate plugin schemas as TS instead of JSON ([#1315](https://github.com/decentralized-identity/veramo/issues/1315)) ([65c2d4b](https://github.com/decentralized-identity/veramo/commit/65c2d4bc814daa9a3a89f4f7b8e8c6973b8ce2f0)), closes [#1254](https://github.com/decentralized-identity/veramo/issues/1254)\n\n\n### Features\n\n* add Multikey support ([#1316](https://github.com/decentralized-identity/veramo/issues/1316)) ([165de35](https://github.com/decentralized-identity/veramo/commit/165de3549ccfd3d7c84514608ac3ea9e56a7b807))\n* **coordinate-mediation:** implement did-comm coordinate-mediation v3.0 ([#1282](https://github.com/decentralized-identity/veramo/issues/1282)) ([462735d](https://github.com/decentralized-identity/veramo/commit/462735d138bc4984c0fcf3f72ca7d49e3187ceb7))\n* **did-comm:** Improve DIDComm Service compatibility ([#1340](https://github.com/decentralized-identity/veramo/issues/1340)) ([6df704c](https://github.com/decentralized-identity/veramo/commit/6df704c769d49fb399f515f102a41736a678070d))\n* **did-comm:** returnMessage from sendDIDCommMessage() when available ([#1283](https://github.com/decentralized-identity/veramo/issues/1283)) ([f7a3851](https://github.com/decentralized-identity/veramo/commit/f7a385157415e194820c181cf9091243a3f6b131))\n\n\n### BREAKING CHANGES\n\n* **did-comm:** the DIDComm Message structure has changed. The message can now specify multiple recipients in the `to` property.\n* The `plugin.schema.json` files are now generated as `plugin.schema.ts`.\n* **did-comm:** the return type of `IDIDComm.sendDIDCommMessage()` has changed from a string representing the transport ID to an object that may include a `returnMessage` property along with a `transportId` property.\n* **deps:** now using ethers v6 as a dependency which may need extra attention when merging. The output of `eth_signTransaction` algorithms may be slightly different as transactions are by default infered as type 1 (EIP1559)\n\n\n\n\n\n# [5.6.0](https://github.com/decentralized-identity/veramo/compare/v5.5.3...v5.6.0) (2024-01-16)\n\n\n### Features\n\n* **remote-client:** allow dynamic headers param for AgentRestClient constructor ([#1314](https://github.com/decentralized-identity/veramo/issues/1314)) ([1b8a0a2](https://github.com/decentralized-identity/veramo/commit/1b8a0a2718dd63492ad3a312a6ebe5f6e7849935)), closes [#1313](https://github.com/decentralized-identity/veramo/issues/1313)\n\n\n\n\n\n## [5.5.3](https://github.com/decentralized-identity/veramo/compare/v5.5.2...v5.5.3) (2023-10-09)\n\n\n### Bug Fixes\n\n* use DIF URLs in packages ([#1271](https://github.com/decentralized-identity/veramo/issues/1271)) ([3dfc601](https://github.com/decentralized-identity/veramo/commit/3dfc6014cdee7902c59d8db76b4c8507b870f227))\n\n\n\n\n\n# [5.5.0](https://github.com/uport-project/veramo/compare/v5.4.1...v5.5.0) (2023-09-19)\n\n\n### Bug Fixes\n\n* **deps:** update dependency cross-fetch to v4 ([1c14d34](https://github.com/uport-project/veramo/commit/1c14d34f48a51bef373541e84ed89f2f44711406))\n* **did-provider-key:** use compressed keys for creating Secp256k1 did:key ([#1217](https://github.com/uport-project/veramo/issues/1217)) ([ba8f6f5](https://github.com/uport-project/veramo/commit/ba8f6f5b9b701e57af86491504ecd209ca0c1c1d)), closes [#1213](https://github.com/uport-project/veramo/issues/1213)\n\n\n\n\n\n## [5.4.1](https://github.com/uport-project/veramo/compare/v5.4.0...v5.4.1) (2023-08-04)\n\n\n### Bug Fixes\n\n* **ci:** benign change meant to tag all packages for another patch release ([#1211](https://github.com/uport-project/veramo/issues/1211)) ([41b5c90](https://github.com/uport-project/veramo/commit/41b5c90277171b7b38c5cf49ca01db5cf75b6300))\n\n\n\n\n\n# [5.4.0](https://github.com/uport-project/veramo/compare/v5.3.0...v5.4.0) (2023-08-01)\n\n\n### Features\n\n* **did-comm:** add support for the AES based content and key encryption algorithms ([#1180](https://github.com/uport-project/veramo/issues/1180)) ([5294a81](https://github.com/uport-project/veramo/commit/5294a812ee578c0712b54f216416c3ef78c848da))\n\n\n\n\n\n# [5.3.0](https://github.com/uport-project/veramo/compare/v5.2.0...v5.3.0) (2023-07-27)\n\n\n### Features\n\n* export didcomm mediator utils ([#1181](https://github.com/uport-project/veramo/issues/1181)) ([264b6a7](https://github.com/uport-project/veramo/commit/264b6a71a8647f456daedcca99efa453f53ab8a1))\n\n\n\n\n\n# [5.2.0](https://github.com/uport-project/veramo/compare/v5.1.4...v5.2.0) (2023-05-02)\n\n\n### Bug Fixes\n\n* **credential-ld:** fix Ed25519Signature2020 verification ([#1166](https://github.com/uport-project/veramo/issues/1166)) ([c965fd5](https://github.com/uport-project/veramo/commit/c965fd502f652c9929ae4753c56ebbe351447733))\n* plugin schemas ([#1159](https://github.com/uport-project/veramo/issues/1159)) ([4b5f580](https://github.com/uport-project/veramo/commit/4b5f580e993857ae19541673b484b0af34f4e611))\n\n\n### Features\n\n* add did-peer provider and resolver ([#1156](https://github.com/uport-project/veramo/issues/1156)) ([9502063](https://github.com/uport-project/veramo/commit/95020632f741bd4640b3496b7b1bf19f5e6641d0))\n\n\n\n\n\n## [5.1.2](https://github.com/uport-project/veramo/compare/v5.1.1...v5.1.2) (2023-02-25)\n\n**Note:** Version bump only for package @veramo/did-comm\n\n\n\n\n\n# [5.1.0](https://github.com/uport-project/veramo/compare/v5.0.0...v5.1.0) (2023-02-24)\n\n\n### Bug Fixes\n\n* correctly export PickupRecipientMessageHandler ([#1121](https://github.com/uport-project/veramo/issues/1121)) ([3a7a086](https://github.com/uport-project/veramo/commit/3a7a0864387f7b56f1bac4cd89a3fd7e6274e644))\n* **did-comm:** correctly export PickupMediatorMessageHandler ([#1120](https://github.com/uport-project/veramo/issues/1120)) ([8de26b0](https://github.com/uport-project/veramo/commit/8de26b0740f68cd6976a7aa5f83ae95ee0dd3dce))\n* P256 key parity corrections ([#1137](https://github.com/uport-project/veramo/issues/1137)) ([d0eca2b](https://github.com/uport-project/veramo/commit/d0eca2b3cd9ca6741f7f056e28bb9799910bc5ec)), closes [#1136](https://github.com/uport-project/veramo/issues/1136) [#1135](https://github.com/uport-project/veramo/issues/1135)\n\n\n### Features\n\n* **core-types:** allow inline [@context](https://github.com/context) for Credentials and Presentations ([#1119](https://github.com/uport-project/veramo/issues/1119)) ([44bb365](https://github.com/uport-project/veramo/commit/44bb36503b635ee1f5431cb4bf28c7a9ba111156)), closes [#1073](https://github.com/uport-project/veramo/issues/1073)\n\n\n\n\n\n# [5.0.0](https://github.com/uport-project/veramo/compare/v4.3.0...v5.0.0) (2023-02-09)\n\n\n### Build System\n\n* convert veramo modules to ESM instead of CommonJS ([#1103](https://github.com/uport-project/veramo/issues/1103)) ([b5cea3c](https://github.com/uport-project/veramo/commit/b5cea3c0d80d900a47bd1d9eea68f84b70a35e7b)), closes [#1099](https://github.com/uport-project/veramo/issues/1099)\n\n\n### Features\n\n* isolate `core-types` package from `core` ([#1116](https://github.com/uport-project/veramo/issues/1116)) ([ba7a303](https://github.com/uport-project/veramo/commit/ba7a303de91cf4cc568a3af1ddf8ca98ed022e9f))\n\n\n### BREAKING CHANGES\n\n* this is a breaking change as modules will have to be imported differently: \n* https://www.typescriptlang.org/docs/handbook/esm-node.html\n* https://nodejs.org/api/esm.html\n* https://caniuse.com/?search=modules\n\ntest(did-provider-ion): skip a couple of tests that fail with unreasonable errors\nchore: use ubuntu-latest on CI\nfix: temporarily remove puppeteer tests\nfix: use craco for test-react-app to enable babel config\ntest: fix unit and integration tests (browser tests still broken)\nfix: fix some build issues that prevented tests from working\nfix: missing deps flagged by pnpm\n\n\n\n\n\n# [4.3.0](https://github.com/uport-project/veramo/compare/v4.2.0...v4.3.0) (2023-01-27)\n\n\n### Bug Fixes\n\n* **utils:** convert JWK with curv `Ed25519` to `X25519` ([#1078](https://github.com/uport-project/veramo/issues/1078)) ([deb546b](https://github.com/uport-project/veramo/commit/deb546ba94fa1dc51662adddbe303d63a0e7ce12))\n\n\n### Features\n\n* **did-comm:** add trust ping protocol ([#1080](https://github.com/uport-project/veramo/issues/1080)) ([fb22e63](https://github.com/uport-project/veramo/commit/fb22e632ef6dcce6a7dfec9a229c7be4d6d5c894))\n* **did-comm:** support DIDComm Messaging attachments ([#1087](https://github.com/uport-project/veramo/issues/1087)) ([6679574](https://github.com/uport-project/veramo/commit/66795742a01d5390ad083610efd28a8fe59fb3a3)), closes [#612](https://github.com/uport-project/veramo/issues/612)\n\n\n\n\n\n# [4.2.0](https://github.com/uport-project/veramo/compare/v4.1.2...v4.2.0) (2022-12-05)\n\n\n### Bug Fixes\n\n* **deps:** bump dependencies ([701b8ed](https://github.com/uport-project/veramo/commit/701b8edf981ea11c7ddb6a81d2817dbbdbb022f3))\n* didcomm message handler should attempt to pass message to other handlers ([#1064](https://github.com/uport-project/veramo/issues/1064)) ([5e18427](https://github.com/uport-project/veramo/commit/5e18427dc10e3724ca141efe923a789cd0f54688))\n* **utils:** correctly extract publicKeyHex from [Ed/X]25519 2020 keys ([#1076](https://github.com/uport-project/veramo/issues/1076)) ([c73002c](https://github.com/uport-project/veramo/commit/c73002c97d8c688e343aba65efd4c8e857a96522)), closes [#1067](https://github.com/uport-project/veramo/issues/1067)\n\n\n\n\n\n## [4.1.1](https://github.com/uport-project/veramo/compare/v4.1.0...v4.1.1) (2022-11-01)\n\n**Note:** Version bump only for package @veramo/did-comm\n\n\n\n\n\n# [4.1.0](https://github.com/uport-project/veramo/compare/v4.0.2...v4.1.0) (2022-10-31)\n\n\n### Bug Fixes\n\n* **deps:** Update dependency ethr-did-resolver to v7 ([#1038](https://github.com/uport-project/veramo/issues/1038)) ([d421c0f](https://github.com/uport-project/veramo/commit/d421c0f9f5934829df2930e58e98bcfce813ce84))\n\n\n\n\n\n## [4.0.2](https://github.com/uport-project/veramo/compare/v4.0.1...v4.0.2) (2022-10-04)\n\n\n### Bug Fixes\n\n* **credential-eip712:** add support for all did methods that use secp256k ([#1011](https://github.com/uport-project/veramo/issues/1011)) ([9940068](https://github.com/uport-project/veramo/commit/99400689dec9ea00131cf914d1999357b716612c)), closes [#991](https://github.com/uport-project/veramo/issues/991)\n* **deps:** update dependency uuid to v9 ([4ff90a5](https://github.com/uport-project/veramo/commit/4ff90a58f5993880635f2b39c73edadaf3149066))\n\n\n\n\n\n# [4.0.0](https://github.com/uport-project/veramo/compare/v3.1.5...v4.0.0) (2022-09-22)\n\n\n### Bug Fixes\n\n* **deps:** Bump `did-jwt`, `did-jwt-vc` as direct package deps ([#955](https://github.com/uport-project/veramo/issues/955)) ([e57edb3](https://github.com/uport-project/veramo/commit/e57edb34cfbaee6bba1d944497d688104f32c698))\n* **deps:** update dependency did-jwt to v5.12.0 ([5b414d7](https://github.com/uport-project/veramo/commit/5b414d7d720e7c59cf3f56c35da5fe247e21bf26))\n* **deps:** update did-libraries ([219cde2](https://github.com/uport-project/veramo/commit/219cde250e8d4f06d7978afcc38a04471342fd21))\n* **deps:** use did-jwt v6 and ethr-did-resolver v6 ([#925](https://github.com/uport-project/veramo/issues/925)) ([0c77d03](https://github.com/uport-project/veramo/commit/0c77d03ec5ec9e2091de3f74f67ab86a22cde197)), closes [#923](https://github.com/uport-project/veramo/issues/923) [#848](https://github.com/uport-project/veramo/issues/848)\n* **did-resolver:** use interface `Resolvable` instead of the `Resolver` class ([9c2e59f](https://github.com/uport-project/veramo/commit/9c2e59f3f23f808511c6c0e8e440b4d53ba5cb00))\n* update and fix inline documentation of all exported types ([#921](https://github.com/uport-project/veramo/issues/921)) ([63e64e0](https://github.com/uport-project/veramo/commit/63e64e0e2693808c4704dca8cc511dc0bab3f3b1))\n\n\n### Features\n\n* add support for serviceEndpoint property as defined in latest DID Spec ([#988](https://github.com/uport-project/veramo/issues/988)) ([9bed70b](https://github.com/uport-project/veramo/commit/9bed70ba658aed34a97944e0dee27bca6c81d700))\n* create DIDComm JWE with multiple recipients ([#888](https://github.com/uport-project/veramo/issues/888)) ([06acacb](https://github.com/uport-project/veramo/commit/06acacb400264d0e7f83fe31935a8ff52593f21f))\n* **credential-ld:** add support for browser environments ([#916](https://github.com/uport-project/veramo/issues/916)) ([435e4d2](https://github.com/uport-project/veramo/commit/435e4d260b1774f96b182c1a75ab2f1c993f2291))\n* **credential-status:** expect revoked boolean property from StatusMethods ([e00daa4](https://github.com/uport-project/veramo/commit/e00daa47865ea42d7bd8667f37c6e12fc21fd4b9))\n* **credential-w3c:** align verification API between formats ([#996](https://github.com/uport-project/veramo/issues/996)) ([b987fc0](https://github.com/uport-project/veramo/commit/b987fc0903a31d3bbffb43fef872be4d6c62c2ad)), closes [#935](https://github.com/uport-project/veramo/issues/935) [#954](https://github.com/uport-project/veramo/issues/954) [#375](https://github.com/uport-project/veramo/issues/375) [#989](https://github.com/uport-project/veramo/issues/989)\n\n\n### BREAKING CHANGES\n\n* the `did-resolver` and connected libraries change the data-type for `ServiceEndpoint` to `Service` and the previous semantic has changed. Services can have multiple endpoints, not just a single string.\n\n\n\n\n\n## [3.1.3](https://github.com/uport-project/veramo/compare/v3.1.2...v3.1.3) (2022-06-01)\n\n**Note:** Version bump only for package @veramo/did-comm\n\n\n\n\n\n# [3.1.0](https://github.com/uport-project/veramo/compare/v3.0.0...v3.1.0) (2021-11-12)\n\n\n### Bug Fixes\n\n* **data-store:** add support for entityPrefix ([#725](https://github.com/uport-project/veramo/issues/725)) ([801bb95](https://github.com/uport-project/veramo/commit/801bb95ddd22abaa61c938b025834132d4e8d3be)), closes [#724](https://github.com/uport-project/veramo/issues/724)\n* **deps:** update dependency did-jwt to v5.10.0 ([8424291](https://github.com/uport-project/veramo/commit/842429176b7e3a2433dcb0341cdadb5e5fcd71f0))\n* **deps:** update dependency did-jwt to v5.9.0 ([b9af0af](https://github.com/uport-project/veramo/commit/b9af0af9034297316313ac8f5d41f08e06c5a1ab))\n* **deps:** update did-libraries ([417dc5d](https://github.com/uport-project/veramo/commit/417dc5dd157ee259b6f89f4987f1ecca444fb1d4))\n\n\n### Features\n\n* **did-comm:** didcomm messaging using did:ethr ([#744](https://github.com/uport-project/veramo/issues/744)) ([1be5e04](https://github.com/uport-project/veramo/commit/1be5e04e09112c0823d776fe2d55117d71a7b448)), closes [#743](https://github.com/uport-project/veramo/issues/743)\n\n\n\n\n\n# [3.0.0](https://github.com/uport-project/veramo/compare/v2.1.3...v3.0.0) (2021-09-20)\n\n\n### Bug Fixes\n\n* **deps:** update all non-major dependencies ([8fc5312](https://github.com/uport-project/veramo/commit/8fc53120498ce2982e8ec640e00bbb03f6f4204e))\n* **deps:** update dependency uint8arrays to v3 ([#669](https://github.com/uport-project/veramo/issues/669)) ([a5f5c42](https://github.com/uport-project/veramo/commit/a5f5c421d307b39d926f2d701ef3b9861c325dea))\n* **did-resolver:** always include didResolutionMetadata in result ([#682](https://github.com/uport-project/veramo/issues/682)) ([aabddb4](https://github.com/uport-project/veramo/commit/aabddb436b8b4dd78378da4704ba00147d074cdb)), closes [#681](https://github.com/uport-project/veramo/issues/681)\n\n\n### Features\n\n* **data-store:** initialize DB using migrations ([#679](https://github.com/uport-project/veramo/issues/679)) ([41f6240](https://github.com/uport-project/veramo/commit/41f6240d68a79338772230cbfff768189ab031ed)), closes [#676](https://github.com/uport-project/veramo/issues/676)\n\n\n### BREAKING CHANGES\n\n* **data-store:** database needs migrations for initialization. See #679 #676\nThe `@veramo/data-store` package relies on `typeorm` as a database abstraction.\nTypeorm has a connection flag `synchonize` which bootstraps the database along with schema and relations based on a set of `Entities` (annotated typescript classes).\nThis is very handy for fast development iterations but it is **not recommended for production** use because there is too much ambiguity possible when the `Entities` change, and there is a risk of data loss.\nThe recommended way to do things is to use the `migrations` mechanism. It allows you to migrate to new database schemas when necessary, and even customize the database to your own needs.\n\n**Going forward, this is the mechanism we will be recommending for connections.**\n\n\n\n\n\n## [2.1.3](https://github.com/uport-project/veramo/compare/v2.1.2...v2.1.3) (2021-09-01)\n\n**Note:** Version bump only for package @veramo/did-comm\n\n\n\n\n\n## [2.1.2](https://github.com/uport-project/veramo/compare/v2.1.1...v2.1.2) (2021-09-01)\n\n**Note:** Version bump only for package @veramo/did-comm\n\n\n\n\n\n# [2.1.0](https://github.com/uport-project/veramo/compare/v2.0.1...v2.1.0) (2021-08-11)\n\n\n### Bug Fixes\n\n* **credentials-w3c:** accept Presentations without Credentials ([#616](https://github.com/uport-project/veramo/issues/616)) ([2389cd0](https://github.com/uport-project/veramo/commit/2389cd0df080e968ee320d66fabf2e8a7b51ba47))\n\n\n\n\n\n# [2.0.0](https://github.com/uport-project/veramo/compare/v1.2.2...v2.0.0) (2021-07-14)\n\n\n### Bug Fixes\n\n* **did-comm:** avoid double conversion for some keys while packing ([78321a9](https://github.com/uport-project/veramo/commit/78321a9f22abf2c4541a6a4c49898c6aacb5d81f))\n* **did-comm:** fix potential null exception when unpacking message ([584766c](https://github.com/uport-project/veramo/commit/584766c2ed393b4540a4190681ca9c8461d0679d))\n\n\n### Features\n\n* add support for did-comm over simple HTTP-based transports ([#610](https://github.com/uport-project/veramo/issues/610)) ([78836a4](https://github.com/uport-project/veramo/commit/78836a46d3ce71b568acaa98558b64f9c2b98167)), closes [#552](https://github.com/uport-project/veramo/issues/552) [#469](https://github.com/uport-project/veramo/issues/469)\n* implement didcomm v2 packing/unpacking ([#575](https://github.com/uport-project/veramo/issues/575)) ([249b07e](https://github.com/uport-project/veramo/commit/249b07eca8d2de9eb5252d71683d5f1fba319d60)), closes [#559](https://github.com/uport-project/veramo/issues/559) [#558](https://github.com/uport-project/veramo/issues/558)\n* **key-manager:** add generic signing capabilities ([#529](https://github.com/uport-project/veramo/issues/529)) ([5f10a1b](https://github.com/uport-project/veramo/commit/5f10a1bcea214cb593de12fa6ec3a91b3cb712bb)), closes [#522](https://github.com/uport-project/veramo/issues/522)\n\n\n\n\n\n# [1.2.0](https://github.com/uport-project/veramo/compare/v1.1.2...v1.2.0) (2021-04-27)\n\n\n### Bug Fixes\n\n* **deps:** update all non-major dependencies ([#462](https://github.com/uport-project/veramo/issues/462)) ([4a2b206](https://github.com/uport-project/veramo/commit/4a2b20633810b45a155bf2149cbff57d157bda3c))\n\n\n### Features\n\n* adapt to did core spec ([#430](https://github.com/uport-project/veramo/issues/430)) ([9712db0](https://github.com/uport-project/veramo/commit/9712db0eea1a3f48cf0665d66ae715ea0c23cd4a)), closes [#418](https://github.com/uport-project/veramo/issues/418) [#428](https://github.com/uport-project/veramo/issues/428) [#417](https://github.com/uport-project/veramo/issues/417) [#416](https://github.com/uport-project/veramo/issues/416) [#412](https://github.com/uport-project/veramo/issues/412) [#397](https://github.com/uport-project/veramo/issues/397) [#384](https://github.com/uport-project/veramo/issues/384) [#394](https://github.com/uport-project/veramo/issues/394)\n\n\n\n\n\n# [1.1.0](https://github.com/uport-project/veramo/compare/v1.0.1...v1.1.0) (2021-01-26)\n\n**Note:** Version bump only for package @veramo/did-comm\n\n\n\n\n\n## 1.0.1 (2020-12-18)\n\n**Note:** Version bump only for package @veramo/did-comm\n"
  },
  {
    "path": "packages/did-comm/LICENSE",
    "content": "                                 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 2019 Consensys AG\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"
  },
  {
    "path": "packages/did-comm/README.md",
    "content": "# Veramo DIDComm\n\nVeramo messaging plugin implementing DIDComm v2, as specified by the [DIDComm v2 Spec](https://identity.foundation/didcomm-messaging/spec/) as well as certain \"DIDComm Protocols\"\n\n## Spec Compliance\n\n### [Message Formats](https://identity.foundation/didcomm-messaging/spec/#message-formats)\n\nMessage Envelopes:\n\n| Envelope | Veramo 'packing' | IANA type (`typ`) | packDIDCommMessage | unpackDIDCommMessage | notes |\n| -------- | ---------------- | ----------------- | ------------------ | -------------------- | -------------------- |\n| plaintext | 'none' | `application/didcomm-plain+json` | [X] | [X] | |\n| signed(plaintext) | 'jws' | `application/didcomm-signed+json` | [X] | [X] | |\n| anoncrypt(plaintext) | 'anoncrypt' | `application/didcomm-encrypted+json` | [X] | [X] | |\n| authcrypt(plaintext) | 'authcrypt' | `application/didcomm-encrypted+json` | [X] | [X] | |\n| anoncrypt(sign(plaintext)) | 'anoncrypt+jws' | `application/didcomm-encrypted+json` | [ ] | [ ] | |\n| authcrypt(sign(plaintext)) | 'authcrypt+jws' | `application/didcomm-encrypted+json` | [ ] | [ ] | SHOULD NOT be emitted, but MAY be accepted |\n| anoncryptauthcrypt((sign(plaintext))) | '' | `application/didcomm-encrypted+json` | [ ] | [ ] | |\n\n"
  },
  {
    "path": "packages/did-comm/api-extractor.json",
    "content": "{\n  \"$schema\": \"https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json\",\n  \"apiReport\": {\n    \"enabled\": true,\n    \"reportFolder\": \"./api\",\n    \"reportTempFolder\": \"./api\"\n  },\n\n  \"docModel\": {\n    \"enabled\": true,\n    \"apiJsonFilePath\": \"./api/<unscopedPackageName>.api.json\"\n  },\n\n  \"dtsRollup\": {\n    \"enabled\": false\n  },\n  \"mainEntryPointFilePath\": \"<projectFolder>/build/index.d.ts\"\n}\n"
  },
  {
    "path": "packages/did-comm/package.json",
    "content": "{\n  \"name\": \"@veramo/did-comm\",\n  \"description\": \"Veramo messaging plugin implementing DIDComm v2.\",\n  \"version\": \"7.0.0\",\n  \"main\": \"build/index.js\",\n  \"exports\": {\n    \".\": \"./build/index.js\"\n  },\n  \"types\": \"build/index.d.ts\",\n  \"scripts\": {\n    \"build\": \"tsc\",\n    \"generate-plugin-schema\": \"node ../cli/bin/veramo.js dev generate-plugin-schema\"\n  },\n  \"veramo\": {\n    \"pluginInterfaces\": {\n      \"IDIDComm\": \"./src/types/IDIDComm.ts\"\n    }\n  },\n  \"dependencies\": {\n    \"@noble/ciphers\": \"^1.0.0\",\n    \"@noble/curves\": \"^1.4.2\",\n    \"@stablelib/aes-kw\": \"^2.0.0\",\n    \"@veramo/core-types\": \"workspace:^\",\n    \"@veramo/kv-store\": \"workspace:^\",\n    \"@veramo/mediation-manager\": \"workspace:^\",\n    \"@veramo/message-handler\": \"workspace:^\",\n    \"@veramo/utils\": \"workspace:^\",\n    \"cross-fetch\": \"^4.0.0\",\n    \"debug\": \"^4.3.3\",\n    \"did-jwt\": \"^8.0.0\",\n    \"did-resolver\": \"^4.1.0\",\n    \"uuid\": \"^11.0.0\"\n  },\n  \"devDependencies\": {\n    \"@types/debug\": \"4.1.8\",\n    \"@types/uuid\": \"9.0.2\",\n    \"sqlite3\": \"5.1.7\",\n    \"typescript\": \"5.7.3\"\n  },\n  \"files\": [\n    \"build/**/*\",\n    \"src/**/*\",\n    \"README.md\",\n    \"LICENSE\"\n  ],\n  \"publishConfig\": {\n    \"access\": \"public\"\n  },\n  \"repository\": {\n    \"type\": \"git\",\n    \"url\": \"https://github.com/decentralized-identity/veramo.git\",\n    \"directory\": \"packages/did-comm\"\n  },\n  \"author\": \"Consensys Mesh R&D <hello@veramo.io>\",\n  \"contributors\": [\n    \"Simonas Karuzas <simonas.karuzas@mesh.xyz>\",\n    \"Mircea Nistor <mircea.nistor@mesh.xyz>\",\n    \"Nick Reynolds <nick.reynolds@mesh.xyz>\",\n    \"Oliver Terbu\",\n    \"Cody Hatfield\"\n  ],\n  \"keywords\": [\n    \"Veramo\",\n    \"DID\",\n    \"Verifiable Credential\",\n    \"DIDComm\",\n    \"veramo-plugin\",\n    \"DIDComm v2\",\n    \"DIDComm Messaging\",\n    \"JWE\"\n  ],\n  \"license\": \"Apache-2.0\",\n  \"type\": \"module\",\n  \"moduleDirectories\": [\n    \"node_modules\",\n    \"src\"\n  ]\n}\n"
  },
  {
    "path": "packages/did-comm/src/__tests__/basic-interop.test.ts",
    "content": "import { DIDComm } from '../didcomm.js'\nimport { IDIDManager, IIdentifier, IKeyManager, IResolver, TAgent } from '../../../core-types/src'\nimport { createAgent } from '../../../core/src'\nimport { DIDManager, MemoryDIDStore } from '../../../did-manager/src'\nimport { KeyManager, MemoryKeyStore, MemoryPrivateKeyStore } from '../../../key-manager/src'\nimport { KeyManagementSystem } from '../../../kms-local/src'\nimport { DIDResolverPlugin } from '../../../did-resolver/src'\nimport { Resolver } from 'did-resolver'\nimport { IDIDComm } from '../types/IDIDComm.js'\nimport 'cross-fetch/polyfill'\nimport { base64ToBytes, bytesToHex } from '../../../utils/src'\nimport { getResolver as getDidPeerResolver, PeerDIDProvider } from '../../../did-provider-peer/src'\n\nimport * as u8a from 'uint8arrays'\nimport { v4 as uuidv4 } from 'uuid'\n\ndescribe('basic didcomm interop', () => {\n  let sender: IIdentifier\n  let recipient: IIdentifier\n  let agent: TAgent<IResolver & IKeyManager & IDIDManager & IDIDComm>\n  const defaultKms = 'local'\n\n  beforeAll(async () => {\n    agent = createAgent<IResolver & IKeyManager & IDIDManager & IDIDComm>({\n      plugins: [\n        new KeyManager({\n          store: new MemoryKeyStore(),\n          kms: {\n            [defaultKms]: new KeyManagementSystem(new MemoryPrivateKeyStore()),\n          },\n        }),\n        new DIDManager({\n          providers: {\n            'did:peer': new PeerDIDProvider({ defaultKms }),\n          },\n          store: new MemoryDIDStore(),\n          defaultProvider: 'did:example',\n        }),\n        new DIDResolverPlugin({\n          resolver: new Resolver({\n            ...getDidPeerResolver(),\n          }),\n        }),\n        new DIDComm(),\n      ],\n    })\n\n    // https://identity.foundation/didcomm-messaging/spec/#a1-sender-secrets\n    const senderSecretEd25519X = 'G-boxFB6vOZBu-wXkm-9Lh79I8nf9Z50cILaOgKKGww'\n    const senderSecretEd25519D = 'pFRUKkyzx4kHdJtFSnlPA9WzqkDT1HWV0xZ5OYZd2SY'\n\n    const senderSecretX25519X = 'avH0O2Y4tqLAq8y9zpianr8ajii5m4F_mICrzNlatXs'\n    const senderSecretX25519D = 'r-jK2cO3taR8LQnJB1_ikLBTAnOtShJOsHXRUWT-aZA'\n\n    sender = await agent.didManagerImport({\n      did: 'did:example:alice',\n      keys: [\n        {\n          type: 'Ed25519',\n          kid: 'did:example:alice#key-1',\n          publicKeyHex: bytesToHex(base64ToBytes(senderSecretEd25519X)),\n          // we use stablelib/nacl for ed25519, and the preferred encoding for the privateKey there is a 64 byte\n          // string, where the second half is the precomputed 32 byte encoding of the publicKey. This seems to be the\n          // preferred encoding in other related libraries too, as the pre-computation speeds up the signing by a few\n          // milliseconds.\n          // https://github.com/StableLib/stablelib/blob/a89a438fcbf855de6b2e9faa2630f03c3f3b3a54/packages/ed25519/ed25519.ts#L669\n          // https://crypto.stackexchange.com/a/54367\n          // https://github.com/libp2p/specs/blob/master/peer-ids/peer-ids.md#ed25519\n          privateKeyHex: bytesToHex(\n            u8a.concat([base64ToBytes(senderSecretEd25519D), base64ToBytes(senderSecretEd25519X)]),\n          ),\n          kms: 'local',\n        },\n        {\n          type: 'X25519',\n          kid: 'did:example:alice#key-x25519-1',\n          publicKeyHex: bytesToHex(base64ToBytes(senderSecretX25519X)),\n          privateKeyHex: bytesToHex(base64ToBytes(senderSecretX25519D)),\n          kms: 'local',\n        },\n      ],\n      provider: 'did:example',\n      alias: 'alice',\n    })\n\n    recipient = await agent.didManagerImport({\n      did: 'did:example:bob',\n      keys: [\n        {\n          type: 'X25519',\n          kid: 'did:example:bob#key-x25519-1',\n          publicKeyHex: bytesToHex(base64ToBytes('GDTrI66K0pFfO54tlCSvfjjNapIs44dzpneBgyx0S3E')),\n          privateKeyHex: bytesToHex(base64ToBytes('b9NnuOCB0hm7YGNvaE9DMhwH_wjZA1-gWD6dA0JWdL0')),\n          kms: 'local',\n        },\n        {\n          type: 'X25519',\n          kid: 'did:example:bob#key-x25519-2',\n          publicKeyHex: bytesToHex(base64ToBytes('UT9S3F5ep16KSNBBShU2wh3qSfqYjlasZimn0mB8_VM')),\n          privateKeyHex: bytesToHex(base64ToBytes('p-vteoF1gopny1HXywt76xz_uC83UUmrgszsI-ThBKk')),\n          kms: 'local',\n        },\n        {\n          type: 'X25519',\n          kid: 'did:example:bob#key-x25519-3',\n          publicKeyHex: bytesToHex(base64ToBytes('82k2BTUiywKv49fKLZa-WwDi8RBf0tB0M8bvSAUQ3yY')),\n          privateKeyHex: bytesToHex(base64ToBytes('f9WJeuQXEItkGM8shN4dqFr5fLQLBasHnWZ-8dPaSo0')),\n          kms: 'local',\n        },\n      ],\n      provider: 'did:example',\n      alias: 'bob',\n    })\n  })\n\n  it.skip('should send message to peer', async () => {\n    const remote =\n      // 'did:peer:2.Vz6MkiJHK4pcuKcsjUEbLTJu2qwKSzCXmKCWbjeYbnXJFYHt9.Ez6LSfy7HtbLKYn8mcxGs3D5VvLg3SQjicKSMhzknqr2T6aVu.SeyJ0IjoiZG0iLCJzIjp7InVyaSI6ImRpZDpwZWVyOjIuRXo2TFN0a1pnMTRvRzVMQ3hqYTNSaG90V0I3bTk0YWZFUjRFaUJMaFlwVVNva2J5Ui5WejZNa2dTWUJNNjNpSE5laVQyVlNRdTdiYnRYaEdZQ1FyUEo4dUVHdXJiZkdiYmdFLlNXM3NpZENJNkltUnRJaXdpY3lJNkltaDBkSEJ6T2k4dmRYTXRaV0Z6ZEM1d2RXSnNhV011YldWa2FXRjBiM0l1YVc1a2FXTnBiM1JsWTJndWFXOHZiV1Z6YzJGblpTSXNJbklpT2x0ZExDSmhJanBiSW1ScFpHTnZiVzB2ZGpJaUxDSmthV1JqYjIxdEwyRnBjREk3Wlc1MlBYSm1ZekU1SWwxOUxIc2lkQ0k2SW1SdElpd2ljeUk2SW5kemN6b3ZMM2R6TG5WekxXVmhjM1F1Y0hWaWJHbGpMbTFsWkdsaGRHOXlMbWx1WkdsamFXOTBaV05vTG1sdkwzZHpJaXdpY2lJNlcxMHNJbUVpT2xzaVpHbGtZMjl0YlM5Mk1pSXNJbVJwWkdOdmJXMHZZV2x3TWp0bGJuWTljbVpqTVRraVhYMWQiLCJhIjpbImRpZGNvbW0vdjIiXX19'\n      'did:peer:2.Ez6LStkZg14oG5LCxja3RhotWB7m94afER4EiBLhYpUSokbyR.Vz6MkgSYBM63iHNeiT2VSQu7bbtXhGYCQrPJ8uEGurbfGbbgE.SW3sidCI6ImRtIiwicyI6Imh0dHBzOi8vdXMtZWFzdC5wdWJsaWMubWVkaWF0b3IuaW5kaWNpb3RlY2guaW8vbWVzc2FnZSIsInIiOltdLCJhIjpbImRpZGNvbW0vdjIiLCJkaWRjb21tL2FpcDI7ZW52PXJmYzE5Il19LHsidCI6ImRtIiwicyI6IndzczovL3dzLnVzLWVhc3QucHVibGljLm1lZGlhdG9yLmluZGljaW90ZWNoLmlvL3dzIiwiciI6W10sImEiOlsiZGlkY29tbS92MiIsImRpZGNvbW0vYWlwMjtlbnY9cmZjMTkiXX1d'\n    console.log(`\\n\\n\\nremote:\\n${remote}\\n\\n\\n`)\n    const msg1 = await agent.packDIDCommMessage({\n      packing: 'none',\n      message: {\n        // type: 'https://didcomm.org/basicmessage/2.0/message',\n        type: 'https://didcomm.org/trust-ping/2.0/ping',\n        id: uuidv4(),\n        body: {\n          response_requested: true,\n        },\n        to: [remote],\n      },\n    })\n\n    const rr = await agent.sendDIDCommMessage({\n      messageId: uuidv4(),\n      packedMessage: msg1,\n      recipientDidUrl: remote,\n    })\n\n    console.log(JSON.stringify(rr, null, 2))\n  })\n})\n"
  },
  {
    "path": "packages/did-comm/src/__tests__/coordinate-mediation-message-handler.test.ts",
    "content": "import { DIDComm } from '../didcomm.js'\nimport {\n  createAgent,\n  IDIDManager,\n  IEventListener,\n  IIdentifier,\n  IKeyManager,\n  IMessageHandler,\n  IResolver,\n  TAgent,\n} from '../../../core/src'\nimport { DIDManager, MemoryDIDStore } from '../../../did-manager/src'\nimport { KeyManager, MemoryKeyStore, MemoryPrivateKeyStore } from '../../../key-manager/src'\nimport { KeyManagementSystem } from '../../../kms-local/src'\nimport { DIDResolverPlugin } from '../../../did-resolver/src'\nimport { Resolver } from 'did-resolver'\nimport { DIDCommHttpTransport } from '../transports/transports.js'\nimport { IDIDComm } from '../types/IDIDComm.js'\nimport { MessageHandler } from '../../../message-handler/src'\nimport {\n  CoordinateMediationMediatorMessageHandler,\n  CoordinateMediationRecipientMessageHandler,\n  createMediateRequestMessage,\n  createMediateGrantMessage,\n} from '../protocols/coordinate-mediation-message-handler.js'\nimport { FakeDidProvider, FakeDidResolver } from '../../../test-utils/src'\nimport { MessagingRouter, RequestWithAgentRouter } from '../../../remote-server/src'\nimport { Entities, IDataStore, migrations } from '../../../data-store/src'\n// @ts-ignore\nimport express from 'express'\nimport { Server } from 'http'\nimport { DIDCommMessageHandler } from '../message-handler.js'\nimport { DataStore, DataStoreORM } from '../../../data-store/src'\nimport { DataSource } from 'typeorm'\nimport { v4 } from 'uuid'\n\nimport { jest } from '@jest/globals'\nimport 'cross-fetch/polyfill'\n\nconst DIDCommEventSniffer: IEventListener = {\n  eventTypes: ['DIDCommV2Message-sent', 'DIDCommV2Message-received'],\n  onEvent: jest.fn(() => Promise.resolve()),\n}\n\ndescribe('coordinate-mediation-message-handler', () => {\n  let recipient: IIdentifier\n  let mediator: IIdentifier\n  let agent: TAgent<IResolver & IKeyManager & IDIDManager & IDIDComm & IMessageHandler & IDataStore>\n  let didCommEndpointServer: Server\n  let listeningPort = Math.round(Math.random() * 32000 + 2048)\n  // eslint-disable-next-line @typescript-eslint/no-explicit-any\n  let dbConnection: any // typeorm types don't seem to follow semantic release patterns leading to type errors\n\n  beforeAll(async () => {\n    dbConnection = new DataSource({\n      name: 'test',\n      type: 'sqlite',\n      database: ':memory:',\n      synchronize: false,\n      migrations: migrations,\n      migrationsRun: true,\n      logging: false,\n      entities: Entities,\n    })\n    agent = createAgent({\n      plugins: [\n        new KeyManager({\n          store: new MemoryKeyStore(),\n          kms: {\n            // @ts-ignore\n            local: new KeyManagementSystem(new MemoryPrivateKeyStore()),\n          },\n        }),\n        new DIDManager({\n          providers: {\n            'did:fake': new FakeDidProvider(),\n            // 'did:web': new WebDIDProvider({ defaultKms: 'local' })\n          },\n          store: new MemoryDIDStore(),\n          defaultProvider: 'did:fake',\n        }),\n        new DIDResolverPlugin({\n          resolver: new Resolver({\n            ...new FakeDidResolver(() => agent).getDidFakeResolver(),\n          }),\n        }),\n        // @ts-ignore\n        new DIDComm([new DIDCommHttpTransport()]),\n        new MessageHandler({\n          messageHandlers: [\n            // @ts-ignore\n            new DIDCommMessageHandler(),\n            new CoordinateMediationMediatorMessageHandler(),\n            new CoordinateMediationRecipientMessageHandler(),\n          ],\n        }),\n        new DataStore(dbConnection),\n        new DataStoreORM(dbConnection),\n        DIDCommEventSniffer,\n      ],\n    })\n\n    recipient = await agent.didManagerImport({\n      did: 'did:fake:z6MkgbqNU4uF9NKSz5BqJQ4XKVHuQZYcUZP8pXGsJC8nTHwo',\n      keys: [\n        {\n          type: 'Ed25519',\n          kid: 'didcomm-senderKey-1',\n          publicKeyHex: '1fe9b397c196ab33549041b29cf93be29b9f2bdd27322f05844112fad97ff92a',\n          privateKeyHex:\n            'b57103882f7c66512dc96777cbafbeb2d48eca1e7a867f5a17a84e9a6740f7dc1fe9b397c196ab33549041b29cf93be29b9f2bdd27322f05844112fad97ff92a',\n          kms: 'local',\n        },\n      ],\n      services: [\n        {\n          id: 'msg1',\n          type: 'DIDCommMessaging',\n          serviceEndpoint: `http://localhost:${listeningPort}/messaging`,\n        },\n      ],\n      provider: 'did:fake',\n      alias: 'sender',\n    })\n\n    mediator = await agent.didManagerImport({\n      did: 'did:fake:z6MkrPhffVLBZpxH7xvKNyD4sRVZeZsNTWJkLdHdgWbfgNu3',\n      keys: [\n        {\n          type: 'Ed25519',\n          kid: 'didcomm-receiverKey-1',\n          publicKeyHex: 'b162e405b6485eff8a57932429b192ec4de13c06813e9028a7cdadf0e2703636',\n          privateKeyHex:\n            '19ed9b6949cfd0f9a57e30f0927839a985fa699491886ebcdda6a954d869732ab162e405b6485eff8a57932429b192ec4de13c06813e9028a7cdadf0e2703636',\n          kms: 'local',\n        },\n      ],\n      services: [\n        {\n          id: 'msg2',\n          type: 'DIDCommMessaging',\n          serviceEndpoint: `http://localhost:${listeningPort}/messaging`,\n        },\n      ],\n      provider: 'did:fake',\n      alias: 'receiver',\n    })\n    // console.log('sender: ', sender)\n    // console.log('recipient: ', recipient)\n\n    const requestWithAgent = RequestWithAgentRouter({ agent })\n\n    await new Promise((resolve) => {\n      //setup a server to receive HTTP messages and forward them to this agent to be processed as DIDComm messages\n      const app = express()\n      // app.use(requestWithAgent)\n      app.use(\n        '/messaging',\n        requestWithAgent,\n        MessagingRouter({\n          metaData: { type: 'DIDComm', value: 'integration test' },\n        }),\n      )\n      didCommEndpointServer = app.listen(listeningPort, () => {\n        resolve(true)\n      })\n    })\n  })\n\n  afterAll(async () => {\n    try {\n      await new Promise((resolve) => didCommEndpointServer?.close(resolve))\n    } catch (e: any) {\n      // nop\n    }\n\n    try {\n      await dbConnection?.destroy()\n    } catch (e: any) {\n      // nop\n    }\n  })\n\n  const expectMsg = (msgid: string) => {\n    expect(DIDCommEventSniffer.onEvent).toHaveBeenCalledWith(\n      {\n        data: msgid,\n        type: 'DIDCommV2Message-sent',\n      },\n      expect.anything(),\n    )\n  }\n\n  const expectReceiveRequest = (msgid: string) => {\n    // mediator receives request\n    expect(DIDCommEventSniffer.onEvent).toHaveBeenCalledWith(\n      {\n        data: {\n          message: {\n            body: {},\n            from: recipient.did,\n            return_route: 'all',\n            id: msgid,\n            to: [mediator.did],\n            created_time: expect.anything(),\n            type: 'https://didcomm.org/coordinate-mediation/2.0/mediate-request',\n          },\n          metaData: { packing: 'authcrypt' },\n        },\n        type: 'DIDCommV2Message-received',\n      },\n      expect.anything(),\n    )\n  }\n\n  const expectGrantRequest = (msgid: string) => {\n    // mediator receives request\n    expect(DIDCommEventSniffer.onEvent).toHaveBeenCalledWith(\n      {\n        data: {\n          message: {\n            body: {\n              routing_did: [mediator.did],\n            },\n            from: mediator.did,\n            id: expect.anything(),\n            thid: msgid,\n            to: [recipient.did],\n            created_time: expect.anything(),\n            type: 'https://didcomm.org/coordinate-mediation/2.0/mediate-grant',\n          },\n          metaData: { packing: 'authcrypt' },\n        },\n        type: 'DIDCommV2Message-received',\n      },\n      expect.anything(),\n    )\n  }\n\n  describe('mediator', () => {\n    it('should grant mediation to valid request via return_route', async () => {\n      expect.assertions(4)\n\n      const mediateRequestMessage = createMediateRequestMessage(recipient.did, mediator.did)\n      const packedMessage = await agent.packDIDCommMessage({\n        packing: 'authcrypt',\n        message: mediateRequestMessage,\n      })\n      await agent.sendDIDCommMessage({\n        messageId: mediateRequestMessage.id,\n        packedMessage,\n        recipientDidUrl: mediator.did,\n      })\n      expectMsg(mediateRequestMessage.id)\n      expectReceiveRequest(mediateRequestMessage.id)\n      expect(DIDCommEventSniffer.onEvent).toHaveBeenCalledWith(\n        {\n          data: expect.anything(),\n          type: 'DIDCommV2Message-sent',\n        },\n        expect.anything(),\n      )\n      expectGrantRequest(mediateRequestMessage.id)\n    })\n  })\n\n  describe('recipient', () => {\n    it('should save new service on mediate grant', async () => {\n      const mediateRequestMessage = createMediateRequestMessage(recipient.did, mediator.did)\n      const packedMessage = await agent.packDIDCommMessage({\n        packing: 'authcrypt',\n        message: mediateRequestMessage,\n      })\n      await agent.sendDIDCommMessage({\n        messageId: mediateRequestMessage.id,\n        packedMessage,\n        recipientDidUrl: mediator.did,\n      })\n\n      const didDoc = (await agent.resolveDid({ didUrl: recipient.did })).didDocument\n      const service = didDoc?.service?.find((s) => s.id === `${recipient.did}#didcomm-mediator`)\n      expect(service?.serviceEndpoint).toEqual([{ uri: mediator.did }])\n    })\n\n    it('should remove service on mediate deny', async () => {\n      const mediateRequestMessage = createMediateRequestMessage(recipient.did, mediator.did)\n      const packedMessage = await agent.packDIDCommMessage({\n        packing: 'authcrypt',\n        message: mediateRequestMessage,\n      })\n      await agent.sendDIDCommMessage({\n        messageId: mediateRequestMessage.id,\n        packedMessage,\n        recipientDidUrl: mediator.did,\n      })\n\n      const msgid = v4()\n      const packedDenyMessage = await agent.packDIDCommMessage({\n        packing: 'authcrypt',\n        message: {\n          type: 'https://didcomm.org/coordinate-mediation/2.0/mediate-deny',\n          from: mediator.did,\n          to: [recipient.did],\n          id: msgid,\n          thid: '',\n          body: {},\n        },\n      })\n      await agent.sendDIDCommMessage({\n        messageId: msgid,\n        packedMessage: packedDenyMessage,\n        recipientDidUrl: recipient.did,\n      })\n\n      const didDoc = (await agent.resolveDid({ didUrl: recipient.did })).didDocument\n      const service = didDoc?.service?.find((s) => s.id === `${recipient.did}#didcomm-mediator`)\n      expect(service).toBeUndefined()\n    })\n\n    it('should not save service if mediate request cannot be found', async () => {\n      const mediateGrantMessage = createMediateGrantMessage(recipient.did, mediator.did, '')\n      const packedMessage = await agent.packDIDCommMessage({\n        packing: 'authcrypt',\n        message: mediateGrantMessage,\n      })\n      await agent.sendDIDCommMessage({\n        messageId: mediateGrantMessage.id,\n        packedMessage,\n        recipientDidUrl: recipient.did,\n      })\n\n      const didDoc = (await agent.resolveDid({ didUrl: recipient.did })).didDocument\n      const service = didDoc?.service?.find((s) => s.id === `${recipient.did}#didcomm-mediator`)\n      expect(service).toBeUndefined()\n    })\n\n    it('should not save service if mediate grant message has bad routing_did', async () => {\n      const msgid = v4()\n      const packedMessage = await agent.packDIDCommMessage({\n        packing: 'authcrypt',\n        message: {\n          type: 'https://didcomm.org/coordinate-mediation/2.0/mediate-grant',\n          from: mediator.did,\n          to: [recipient.did],\n          id: msgid,\n          thid: '',\n          body: {},\n        },\n      })\n      await agent.sendDIDCommMessage({\n        messageId: msgid,\n        packedMessage,\n        recipientDidUrl: recipient.did,\n      })\n\n      const didDoc = (await agent.resolveDid({ didUrl: recipient.did })).didDocument\n      const service = didDoc?.service?.find((s) => s.id === `${recipient.did}#didcomm-mediator`)\n      expect(service).toBeUndefined()\n    })\n  })\n})\n"
  },
  {
    "path": "packages/did-comm/src/__tests__/coordinate-mediation-v3-message-handler.test.ts",
    "content": "import { DIDComm } from '../didcomm.js'\nimport {\n  KeyValueStore,\n  KeyValueTypeORMStoreAdapter,\n  Entities as KVStoreEntities,\n  kvStoreMigrations,\n} from '@veramo/kv-store'\nimport {\n  createAgent,\n  IDIDManager,\n  IEventListener,\n  IIdentifier,\n  IKeyManager,\n  IMessageHandler,\n  IResolver,\n  TAgent,\n} from '../../../core/src'\nimport {\n  RequesterDid,\n  IMediationManager,\n  PreMediationRequestPolicy,\n  MediationResponse,\n} from '../../../mediation-manager'\nimport { DIDManager, MemoryDIDStore } from '../../../did-manager/src'\nimport { KeyManager, MemoryKeyStore, MemoryPrivateKeyStore } from '../../../key-manager/src'\nimport { KeyManagementSystem } from '../../../kms-local/src'\nimport { DIDResolverPlugin } from '../../../did-resolver/src'\nimport { Resolver } from 'did-resolver'\nimport { DIDCommHttpTransport } from '../transports/transports.js'\nimport { IDIDComm } from '../types/IDIDComm.js'\nimport { MessageHandler } from '../../../message-handler/src'\nimport {\n  CoordinateMediationV3MediatorMessageHandler,\n  CoordinateMediationV3RecipientMessageHandler,\n  createV3MediateRequestMessage,\n  createV3MediateGrantMessage,\n  createV3RecipientUpdateMessage,\n  UpdateAction,\n  RecipientUpdateResult,\n  CoordinateMediation,\n  createV3RecipientQueryMessage,\n} from '../protocols/coordinate-mediation-v3-message-handler.js'\nimport type { Update, UpdateResult } from '../protocols/coordinate-mediation-v3-message-handler.js'\nimport { FakeDidProvider, FakeDidResolver } from '../../../test-utils/src'\nimport { MessagingRouter, RequestWithAgentRouter } from '../../../remote-server/src'\nimport {\n  Entities as DataStoreEntities,\n  IDataStore,\n  migrations as dataStoreMigrations,\n} from '../../../data-store/src'\n\n// @ts-ignore\nimport express from 'express'\nimport { Server } from 'http'\nimport { DIDCommMessageHandler } from '../message-handler.js'\nimport { DataStore, DataStoreORM } from '../../../data-store/src'\nimport { MediationManagerPlugin } from '../../../mediation-manager/src'\nimport { DataSource } from 'typeorm'\n\nimport { jest } from '@jest/globals'\nimport 'cross-fetch/polyfill'\n\nconst DIDCommEventSniffer: IEventListener = {\n  eventTypes: ['DIDCommV2Message-sent', 'DIDCommV2Message-received'],\n  onEvent: jest.fn(() => Promise.resolve()),\n}\n\ndescribe('coordinate-mediation-message-handler', () => {\n  let recipient: IIdentifier\n  let mediator: IIdentifier\n  let denyRecipient: IIdentifier\n  let agent: TAgent<\n    IResolver & IKeyManager & IDIDManager & IDIDComm & IMessageHandler & IDataStore & IMediationManager\n  >\n  let didCommEndpointServer: Server\n  let listeningPort = Math.round(Math.random() * 32000 + 2048)\n  // eslint-disable-next-line @typescript-eslint/no-explicit-any\n  let dbConnection: any // typeorm types don't seem to follow semantic release patterns leading to type errors\n  let policyStore: KeyValueStore<PreMediationRequestPolicy>\n  let mediationStore: KeyValueStore<MediationResponse>\n  let recipientDidStore: KeyValueStore<RequesterDid>\n\n  beforeAll(async () => {\n    dbConnection = new DataSource({\n      name: 'test',\n      type: 'sqlite',\n      database: ':memory:',\n      synchronize: false,\n      // eslint-disable-next-line @typescript-eslint/no-explicit-any\n      migrations: dataStoreMigrations.concat(kvStoreMigrations as any),\n      migrationsRun: true,\n      logging: false,\n      entities: (KVStoreEntities as any).concat(DataStoreEntities),\n    })\n\n    policyStore = new KeyValueStore<PreMediationRequestPolicy>({\n      namespace: 'mediation_policy',\n      store: new KeyValueTypeORMStoreAdapter({ dbConnection, namespace: 'mediation_policy' }),\n    })\n\n    mediationStore = new KeyValueStore<MediationResponse>({\n      namespace: 'mediation_response',\n      store: new KeyValueTypeORMStoreAdapter({ dbConnection, namespace: 'mediation_response' }),\n    })\n\n    recipientDidStore = new KeyValueStore<RequesterDid>({\n      namespace: 'recipient_did',\n      store: new KeyValueTypeORMStoreAdapter({ dbConnection, namespace: 'recipient_did' }),\n    })\n\n    agent = createAgent({\n      plugins: [\n        new KeyManager({\n          store: new MemoryKeyStore(),\n          kms: {\n            local: new KeyManagementSystem(new MemoryPrivateKeyStore()),\n          },\n        }),\n        new DIDManager({\n          providers: {\n            'did:fake': new FakeDidProvider(),\n          },\n          store: new MemoryDIDStore(),\n          defaultProvider: 'did:fake',\n        }),\n        new DIDResolverPlugin({\n          resolver: new Resolver({\n            ...new FakeDidResolver(() => agent).getDidFakeResolver(),\n          }),\n        }),\n        new MessageHandler({\n          messageHandlers: [\n            new DIDCommMessageHandler(),\n            new CoordinateMediationV3MediatorMessageHandler(),\n            new CoordinateMediationV3RecipientMessageHandler(),\n          ],\n        }),\n        new DataStore(dbConnection),\n        new DataStoreORM(dbConnection),\n        DIDCommEventSniffer,\n        new DIDComm({ transports: [new DIDCommHttpTransport()] }),\n        new MediationManagerPlugin(true, policyStore, mediationStore, recipientDidStore),\n      ],\n    })\n\n    denyRecipient = await agent.didManagerImport({\n      did: 'did:fake:dENygbqNU4uF9NKSz5BqJQ4XKVHuQZYcUZP8pXGsJC8nTHwo',\n      keys: [\n        {\n          type: 'Ed25519',\n          kid: 'didcomm-senderKey-1',\n          publicKeyHex: '1fe9b397c196ab33549041b29cf93be29b9f2bdd27322f05844112fad97ff92a',\n          privateKeyHex:\n            'b57103882f7c66512dc96777cbafbeb2d48eca1e7a867f5a17a84e9a6740f7dc1fe9b397c196ab33549041b29cf93be29b9f2bdd27322f05844112fad97ff92a',\n          kms: 'local',\n        },\n      ],\n      services: [\n        {\n          id: 'msg1',\n          type: 'DIDCommMessaging',\n          serviceEndpoint: `http://localhost:${listeningPort}/messaging`,\n        },\n      ],\n      provider: 'did:fake',\n      alias: 'sender',\n    })\n\n    recipient = await agent.didManagerImport({\n      did: 'did:fake:z6MkgbqNU4uF9NKSz5BqJQ4XKVHuQZYcUZP8pXGsJC8nTHwo',\n      keys: [\n        {\n          type: 'Ed25519',\n          kid: 'didcomm-senderKey-1',\n          publicKeyHex: '1fe9b397c196ab33549041b29cf93be29b9f2bdd27322f05844112fad97ff92a',\n          privateKeyHex:\n            'b57103882f7c66512dc96777cbafbeb2d48eca1e7a867f5a17a84e9a6740f7dc1fe9b397c196ab33549041b29cf93be29b9f2bdd27322f05844112fad97ff92a',\n          kms: 'local',\n        },\n      ],\n      services: [\n        {\n          id: 'msg1',\n          type: 'DIDCommMessaging',\n          serviceEndpoint: `http://localhost:${listeningPort}/messaging`,\n        },\n      ],\n      provider: 'did:fake',\n      alias: 'sender',\n    })\n\n    mediator = await agent.didManagerImport({\n      did: 'did:fake:z6MkrPhffVLBZpxH7xvKNyD4sRVZeZsNTWJkLdHdgWbfgNu3',\n      keys: [\n        {\n          type: 'Ed25519',\n          kid: 'didcomm-receiverKey-1',\n          publicKeyHex: 'b162e405b6485eff8a57932429b192ec4de13c06813e9028a7cdadf0e2703636',\n          privateKeyHex:\n            '19ed9b6949cfd0f9a57e30f0927839a985fa699491886ebcdda6a954d869732ab162e405b6485eff8a57932429b192ec4de13c06813e9028a7cdadf0e2703636',\n          kms: 'local',\n        },\n      ],\n      services: [\n        {\n          id: 'msg2',\n          type: 'DIDCommMessaging',\n          serviceEndpoint: `http://localhost:${listeningPort}/messaging`,\n        },\n      ],\n      provider: 'did:fake',\n      alias: 'receiver',\n    })\n\n    const requestWithAgent = RequestWithAgentRouter({ agent })\n\n    await new Promise((resolve) => {\n      //setup a server to receive HTTP messages and forward them to this agent to be processed as DIDComm messages\n      const app = express()\n      app.use(\n        '/messaging',\n        requestWithAgent,\n        MessagingRouter({\n          metaData: { type: 'DIDComm', value: 'integration test' },\n        }),\n      )\n      didCommEndpointServer = app.listen(listeningPort, () => {\n        resolve(true)\n      })\n    })\n  })\n\n  afterAll(async () => {\n    try {\n      await new Promise((resolve, _reject) => didCommEndpointServer?.close(resolve))\n    } catch (e: any) {\n      // nop\n    }\n\n    try {\n      await dbConnection?.destroy()\n    } catch (e: any) {\n      // nop\n    }\n  })\n\n  const expectMessageSent = (msgid: string) => {\n    expect(DIDCommEventSniffer.onEvent).toHaveBeenCalledWith(\n      {\n        data: msgid,\n        type: 'DIDCommV2Message-sent',\n      },\n      expect.anything(),\n    )\n  }\n\n  describe('mediator', () => {\n    describe('MEDIATE REQUEST', () => {\n      const expectRecieveMediationRequest = (id: string, from = recipient.did) => {\n        expect(DIDCommEventSniffer.onEvent).toHaveBeenCalledWith(\n          {\n            data: {\n              message: {\n                body: {},\n                from,\n                id,\n                to: [mediator.did],\n                created_time: expect.anything(),\n                type: 'https://didcomm.org/coordinate-mediation/3.0/mediate-request',\n              },\n              metaData: { packing: 'authcrypt' },\n            },\n            type: 'DIDCommV2Message-received',\n          },\n          expect.anything(),\n        )\n      }\n\n      const expectGrantRequest = (msgid: string) => {\n        expect(DIDCommEventSniffer.onEvent).toHaveBeenCalledWith(\n          {\n            data: {\n              message: {\n                body: { routing_did: [mediator.did] },\n                from: mediator.did,\n                to: [recipient.did],\n                id: expect.anything(),\n                thid: msgid,\n                created_time: expect.anything(),\n                type: CoordinateMediation.MEDIATE_GRANT,\n              },\n              metaData: { packing: 'authcrypt' },\n            },\n            type: 'DIDCommV2Message-received',\n          },\n          expect.anything(),\n        )\n      }\n\n      const expectDenyRequest = (msgid: string, to = recipient.did) => {\n        expect(DIDCommEventSniffer.onEvent).toHaveBeenCalledWith(\n          {\n            data: {\n              message: {\n                from: mediator.did,\n                id: expect.anything(),\n                thid: msgid,\n                to: [to],\n                created_time: expect.anything(),\n                type: 'https://didcomm.org/coordinate-mediation/3.0/mediate-deny',\n                body: null,\n              },\n              metaData: { packing: 'authcrypt' },\n            },\n            type: 'DIDCommV2Message-received',\n          },\n          expect.anything(),\n        )\n      }\n\n      it('should default to mediate grant all', async () => {\n        const isMediateDefaultGrantAll = await agent.isMediateDefaultGrantAll()\n        expect(isMediateDefaultGrantAll).toBeTruthy()\n      })\n\n      it('should correctly update the data store MediationPolicy for dids to deny', async () => {\n        const policy = 'DENY'\n        const requesterDid = denyRecipient.did\n        const insertedMediationPolicyDid = await agent.mediationManagerSaveMediationPolicy({\n          requesterDid,\n          policy,\n        })\n        expect(insertedMediationPolicyDid).toBe(denyRecipient.did)\n        const insertedPolicy = await agent.mediationManagerGetMediationPolicy({ requesterDid })\n        expect(insertedPolicy).toBe('DENY')\n      })\n\n      it('should receive a mediate request', async () => {\n        const message = createV3MediateRequestMessage(recipient.did, mediator.did)\n        const messageId = message.id\n        const packedMessageContents = { packing: 'authcrypt', message: message } as const\n        const packedMessage = await agent.packDIDCommMessage(packedMessageContents)\n        const recipientDidUrl = mediator.did\n        const didCommMessageContents = { messageId, packedMessage, recipientDidUrl }\n        await agent.sendDIDCommMessage(didCommMessageContents)\n\n        expectRecieveMediationRequest(message.id)\n      })\n\n      it('should save the mediation status to the db where request is GRANTED', async () => {\n        const message = createV3MediateRequestMessage(recipient.did, mediator.did)\n        const messageId = message.id\n        const packedMessageContents = { packing: 'authcrypt', message: message } as const\n        const packedMessage = await agent.packDIDCommMessage(packedMessageContents)\n        const recipientDidUrl = mediator.did\n        const didCommMessageContents = { messageId, packedMessage, recipientDidUrl }\n        await agent.sendDIDCommMessage(didCommMessageContents)\n        const mediationSaveResult = await agent.mediationManagerSaveMediation({\n          requesterDid: recipient.did,\n          status: 'GRANTED',\n        })\n        expect(mediationSaveResult).toBe('GRANTED')\n        const readMediation = await agent.mediationManagerGetMediation({ requesterDid: recipient.did })\n        expect(readMediation).toBe('GRANTED')\n      })\n\n      it('should record the mediation status to the db where request is DENIED', async () => {\n        const message = createV3MediateRequestMessage(denyRecipient.did, mediator.did)\n        const messageId = message.id\n        const packedMessageContents = { packing: 'authcrypt', message: message } as const\n        const packedMessage = await agent.packDIDCommMessage(packedMessageContents)\n        const recipientDidUrl = mediator.did\n        const didCommMessageContents = { messageId, packedMessage, recipientDidUrl }\n        await agent.sendDIDCommMessage(didCommMessageContents)\n        const mediation = await agent.mediationManagerGetMediation({ requesterDid: denyRecipient.did })\n        expect(mediation).toBe('DENIED')\n      })\n\n      it('should respond correctly to a mediate request where GRANTED', async () => {\n        const message = createV3MediateRequestMessage(recipient.did, mediator.did)\n        const messageId = message.id\n        const packedMessageContents = { packing: 'authcrypt', message: message } as const\n        const packedMessage = await agent.packDIDCommMessage(packedMessageContents)\n        const recipientDidUrl = mediator.did\n        const didCommMessageContents = { messageId, packedMessage, recipientDidUrl }\n        await agent.sendDIDCommMessage(didCommMessageContents)\n\n        expectMessageSent(messageId)\n        expectRecieveMediationRequest(messageId)\n        expectMessageSent(messageId)\n        expectGrantRequest(messageId)\n      })\n\n      it('should respond correctly to a mediate request where DENIED', async () => {\n        const message = createV3MediateRequestMessage(denyRecipient.did, mediator.did)\n        const messageId = message.id\n        const packedMessageContents = { packing: 'authcrypt', message: message } as const\n        const packedMessage = await agent.packDIDCommMessage(packedMessageContents)\n        const recipientDidUrl = mediator.did\n        const didCommMessageContents = { messageId, packedMessage, recipientDidUrl }\n        await agent.sendDIDCommMessage(didCommMessageContents)\n\n        expectMessageSent(messageId)\n        expectRecieveMediationRequest(messageId, denyRecipient.did)\n        expectMessageSent(messageId)\n        expectDenyRequest(messageId, denyRecipient.did)\n      })\n\n      it('should correctly update the data store MediationPolicy for dids to allow', async () => {\n        const policy = 'ALLOW'\n        const requesterDid = recipient.did\n        const insertedMediationPolicyDid = await agent.mediationManagerSaveMediationPolicy({\n          requesterDid,\n          policy,\n        })\n\n        expect(insertedMediationPolicyDid).toBe(recipient.did)\n\n        const savedPolicy = await agent.mediationManagerGetMediationPolicy({ requesterDid })\n\n        expect(savedPolicy).toBe('ALLOW')\n      })\n\n      it('should only allow mediation for dids with a MediationPolicy of ALLOW where isMediateDefaultGrantAll === false', async () => {\n        agent.isMediateDefaultGrantAll = jest.fn(() => Promise.resolve(false))\n\n        expect(await agent.isMediateDefaultGrantAll()).toBeFalsy()\n\n        const message = createV3MediateRequestMessage(recipient.did, mediator.did)\n        const messageId = message.id\n        const packedMessageContents = { packing: 'authcrypt', message: message } as const\n        const packedMessage = await agent.packDIDCommMessage(packedMessageContents)\n        const recipientDidUrl = mediator.did\n        const didCommMessageContents = { messageId, packedMessage, recipientDidUrl }\n        await agent.sendDIDCommMessage(didCommMessageContents)\n\n        expectMessageSent(messageId)\n        expectRecieveMediationRequest(messageId)\n        expectMessageSent(messageId)\n        expectGrantRequest(messageId)\n      })\n\n      it('should deny mediation for dids with no MediationPolicy of ALLOW where isMediateDefaultGrantAll === false', async () => {\n        agent.isMediateDefaultGrantAll = jest.fn(() => Promise.resolve(false))\n\n        expect(await agent.isMediateDefaultGrantAll()).toBeFalsy()\n\n        const policy = await agent.mediationManagerGetMediationPolicy({ requesterDid: denyRecipient.did })\n        const didIsAllowed = policy === 'ALLOW'\n\n        expect(didIsAllowed).toBeFalsy()\n\n        const message = createV3MediateRequestMessage(denyRecipient.did, mediator.did)\n        const messageId = message.id\n        const packedMessageContents = { packing: 'authcrypt', message: message } as const\n        const packedMessage = await agent.packDIDCommMessage(packedMessageContents)\n        const recipientDidUrl = mediator.did\n        const didCommMessageContents = { messageId, packedMessage, recipientDidUrl }\n        await agent.sendDIDCommMessage(didCommMessageContents)\n\n        expectMessageSent(messageId)\n        expectRecieveMediationRequest(messageId, denyRecipient.did)\n        expectMessageSent(messageId)\n        expectDenyRequest(messageId, denyRecipient.did)\n      })\n    })\n  })\n\n  const mockRecipientDids = {\n    mockRecipientDid_00: 'did:fake:testgbqNU4uF9NKSz5BqJQ4XKVHuQZYcUZP8pXGsJC8nTHwo',\n    mockRecipientDid_01: 'did:fake:test888NU4uF9NKSz5BqJQ4XKVHuQZYcUZP8pXGsJC8nTHwo',\n    mockRecipientDid_02: 'did:fake:testt88NU4uF9NKSz5BqJQ4XKVHuQZYcUZP8pXGsJC8nTHwo',\n    mockRecipientDid_03: 'did:fake:test889NU4uF9NKSz5BqJQ4XKVHuQZYcUZP8pXGsJC8nTHwo',\n    mockRecipientDid_04: 'did:fake:deny889NU4uF9NKSz5BqJQ4XKVHuQZYcUZP8pXGsJC8nTHwo',\n  } as const\n\n  describe('RECIPIENT UPDATE', () => {\n    const expectRecieveUpdateRequest = (msgid: string, updates: Update[]) => {\n      expect(DIDCommEventSniffer.onEvent).toHaveBeenCalledWith(\n        {\n          data: {\n            message: {\n              body: { updates },\n              return_route: 'all',\n              from: recipient.did,\n              id: msgid,\n              to: [mediator.did],\n              created_time: expect.anything(),\n              type: 'https://didcomm.org/coordinate-mediation/3.0/recipient-update',\n            },\n            metaData: { packing: 'authcrypt' },\n          },\n          type: 'DIDCommV2Message-received',\n        },\n        expect.anything(),\n      )\n    }\n\n    const expectRecipientUpdateReponse = (msgid: string, updates: UpdateResult[]) => {\n      expect(DIDCommEventSniffer.onEvent).toHaveBeenCalledWith(\n        {\n          data: {\n            message: {\n              body: { updates },\n              from: mediator.did,\n              to: [recipient.did],\n              id: expect.anything(),\n              thid: msgid,\n              created_time: expect.anything(),\n              type: CoordinateMediation.RECIPIENT_UPDATE_RESPONSE,\n            },\n            metaData: { packing: 'authcrypt' },\n          },\n          type: 'DIDCommV2Message-received',\n        },\n        expect.anything(),\n      )\n    }\n\n    it('should receive an update request', async () => {\n      const { mockRecipientDid_00: recipient_did } = mockRecipientDids\n      const update = { recipient_did, action: UpdateAction.ADD }\n      const message = createV3RecipientUpdateMessage(recipient.did, mediator.did, [update])\n      const messageId = message.id\n      const packedMessageContents = { packing: 'authcrypt', message } as const\n      const packedMessage = await agent.packDIDCommMessage(packedMessageContents)\n      const recipientDidUrl = mediator.did\n      const didCommMessageContents = { messageId, packedMessage, recipientDidUrl }\n      await agent.sendDIDCommMessage(didCommMessageContents)\n\n      expectRecieveUpdateRequest(messageId, [update])\n    })\n\n    it('should add a new recipient_did to the data store', async () => {\n      const { mockRecipientDid_00: recipient_did } = mockRecipientDids\n      const update = { recipient_did, action: UpdateAction.ADD }\n      const message = createV3RecipientUpdateMessage(recipient.did, mediator.did, [update])\n      const messageId = message.id\n      const packedMessageContents = { packing: 'authcrypt', message } as const\n      const packedMessage = await agent.packDIDCommMessage(packedMessageContents)\n      const recipientDidUrl = mediator.did\n      const didCommMessageContents = { messageId, packedMessage, recipientDidUrl }\n      await agent.sendDIDCommMessage(didCommMessageContents)\n      const result = await agent.mediationManagerGetRecipientDid({ recipientDid: recipient_did })\n\n      expect(result).toBe(recipient.did)\n    })\n\n    it('should remove an existing recipient_did from the data store', async () => {\n      const { mockRecipientDid_00: recipientDid } = mockRecipientDids\n      await agent.mediationManagerAddRecipientDid({ requesterDid: recipient.did, recipientDid })\n      const existingRecipientDid = await agent.mediationManagerGetRecipientDid({ recipientDid })\n\n      /* ensure the recipient_did exists in the data store so that it can be removed */\n      expect(existingRecipientDid).toBe(recipient.did)\n\n      const update = { recipient_did: recipientDid, action: UpdateAction.REMOVE }\n      const message = createV3RecipientUpdateMessage(recipient.did, mediator.did, [update])\n      const messageId = message.id\n      const packedMessageContents = { packing: 'authcrypt', message } as const\n      const packedMessage = await agent.packDIDCommMessage(packedMessageContents)\n      const recipientDidUrl = mediator.did\n      const didCommMessageContents = { messageId, packedMessage, recipientDidUrl }\n      await agent.sendDIDCommMessage(didCommMessageContents)\n      const did = await agent.mediationManagerGetRecipientDid({ recipientDid })\n\n      expect(did).toBe(null)\n    })\n\n    it('should respond correctly to a recipient update request on add SUCCESS', async () => {\n      const updates = [\n        { recipient_did: mockRecipientDids.mockRecipientDid_01, action: UpdateAction.ADD },\n        { recipient_did: mockRecipientDids.mockRecipientDid_02, action: UpdateAction.ADD },\n      ]\n      const message = createV3RecipientUpdateMessage(recipient.did, mediator.did, updates)\n      const messageId = message.id\n      const packedMessageContents = { packing: 'authcrypt', message } as const\n      const packedMessage = await agent.packDIDCommMessage(packedMessageContents)\n      const recipientDidUrl = mediator.did\n      const didCommMessageContents = { messageId, packedMessage, recipientDidUrl }\n      await agent.sendDIDCommMessage(didCommMessageContents)\n      const results = [\n        { ...updates[0], result: RecipientUpdateResult.SUCCESS },\n        { ...updates[1], result: RecipientUpdateResult.SUCCESS },\n      ]\n      expectMessageSent(messageId)\n      expectRecieveUpdateRequest(messageId, updates)\n      expectMessageSent(messageId)\n      expectRecipientUpdateReponse(messageId, results)\n    })\n\n    it('should respond correctly to a recipient update request on remove NO_CHANGE', async () => {\n      /**\n       * NOTE: we are removing a non-existent recipient_did so should recieve \"NO_CHANGE\"\n       */\n      const { mockRecipientDid_03: recipient_did } = mockRecipientDids\n      const update = { recipient_did, action: UpdateAction.REMOVE }\n      const message = createV3RecipientUpdateMessage(recipient.did, mediator.did, [update])\n      const messageId = message.id\n      const packedMessageContents = { packing: 'authcrypt', message } as const\n      const packedMessage = await agent.packDIDCommMessage(packedMessageContents)\n      const recipientDidUrl = mediator.did\n      const didCommMessageContents = { messageId, packedMessage, recipientDidUrl }\n      await agent.sendDIDCommMessage(didCommMessageContents)\n\n      expectMessageSent(messageId)\n      expectRecieveUpdateRequest(messageId, [update])\n      expectMessageSent(messageId)\n      expectRecipientUpdateReponse(messageId, [{ ...update, result: RecipientUpdateResult.NO_CHANGE }])\n    })\n\n    it('should respond correctly to a recipient update request on remove SUCCESS', async () => {\n      await agent.mediationManagerAddRecipientDid({\n        requesterDid: recipient.did,\n        recipientDid: mockRecipientDids.mockRecipientDid_01,\n      })\n\n      const { mockRecipientDid_01: recipient_did } = mockRecipientDids\n      const update = { recipient_did, action: UpdateAction.REMOVE }\n      const message = createV3RecipientUpdateMessage(recipient.did, mediator.did, [update])\n      const messageId = message.id\n      const packedMessageContents = { packing: 'authcrypt', message } as const\n      const packedMessage = await agent.packDIDCommMessage(packedMessageContents)\n      const recipientDidUrl = mediator.did\n      const didCommMessageContents = { messageId, packedMessage, recipientDidUrl }\n      await agent.sendDIDCommMessage(didCommMessageContents)\n\n      expectMessageSent(messageId)\n      expectRecieveUpdateRequest(messageId, [update])\n      expectMessageSent(messageId)\n      expectRecipientUpdateReponse(messageId, [{ ...update, result: RecipientUpdateResult.SUCCESS }])\n    })\n  })\n\n  describe('RECIPIENT QUERY', () => {\n    const expectRecieveRecipientQuery = (msgid: string) => {\n      expect(DIDCommEventSniffer.onEvent).toHaveBeenCalledWith(\n        {\n          data: {\n            message: {\n              body: {},\n              from: recipient.did,\n              id: msgid,\n              to: [mediator.did],\n              created_time: expect.anything(),\n              type: CoordinateMediation.RECIPIENT_QUERY,\n            },\n            metaData: { packing: 'authcrypt' },\n          },\n          type: 'DIDCommV2Message-received',\n        },\n        expect.anything(),\n      )\n    }\n\n    const expectRecipientQueryReponse = (msgid: string, dids: Omit<Update, 'action'>[] = []) => {\n      expect(DIDCommEventSniffer.onEvent).toHaveBeenCalledWith(\n        {\n          data: {\n            message: {\n              body: { dids },\n              from: mediator.did,\n              to: [recipient.did],\n              id: expect.anything(),\n              thid: msgid,\n              created_time: expect.anything(),\n              type: CoordinateMediation.RECIPIENT_QUERY_RESPONSE,\n            },\n            metaData: { packing: 'authcrypt' },\n          },\n          type: 'DIDCommV2Message-received',\n        },\n        expect.anything(),\n      )\n    }\n\n    it('should receive a query request', async () => {\n      const message = createV3RecipientQueryMessage(recipient.did, mediator.did)\n      const messageId = message.id\n      const packedMessageContents = { packing: 'authcrypt', message } as const\n      const packedMessage = await agent.packDIDCommMessage(packedMessageContents)\n      const recipientDidUrl = mediator.did\n      const didCommMessageContents = { messageId, packedMessage, recipientDidUrl }\n      await agent.sendDIDCommMessage(didCommMessageContents)\n\n      expectRecieveRecipientQuery(messageId)\n    })\n\n    it('should respond correctly to a recipient query request on no recipient_dids', async () => {\n      await agent.mediationManagerRemoveRecipientDid({ recipientDid: mockRecipientDids.mockRecipientDid_00 })\n      await agent.mediationManagerRemoveRecipientDid({ recipientDid: mockRecipientDids.mockRecipientDid_01 })\n      await agent.mediationManagerRemoveRecipientDid({ recipientDid: mockRecipientDids.mockRecipientDid_02 })\n      await agent.mediationManagerRemoveRecipientDid({ recipientDid: mockRecipientDids.mockRecipientDid_03 })\n\n      const message = createV3RecipientQueryMessage(recipient.did, mediator.did)\n      const messageId = message.id\n      const packedMessageContents = { packing: 'authcrypt', message } as const\n      const packedMessage = await agent.packDIDCommMessage(packedMessageContents)\n      const recipientDidUrl = mediator.did\n      const didCommMessageContents = { messageId, packedMessage, recipientDidUrl }\n      await agent.sendDIDCommMessage(didCommMessageContents)\n\n      expectMessageSent(messageId)\n      expectRecieveRecipientQuery(messageId)\n      expectMessageSent(messageId)\n      expectRecipientQueryReponse(messageId)\n    })\n\n    it('should respond correctly to a recipient query request on available recipient_dids', async () => {\n      /**\n       * NOTE: we need to insert a recipient_did into the data store to ensure a populated query\n       */\n      const insertOperationOne = {\n        recipientDid: mockRecipientDids.mockRecipientDid_00,\n        requesterDid: recipient.did,\n      }\n      const insertOperationTwo = {\n        recipientDid: mockRecipientDids.mockRecipientDid_01,\n        requesterDid: recipient.did,\n      }\n      await agent.mediationManagerAddRecipientDid(insertOperationOne)\n      await agent.mediationManagerAddRecipientDid(insertOperationTwo)\n\n      /**\n       * NOTE: we add a recipient did on another requester did to ensure that the query response\n       * only contains the inserted recipient_dids that it controls and not all recipient_dids\n       * that exist in the data store\n       **/\n      const insertOperationThree = {\n        recipientDid: mockRecipientDids.mockRecipientDid_02,\n        requesterDid: denyRecipient.did,\n      }\n      await agent.mediationManagerAddRecipientDid(insertOperationThree)\n      const recipientDidOne = await agent.mediationManagerGetRecipientDid({\n        recipientDid: insertOperationOne.recipientDid,\n      })\n      const recipientDidTwo = await agent.mediationManagerGetRecipientDid({\n        recipientDid: insertOperationTwo.recipientDid,\n      })\n      const recipientDidThree = await agent.mediationManagerGetRecipientDid({\n        recipientDid: insertOperationThree.recipientDid,\n      })\n      expect(recipientDidOne).toBe(recipient.did)\n      expect(recipientDidTwo).toBe(recipient.did)\n      expect(recipientDidThree).toBe(denyRecipient.did)\n\n      /**\n       * NOTE: now we query the recipient dids and expect the response to contain the inserted recipient_dids\n       */\n      const message = createV3RecipientQueryMessage(recipient.did, mediator.did)\n      const messageId = message.id\n      const packedMessageContents = { packing: 'authcrypt', message } as const\n      const packedMessage = await agent.packDIDCommMessage(packedMessageContents)\n      const recipientDidUrl = mediator.did\n      const didCommMessageContents = { messageId, packedMessage, recipientDidUrl }\n      await agent.sendDIDCommMessage(didCommMessageContents)\n      const dids = [\n        { recipient_did: mockRecipientDids.mockRecipientDid_00 },\n        { recipient_did: mockRecipientDids.mockRecipientDid_01 },\n      ]\n\n      expectMessageSent(messageId)\n      expectRecieveRecipientQuery(messageId)\n      expectMessageSent(messageId)\n      expectRecipientQueryReponse(messageId, dids)\n    })\n  })\n\n  describe('recipient', () => {\n    describe('MEDIATE REQUEST RESPONSE', () => {\n      it('should save new service on mediate grant', async () => {\n        const messageId = '858b8fcb-2e8e-44db-a3aa-eac10a63bfa2l'\n        const mediateRequestMessage = createV3MediateRequestMessage(recipient.did, mediator.did)\n        mediateRequestMessage.id = messageId\n        const packedMessage = await agent.packDIDCommMessage({\n          packing: 'authcrypt',\n          message: mediateRequestMessage,\n        })\n        await agent.sendDIDCommMessage({\n          messageId: mediateRequestMessage.id,\n          packedMessage,\n          recipientDidUrl: mediator.did,\n        })\n\n        const didDoc = (await agent.resolveDid({ didUrl: recipient.did })).didDocument\n        const service = didDoc?.service?.find((s) => s.id === `${recipient.did}#didcomm-mediator`)\n        expect(service?.serviceEndpoint).toEqual([{ uri: mediator.did }])\n      })\n\n      it('should remove service on mediate deny', async () => {\n        const messageId = '858b8fcb-2e8e-44db-a3aa-eac10a63bfa2l'\n        const mediateRequestMessage = createV3MediateRequestMessage(recipient.did, mediator.did)\n        mediateRequestMessage.id = messageId\n        const packedMessage = await agent.packDIDCommMessage({\n          packing: 'authcrypt',\n          message: mediateRequestMessage,\n        })\n        await agent.sendDIDCommMessage({\n          messageId: mediateRequestMessage.id,\n          packedMessage,\n          recipientDidUrl: mediator.did,\n        })\n\n        const msgid = '158b8fcb-2e8e-44db-a3aa-eac10a63bfa2l'\n        const packedDenyMessage = await agent.packDIDCommMessage({\n          packing: 'authcrypt',\n          message: {\n            type: 'https://didcomm.org/coordinate-mediation/3.0/mediate-deny',\n            from: mediator.did,\n            to: [recipient.did],\n            id: msgid,\n            thid: '',\n            body: {},\n          },\n        })\n        await agent.sendDIDCommMessage({\n          messageId: msgid,\n          packedMessage: packedDenyMessage,\n          recipientDidUrl: recipient.did,\n        })\n\n        const didDoc = (await agent.resolveDid({ didUrl: recipient.did })).didDocument\n        const service = didDoc?.service?.find((s) => s.id === `${recipient.did}#didcomm-mediator`)\n        expect(service).toBeUndefined()\n      })\n\n      it('should not save service if mediate request cannot be found', async () => {\n        const mediateGrantMessage = createV3MediateGrantMessage(recipient.did, mediator.did, '')\n        const packedMessage = await agent.packDIDCommMessage({\n          packing: 'authcrypt',\n          message: mediateGrantMessage,\n        })\n        await agent.sendDIDCommMessage({\n          messageId: mediateGrantMessage.id,\n          packedMessage,\n          recipientDidUrl: recipient.did,\n        })\n\n        const didDoc = (await agent.resolveDid({ didUrl: recipient.did })).didDocument\n        const service = didDoc?.service?.find((s) => s.id === `${recipient.did}#didcomm-mediator`)\n        expect(service).toBeUndefined()\n      })\n\n      it('should not save service if mediate grant message has bad routing_did', async () => {\n        const msgid = '158b8fcb-2e8e-44db-a3aa-eac10a63bfa2l'\n        const packedMessage = await agent.packDIDCommMessage({\n          packing: 'authcrypt',\n          message: {\n            type: 'https://didcomm.org/coordinate-mediation/3.0/mediate-grant',\n            from: mediator.did,\n            to: [recipient.did],\n            id: msgid,\n            thid: '',\n            body: {},\n          },\n        })\n        await agent.sendDIDCommMessage({\n          messageId: msgid,\n          packedMessage,\n          recipientDidUrl: recipient.did,\n        })\n\n        const didDoc = (await agent.resolveDid({ didUrl: recipient.did })).didDocument\n        const service = didDoc?.service?.find((s) => s.id === `${recipient.did}#didcomm-mediator`)\n        expect(service).toBeUndefined()\n      })\n    })\n  })\n})\n"
  },
  {
    "path": "packages/did-comm/src/__tests__/encryption.test.ts",
    "content": "import { base64ToBytes, createJWE, createX25519ECDH, Decrypter, decryptJWE, ECDH, Encrypter, JWE } from 'did-jwt'\nimport { randomBytes } from '@noble/hashes/utils'\nimport { generateX25519KeyPairFromSeed } from '../utils.js'\nimport {\n  a256cbcHs512AnonDecrypterX25519WithA256KW,\n  a256cbcHs512AnonEncrypterX25519WithA256KW,\n  a256cbcHs512AuthDecrypterX25519WithA256KW,\n  a256cbcHs512AuthEncrypterX25519WithA256KW,\n  a256gcmAnonDecrypterX25519WithA256KW,\n  a256gcmAnonEncrypterX25519WithA256KW,\n  a256gcmAuthDecrypterEcdh1PuV3x25519WithA256KW,\n  a256gcmAuthEncrypterEcdh1PuV3x25519WithA256KW,\n  xc20pAnonDecrypterX25519WithA256KW,\n  xc20pAnonEncrypterX25519WithA256KW,\n  xc20pAuthDecrypterEcdh1PuV3x25519WithA256KW,\n  xc20pAuthEncrypterEcdh1PuV3x25519WithA256KW,\n} from '../encryption/a256kw-encrypters.js'\nimport { xc20pAnonDecrypterX25519WithXC20PKW } from '../encryption/xc20pkw-encrypters.js'\n\nimport { decodeBase64url, encodeBase64url } from '../../../utils/src'\n\nimport * as u8a from 'uint8arrays'\nimport { bytesToUtf8String } from '@veramo/utils'\n\ndescribe('didcomm encryption tests', () => {\n\n  describe('using test vectors', () => {\n\n    it('XC20P with ECDH-ES+A256KW and protected header', async () => {\n      const key = base64ToBytes('b9NnuOCB0hm7YGNvaE9DMhwH_wjZA1-gWD6dA0JWdL0')\n      const decrypter = xc20pAnonDecrypterX25519WithA256KW(key)\n      const jwe = {\n        ciphertext:\n          'KWS7gJU7TbyJlcT9dPkCw-ohNigGaHSukR9MUqFM0THbCTCNkY-g5tahBFyszlKIKXs7qOtqzYyWbPou2q77XlAeYs93IhF6NvaIjyNqYklvj-OtJt9W2Pj5CLOMdsR0C30wchGoXd6wEQZY4ttbzpxYznqPmJ0b9KW6ZP-l4_DSRYe9B-1oSWMNmqMPwluKbtguC-riy356Xbu2C9ShfWmpmjz1HyJWQhZfczuwkWWlE63g26FMskIZZd_jGpEhPFHKUXCFwbuiw_Iy3R0BIzmXXdK_w7PZMMPbaxssl2UeJmLQgCAP8j8TukxV96EKa6rGgULvlo7qibjJqsS5j03bnbxkuxwbfyu3OxwgVzFWlyHbUH6p',\n        protected:\n          'eyJlcGsiOnsia3R5IjoiT0tQIiwiY3J2IjoiWDI1NTE5IiwieCI6IkpIanNtSVJaQWFCMHpSR193TlhMVjJyUGdnRjAwaGRIYlc1cmo4ZzBJMjQifSwiYXB2IjoiTmNzdUFuclJmUEs2OUEtcmtaMEw5WFdVRzRqTXZOQzNaZzc0QlB6NTNQQSIsInR5cCI6ImFwcGxpY2F0aW9uL2RpZGNvbW0tZW5jcnlwdGVkK2pzb24iLCJlbmMiOiJYQzIwUCIsImFsZyI6IkVDREgtRVMrQTI1NktXIn0',\n        recipients: [\n          {\n            encrypted_key: '3n1olyBR3nY7ZGAprOx-b7wYAKza6cvOYjNwVg3miTnbLwPP_FmE1A',\n            header: {\n              kid: 'did:example:bob#key-x25519-1',\n            },\n          },\n        ],\n        tag: '6ylC_iAs4JvDQzXeY6MuYQ',\n        iv: 'ESpmcyGiZpRjc5urDela21TOOTW8Wqd1',\n      }\n      const clearbytes = await decryptJWE(jwe, decrypter)\n      const cleartext = bytesToUtf8String(clearbytes)\n      const expected = '{\"id\":\"1234567890\",\"typ\":\"application/didcomm-plain+json\",\"type\":\"http://example.com/protocols/lets_do_lunch/1.0/proposal\",\"from\":\"did:example:alice\",\"to\":[\"did:example:bob\"],\"created_time\":1516269022,\"expires_time\":1516385931,\"body\":{\"messagespecificattribute\":\"and its value\"}}'\n      expect(cleartext).toEqual(expected)\n    })\n\n    it('XC20P with ECDH-ES+XC20PKW 1', async () => {\n      const key = base64ToBytes('+Egu1APNlDqx3YHm1LAsAHeEQi7kCUvhIXunTMpuplQ=')\n      const decrypter = xc20pAnonDecrypterX25519WithXC20PKW(key)\n      const jwe = {\n        protected: 'eyJlbmMiOiJYQzIwUCJ9',\n        recipients: [\n          {\n            header: {\n              alg: 'ECDH-ES+A256KW',\n              epk: { kty: 'OKP', crv: 'X25519', x: '2s6Xfe4ignhNvVHVn3s25FO4xBNTk170ZqqllhHHBVQ' },\n            },\n            encrypted_key: 'OHFmMeOC068rgtG_H6NRBvXh-n__bynU_lkL7xMo6hIPGRTW4yNmVA',\n          },\n          {\n            header: {\n              alg: 'ECDH-ES+XC20PKW',\n              tag: 'oLF5ceVwDl11UMiNYIbnJw',\n              iv: '0__i0CcUPS_R_FOQ33hZJqAtxfsfouHj',\n              epk: { kty: 'OKP', crv: 'X25519', x: 'fcVzcQ3-lO-hmpDtLX_1N7Z1UP31nNCqjEz3SU23zUU' },\n            },\n            encrypted_key: 'PBYJSfnq2gunqyc3goI-vSCwF5bMBHvenvxs8q8ntsA',\n          },\n        ],\n        iv: 'vw-eDC1N1KQZrAyTXsCh8bI4Xul2Ap0g',\n        ciphertext:\n          'X9Qp6fnJIpcxbsKQete7nioEFC4sC9d0gS7SH4TDeSlSlSqT9ln3UP6x2hmjz-gn5hg5PEUFaIUkETNuBSyMzHyUpE_Lx5iNAzuRnstfpQ_ZG6hka93Mbw',\n        tag: '9FQnp03c5Us_d1OdPYM7hA',\n      }\n      const\n        clearbytes = await decryptJWE(jwe, decrypter)\n      const cleartext = bytesToUtf8String(clearbytes)\n      const expected = 'i1WprsPZJy9VP2xiqbyHIQ3q0hOdleHb+e7wlV0u9e/+lzO4IYue0NqBcsrPfnF9EVqQkEpi2maC5ym79H4k4w=='\n      expect(cleartext).toEqual(expected)\n    })\n\n    it('XC20P with ECDH-ES+XC20PKW 2', async () => {\n      const key = base64ToBytes('MCFWVpCL17Y6+Ck8mVhlHv0ezly3SWDEya4DS/4zU14=')\n      const decrypter = xc20pAnonDecrypterX25519WithXC20PKW(key)\n      const jwe = {\n        protected: 'eyJlbmMiOiJYQzIwUCJ9',\n        recipients: [\n          {\n            header: {\n              alg: 'ECDH-ES+A256KW',\n              epk: { kty: 'OKP', crv: 'X25519', x: 'h6HwUrtHy0gc7KA5PSrRYtIIJxr4V3L2b0lxhWwLhUo' },\n            },\n            encrypted_key: '21iyqdWq11QvnngzFHj3wkkIRVOK6rjsdFvXJFH0kMKc8FMA4BXOOg',\n          },\n          {\n            header: {\n              alg: 'ECDH-ES+XC20PKW',\n              tag: 'TGlpNP9uMvW-y6Uc1jXfZg',\n              iv: 'szLQC8qOTAcTVbE_QCljXMaC8CmJX3T7',\n              epk: { kty: 'OKP', crv: 'X25519', x: '2rxr9f5MTxxTkmyWVGNnSX4coM3MvJguCRsQCrxt9w4' },\n            },\n            encrypted_key: 'ndhYa5ZyPr-X9FAeXLQladjmlZirzkmmHCm5rGr98s8',\n          },\n        ],\n        iv: 'Msj-fX46TRocNzhGkzL81wKhfDb9qHeg',\n        ciphertext:\n          'tcFKEWxhz-Q-nsnJppYqmFC5R0VT8fdNR0vJzUynlx--_3KDFIuDUdf0lwuwycbYXrEw94EyxfVZb3tkOADHXNaIC0njlB07_D7__eyK0N5bD88TXSe4lA',\n        tag: 'GNnsfuK6-OYVwVc5N0jyHg',\n      }\n      const clearbytes = await decryptJWE(jwe, decrypter)\n      const cleartext = bytesToUtf8String(clearbytes)\n      const expected = 'q3kCxeF6O/OSCD2R2UjkhS+DMjCN09QPchTK91LOEk5w2HQEJ+Ewo1BpkEYAuRE2CDfcMp4hIYIKc+n88BDALA=='\n      expect(cleartext).toEqual(expected)\n    })\n\n    it('XC20P with ECDH-ES+XC20PKW 3', async () => {\n      const key = base64ToBytes('KHJWEr94Z1qgaCCbsKu/oCxb07LR/ufntkr1Lu0stWU=')\n      const decrypter = xc20pAnonDecrypterX25519WithXC20PKW(key)\n      const jwe = {\n        protected: 'eyJlbmMiOiJYQzIwUCJ9',\n        recipients: [\n          {\n            header: {\n              alg: 'ECDH-ES+A256KW',\n              epk: { kty: 'OKP', crv: 'X25519', x: 'e7nXXNUZHQQd1lPTK0bzXWteGZGRg2cr73RsaKr2Lyo' },\n            },\n            encrypted_key: 'OASoE721beho7x6dGXKj6LL9NR9z7OI12ZaisNHV3b6EyJjxbWIGeg',\n          },\n          {\n            header: {\n              alg: 'ECDH-ES+XC20PKW',\n              tag: 'bdMaXGwUwNX-obqn7eqO3g',\n              iv: 'RzCIyIO4JJbLo544aqpFbIeH7pq1BIR3',\n              epk: { kty: 'OKP', crv: 'X25519', x: 'lVudXos0kqGtiGpgYj7W_CoWnlKAR5WiNeB_yHZhSS8' },\n            },\n            encrypted_key: 'iTxnM7J8iJQHash-un_EMElCjPEpVcXu0BVeKFLjJRM',\n          },\n        ],\n        iv: 'EeBBbmkL5OvvGbuqqiPVZWUhKKJ2L4Pc',\n        ciphertext:\n          '3ODDtCTQKlX6k0CKOBEE0LsbdUreF7ZeeIj27_pmyZ6uYTKikePR1N24ozdO2oGIGuvC-e9aNMLD8lJmfIbQrCzO6DD-c0AB3xULUF-z92EtI9XaGp08uA',\n        tag: 'g0IWefR0xt-ubzkUJ2Ufeg',\n      }\n      const clearbytes = await decryptJWE(jwe, decrypter)\n      const cleartext = bytesToUtf8String(clearbytes)\n      const expected = '2+YQ5xghWN7RL1BUPHgv39BJRynuZ2+KaiMRsBlnvZzjJclMYSY67SneTmysv3X3yP/DEDkZH2TVPFcHrJRYGg=='\n      expect(cleartext).toEqual(expected)\n    })\n\n  })\n\n  describe('One recipient A256KW', () => {\n    let pubkey, secretkey, cleartext: Uint8Array, encrypter: Encrypter, decrypter: Decrypter\n\n    beforeEach(() => {\n      secretkey = randomBytes(32)\n      pubkey = generateX25519KeyPairFromSeed(secretkey).publicKey\n      cleartext = u8a.fromString('hello world')\n      encrypter = xc20pAnonEncrypterX25519WithA256KW(pubkey)\n      decrypter = xc20pAnonDecrypterX25519WithA256KW(secretkey)\n    })\n\n    it('Creates with only ciphertext', async () => {\n      expect.assertions(3)\n      const jwe = await createJWE(cleartext, [encrypter], {}, undefined, true)\n      expect(jwe.aad).toBeUndefined()\n      expect(JSON.parse(decodeBase64url(jwe.protected)).enc).toEqual('XC20P')\n      expect(await decryptJWE(jwe, decrypter)).toEqual(cleartext)\n    })\n\n    it('Creates with data in protected header', async () => {\n      expect.assertions(3)\n      const jwe = await createJWE(cleartext, [encrypter], { more: 'protected' })\n      expect(jwe.aad).toBeUndefined()\n      expect(JSON.parse(decodeBase64url(jwe.protected))).toEqual({ enc: 'XC20P', more: 'protected' })\n      expect(await decryptJWE(jwe, decrypter)).toEqual(cleartext)\n    })\n\n    it('Creates with aad', async () => {\n      expect.assertions(4)\n      const aad = u8a.fromString('this data is authenticated')\n      const jwe = await createJWE(cleartext, [encrypter], { more: 'protected' }, aad)\n      expect(u8a.fromString(jwe.aad!!, 'base64url')).toEqual(aad)\n      expect(JSON.parse(decodeBase64url(jwe.protected))).toEqual({ enc: 'XC20P', more: 'protected' })\n      expect(await decryptJWE(jwe, decrypter)).toEqual(cleartext)\n      delete jwe.aad\n      await expect(decryptJWE(jwe, decrypter)).rejects.toThrow('Failed to decrypt')\n    })\n  })\n\n  describe('Multiple recipients A256KW', () => {\n    let pubkey1, secretkey1, pubkey2, secretkey2, cleartext: Uint8Array\n    let encrypter1: Encrypter, decrypter1: Decrypter, encrypter2: Encrypter, decrypter2: Decrypter\n\n    beforeEach(() => {\n      secretkey1 = randomBytes(32)\n      pubkey1 = generateX25519KeyPairFromSeed(secretkey1).publicKey\n      secretkey2 = randomBytes(32)\n      pubkey2 = generateX25519KeyPairFromSeed(secretkey2).publicKey\n      cleartext = u8a.fromString('my secret message')\n      encrypter1 = xc20pAnonEncrypterX25519WithA256KW(pubkey1)\n      decrypter1 = xc20pAnonDecrypterX25519WithA256KW(secretkey1)\n      encrypter2 = xc20pAnonEncrypterX25519WithA256KW(pubkey2)\n      decrypter2 = xc20pAnonDecrypterX25519WithA256KW(secretkey2)\n    })\n\n    it('Creates with only ciphertext', async () => {\n      expect.assertions(4)\n      const jwe = await createJWE(cleartext, [encrypter1, encrypter2])\n      expect(jwe.aad).toBeUndefined()\n      expect(JSON.parse(decodeBase64url(jwe.protected))).toEqual({ enc: 'XC20P' })\n      expect(await decryptJWE(jwe, decrypter1)).toEqual(cleartext)\n      expect(await decryptJWE(jwe, decrypter2)).toEqual(cleartext)\n    })\n\n    it('Creates with data in protected header', async () => {\n      expect.assertions(4)\n      const jwe = await createJWE(cleartext, [encrypter1, encrypter2], { more: 'protected' })\n      expect(jwe.aad).toBeUndefined()\n      expect(JSON.parse(decodeBase64url(jwe.protected))).toEqual({ enc: 'XC20P', more: 'protected' })\n      expect(await decryptJWE(jwe, decrypter2)).toEqual(cleartext)\n      expect(await decryptJWE(jwe, decrypter1)).toEqual(cleartext)\n    })\n\n    it('Creates with aad', async () => {\n      expect.assertions(6)\n      const aad = u8a.fromString('this data is authenticated')\n      const jwe = await createJWE(cleartext, [encrypter1, encrypter2], { more: 'protected' }, aad)\n      expect(u8a.fromString(jwe.aad!!, 'base64url')).toEqual(aad)\n      expect(JSON.parse(decodeBase64url(jwe.protected))).toEqual({ enc: 'XC20P', more: 'protected' })\n      expect(await decryptJWE(jwe, decrypter1)).toEqual(cleartext)\n      expect(await decryptJWE(jwe, decrypter2)).toEqual(cleartext)\n      delete jwe.aad\n      await expect(decryptJWE(jwe, decrypter1)).rejects.toThrow('Failed to decrypt')\n      await expect(decryptJWE(jwe, decrypter2)).rejects.toThrow('Failed to decrypt')\n    })\n\n    it('Incompatible encrypters throw', async () => {\n      expect.assertions(1)\n      const enc1 = { enc: 'cool enc alg1' } as Encrypter\n      const enc2 = { enc: 'cool enc alg2' } as Encrypter\n      await expect(createJWE(cleartext, [enc1, enc2])).rejects.toThrow('Incompatible encrypters passed')\n    })\n  })\n\n  describe('ECDH-1PU+A256KW (X25519), Key Wrapping Mode with XC20P content encryption', () => {\n    describe('One recipient', () => {\n      let cleartext: Uint8Array, recipientKey: any, senderKey: any, decrypter: Decrypter\n\n      beforeEach(() => {\n        recipientKey = generateX25519KeyPairFromSeed(randomBytes(32))\n        senderKey = generateX25519KeyPairFromSeed(randomBytes(32))\n        cleartext = u8a.fromString('my secret message')\n        decrypter = xc20pAuthDecrypterEcdh1PuV3x25519WithA256KW(recipientKey.secretKey, senderKey.publicKey)\n      })\n\n      it('Creates with only ciphertext', async () => {\n        const encrypter = xc20pAuthEncrypterEcdh1PuV3x25519WithA256KW(\n          recipientKey.publicKey,\n          senderKey.secretKey,\n        )\n        expect.assertions(3)\n        const jwe = await createJWE(cleartext, [encrypter])\n        expect(jwe.aad).toBeUndefined()\n        expect(JSON.parse(decodeBase64url(jwe.protected))).toEqual({ enc: 'XC20P' })\n        expect(await decryptJWE(jwe, decrypter)).toEqual(cleartext)\n      })\n\n      it('Creates with kid, no apu and no apv', async () => {\n        const kid = 'did:example:receiver#key-1'\n        const encrypter = xc20pAuthEncrypterEcdh1PuV3x25519WithA256KW(\n          recipientKey.publicKey,\n          senderKey.secretKey,\n          {\n            kid,\n          },\n        )\n        expect.assertions(6)\n        const jwe = await createJWE(cleartext, [encrypter])\n        expect(jwe.aad).toBeUndefined()\n        expect(JSON.parse(decodeBase64url(jwe.protected))).toEqual({ enc: 'XC20P' })\n        expect(jwe.recipients!![0].header.kid).toEqual(kid)\n        expect(jwe.recipients!![0].header.apu).toBeUndefined()\n        expect(jwe.recipients!![0].header.apv).toBeUndefined()\n        expect(await decryptJWE(jwe, decrypter)).toEqual(cleartext)\n      })\n\n      it('Creates with no kid, apu and apv', async () => {\n        const apu = encodeBase64url('Alice')\n        const apv = encodeBase64url('Bob')\n        const encrypter = xc20pAuthEncrypterEcdh1PuV3x25519WithA256KW(\n          recipientKey.publicKey,\n          senderKey.secretKey,\n          {\n            apu,\n            apv,\n          },\n        )\n        expect.assertions(6)\n        const jwe = await createJWE(cleartext, [encrypter])\n        expect(jwe.aad).toBeUndefined()\n        expect(JSON.parse(decodeBase64url(jwe.protected))).toEqual({ enc: 'XC20P' })\n        expect(jwe.recipients!![0].header.kid).toBeUndefined()\n        expect(jwe.recipients!![0].header.apu).toEqual(apu)\n        expect(jwe.recipients!![0].header.apv).toEqual(apv)\n        expect(await decryptJWE(jwe, decrypter)).toEqual(cleartext)\n      })\n\n      it('Creates with kid, apu and apv', async () => {\n        const kid = 'did:example:receiver#key-1'\n        const apu = encodeBase64url('Alice')\n        const apv = encodeBase64url('Bob')\n        const encrypter = xc20pAuthEncrypterEcdh1PuV3x25519WithA256KW(\n          recipientKey.publicKey,\n          senderKey.secretKey,\n          {\n            kid,\n            apu,\n            apv,\n          },\n        )\n        expect.assertions(6)\n        const jwe = await createJWE(cleartext, [encrypter])\n        expect(jwe.aad).toBeUndefined()\n        expect(JSON.parse(decodeBase64url(jwe.protected))).toEqual({ enc: 'XC20P' })\n        expect(jwe.recipients!![0].header.kid).toEqual(kid)\n        expect(jwe.recipients!![0].header.apu).toEqual(apu)\n        expect(jwe.recipients!![0].header.apv).toEqual(apv)\n        expect(await decryptJWE(jwe, decrypter)).toEqual(cleartext)\n      })\n\n      it('Creates with data in protected header', async () => {\n        const encrypter = xc20pAuthEncrypterEcdh1PuV3x25519WithA256KW(\n          recipientKey.publicKey,\n          senderKey.secretKey,\n        )\n        const skid = 'did:example:sender#key-1'\n        expect.assertions(3)\n        const jwe = await createJWE(cleartext, [encrypter], { skid, more: 'protected' })\n        expect(jwe.aad).toBeUndefined()\n        expect(JSON.parse(decodeBase64url(jwe.protected))).toEqual({ enc: 'XC20P', skid, more: 'protected' })\n        expect(await decryptJWE(jwe, decrypter)).toEqual(cleartext)\n      })\n\n      it('Creates with aad', async () => {\n        const encrypter = xc20pAuthEncrypterEcdh1PuV3x25519WithA256KW(\n          recipientKey.publicKey,\n          senderKey.secretKey,\n        )\n        expect.assertions(4)\n        const aad = u8a.fromString('this data is authenticated')\n        const jwe = await createJWE(cleartext, [encrypter], { more: 'protected' }, aad)\n        expect(u8a.fromString(jwe.aad!!, 'base64url')).toEqual(aad)\n        expect(JSON.parse(decodeBase64url(jwe.protected))).toEqual({ enc: 'XC20P', more: 'protected' })\n        expect(await decryptJWE(jwe, decrypter)).toEqual(cleartext)\n        delete jwe.aad\n        await expect(decryptJWE(jwe, decrypter)).rejects.toThrow('Failed to decrypt')\n      })\n\n      describe('using remote ECDH', () => {\n        const message = 'hello world'\n        const receiverPair = generateX25519KeyPairFromSeed(randomBytes(32))\n        const receiverRemoteECDH = createX25519ECDH(receiverPair.secretKey)\n        const senderPair = generateX25519KeyPairFromSeed(randomBytes(32))\n        const senderRemoteECDH: ECDH = createX25519ECDH(senderPair.secretKey)\n\n        it('creates anon JWE with remote ECDH', async () => {\n          const encrypter = xc20pAnonEncrypterX25519WithA256KW(receiverPair.publicKey)\n          const jwe: JWE = await createJWE(u8a.fromString(message), [encrypter])\n          const decrypter = xc20pAnonDecrypterX25519WithA256KW(receiverRemoteECDH)\n          const decryptedBytes = await decryptJWE(jwe, decrypter)\n          const receivedMessage = u8a.toString(decryptedBytes)\n          expect(receivedMessage).toEqual(message)\n        })\n\n        it('creates and decrypts auth JWE', async () => {\n          const encrypter = xc20pAuthEncrypterEcdh1PuV3x25519WithA256KW(\n            receiverPair.publicKey,\n            senderRemoteECDH,\n          )\n          const jwe: JWE = await createJWE(u8a.fromString(message), [encrypter])\n          const decrypter = xc20pAuthDecrypterEcdh1PuV3x25519WithA256KW(\n            receiverRemoteECDH,\n            senderPair.publicKey,\n          )\n          const decryptedBytes = await decryptJWE(jwe, decrypter)\n          const receivedMessage = u8a.toString(decryptedBytes)\n          expect(receivedMessage).toEqual(message)\n        })\n\n        it(`throws error when using bad secret key size`, async () => {\n          expect.assertions(1)\n          const badSecretKey = randomBytes(64)\n          expect(() => {\n            createX25519ECDH(badSecretKey)\n          }).toThrow('invalid_argument')\n        })\n\n        it(`throws error when using bad public key size`, async () => {\n          expect.assertions(1)\n          const ecdh: ECDH = createX25519ECDH(randomBytes(32))\n          const badPublicKey = randomBytes(64)\n          expect(ecdh(badPublicKey)).rejects.toThrow('invalid_argument')\n        })\n      })\n    })\n\n    describe('Multiple recipients', () => {\n      let cleartext: any, senderkey: any\n      const recipients: any[] = []\n\n      beforeEach(() => {\n        senderkey = generateX25519KeyPairFromSeed(randomBytes(32))\n        cleartext = u8a.fromString('my secret message')\n\n        recipients[0] = {\n          kid: 'did:example:receiver1#key-1',\n          recipientkey: generateX25519KeyPairFromSeed(randomBytes(32)),\n        }\n        recipients[0] = {\n          ...recipients[0],\n          ...{\n            encrypter: xc20pAuthEncrypterEcdh1PuV3x25519WithA256KW(\n              recipients[0].recipientkey.publicKey,\n              senderkey.secretKey,\n              { kid: recipients[0].kid },\n            ),\n            decrypter: xc20pAuthDecrypterEcdh1PuV3x25519WithA256KW(\n              recipients[0].recipientkey.secretKey,\n              senderkey.publicKey,\n            ),\n          },\n        }\n\n        recipients[1] = {\n          kid: 'did:example:receiver2#key-1',\n          recipientkey: generateX25519KeyPairFromSeed(randomBytes(32)),\n        }\n        recipients[1] = {\n          ...recipients[1],\n          ...{\n            encrypter: xc20pAuthEncrypterEcdh1PuV3x25519WithA256KW(\n              recipients[1].recipientkey.publicKey,\n              senderkey.secretKey,\n              { kid: recipients[1].kid },\n            ),\n            decrypter: xc20pAuthDecrypterEcdh1PuV3x25519WithA256KW(\n              recipients[1].recipientkey.secretKey,\n              senderkey.publicKey,\n            ),\n          },\n        }\n      })\n\n      it('Creates with only ciphertext', async () => {\n        expect.assertions(4)\n        const jwe = await createJWE(cleartext, [recipients[0].encrypter, recipients[1].encrypter])\n        expect(jwe.aad).toBeUndefined()\n        expect(JSON.parse(decodeBase64url(jwe.protected))).toEqual({ enc: 'XC20P' })\n        expect(await decryptJWE(jwe, recipients[0].decrypter)).toEqual(cleartext)\n        expect(await decryptJWE(jwe, recipients[1].decrypter)).toEqual(cleartext)\n      })\n\n      it('Creates with data in protected header', async () => {\n        expect.assertions(4)\n        const skid = 'did:example:sender#key-1'\n        const jwe = await createJWE(cleartext, [recipients[0].encrypter, recipients[1].encrypter], {\n          more: 'protected',\n          skid,\n        })\n        expect(jwe.aad).toBeUndefined()\n        expect(JSON.parse(decodeBase64url(jwe.protected))).toEqual({ enc: 'XC20P', more: 'protected', skid })\n        expect(await decryptJWE(jwe, recipients[0].decrypter)).toEqual(cleartext)\n        expect(await decryptJWE(jwe, recipients[0].decrypter)).toEqual(cleartext)\n      })\n\n      it('Creates with aad', async () => {\n        expect.assertions(6)\n        const aad = u8a.fromString('this data is authenticated')\n        const jwe = await createJWE(\n          cleartext,\n          [recipients[0].encrypter, recipients[1].encrypter],\n          { more: 'protected' },\n          aad,\n        )\n        expect(u8a.fromString(jwe.aad!!, 'base64url')).toEqual(aad)\n        expect(JSON.parse(decodeBase64url(jwe.protected))).toEqual({ enc: 'XC20P', more: 'protected' })\n        expect(await decryptJWE(jwe, recipients[0].decrypter)).toEqual(cleartext)\n        expect(await decryptJWE(jwe, recipients[1].decrypter)).toEqual(cleartext)\n        delete jwe.aad\n        await expect(decryptJWE(jwe, recipients[0].decrypter)).rejects.toThrow('Failed to decrypt')\n        await expect(decryptJWE(jwe, recipients[0].decrypter)).rejects.toThrow('Failed to decrypt')\n      })\n\n      it('Incompatible encrypters throw', async () => {\n        expect.assertions(1)\n        const enc1 = { enc: 'cool enc alg1' } as Encrypter\n        const enc2 = { enc: 'cool enc alg2' } as Encrypter\n        await expect(createJWE(cleartext, [enc1, enc2])).rejects.toThrow('Incompatible encrypters passed')\n      })\n    })\n  })\n\n  describe('ECDH-ES+A256KW (X25519), Key Wrapping Mode with A256GCM content encryption', () => {\n    describe('One recipient', () => {\n      let cleartext: Uint8Array, recipientKey: any, senderKey: any, decrypter: Decrypter\n\n      beforeEach(() => {\n        recipientKey = generateX25519KeyPairFromSeed(randomBytes(32))\n        senderKey = generateX25519KeyPairFromSeed(randomBytes(32))\n        cleartext = u8a.fromString('my secret message')\n        decrypter = a256gcmAnonDecrypterX25519WithA256KW(recipientKey.secretKey)\n      })\n\n      it('Creates with only ciphertext', async () => {\n        const encrypter = a256gcmAnonEncrypterX25519WithA256KW(recipientKey.publicKey)\n        expect.assertions(3)\n        const jwe = await createJWE(cleartext, [encrypter])\n        expect(jwe.aad).toBeUndefined()\n        expect(JSON.parse(decodeBase64url(jwe.protected))).toEqual({ enc: 'A256GCM' })\n        expect(await decryptJWE(jwe, decrypter)).toEqual(cleartext)\n      })\n\n      it('Creates with kid, no apu and no apv', async () => {\n        const kid = 'did:example:receiver#key-1'\n        const encrypter = a256gcmAnonEncrypterX25519WithA256KW(recipientKey.publicKey, kid)\n        expect.assertions(6)\n        const jwe = await createJWE(cleartext, [encrypter])\n        expect(jwe.aad).toBeUndefined()\n        expect(JSON.parse(decodeBase64url(jwe.protected))).toEqual({ enc: 'A256GCM' })\n        expect(jwe.recipients!![0].header.kid).toEqual(kid)\n        expect(jwe.recipients!![0].header.apu).toBeUndefined()\n        expect(jwe.recipients!![0].header.apv).toBeUndefined()\n        expect(await decryptJWE(jwe, decrypter)).toEqual(cleartext)\n      })\n\n      it('Creates with no kid, with apv', async () => {\n        const apv = encodeBase64url('Bob')\n        const encrypter = a256gcmAnonEncrypterX25519WithA256KW(recipientKey.publicKey, undefined, apv)\n        expect.assertions(5)\n        const jwe = await createJWE(cleartext, [encrypter])\n        expect(jwe.aad).toBeUndefined()\n        expect(JSON.parse(decodeBase64url(jwe.protected))).toEqual({ enc: 'A256GCM' })\n        expect(jwe.recipients!![0].header.kid).toBeUndefined()\n        expect(jwe.recipients!![0].header.apv).toEqual(apv)\n        expect(await decryptJWE(jwe, decrypter)).toEqual(cleartext)\n      })\n\n      it('Creates with kid and apv', async () => {\n        const kid = 'did:example:receiver#key-1'\n        const apv = encodeBase64url('Bob')\n        const encrypter = a256gcmAnonEncrypterX25519WithA256KW(recipientKey.publicKey, kid, apv)\n        expect.assertions(5)\n        const jwe = await createJWE(cleartext, [encrypter])\n        expect(jwe.aad).toBeUndefined()\n        expect(JSON.parse(decodeBase64url(jwe.protected))).toEqual({ enc: 'A256GCM' })\n        expect(jwe.recipients!![0].header.kid).toEqual(kid)\n        expect(jwe.recipients!![0].header.apv).toEqual(apv)\n        expect(await decryptJWE(jwe, decrypter)).toEqual(cleartext)\n      })\n\n      it('Creates with data in protected header', async () => {\n        const encrypter = a256gcmAnonEncrypterX25519WithA256KW(recipientKey.publicKey)\n        const skid = 'did:example:sender#key-1'\n        expect.assertions(3)\n        const jwe = await createJWE(cleartext, [encrypter], { skid, more: 'protected' })\n        expect(jwe.aad).toBeUndefined()\n        expect(JSON.parse(decodeBase64url(jwe.protected))).toEqual({ enc: 'A256GCM', skid, more: 'protected' })\n        expect(await decryptJWE(jwe, decrypter)).toEqual(cleartext)\n      })\n\n      it('Creates with aad', async () => {\n        const encrypter = a256gcmAnonEncrypterX25519WithA256KW(recipientKey.publicKey)\n        expect.assertions(4)\n        const aad = u8a.fromString('this data is authenticated')\n        const jwe = await createJWE(cleartext, [encrypter], { more: 'protected' }, aad)\n        expect(u8a.fromString(jwe.aad!!, 'base64url')).toEqual(aad)\n        expect(JSON.parse(decodeBase64url(jwe.protected))).toEqual({ enc: 'A256GCM', more: 'protected' })\n        expect(await decryptJWE(jwe, decrypter)).toEqual(cleartext)\n        delete jwe.aad\n        await expect(decryptJWE(jwe, decrypter)).rejects.toThrow()\n      })\n\n      describe('using remote ECDH', () => {\n        const message = 'hello world'\n        const receiverPair = generateX25519KeyPairFromSeed(randomBytes(32))\n        const receiverRemoteECDH = createX25519ECDH(receiverPair.secretKey)\n\n        it('creates JWE with remote ECDH', async () => {\n          const encrypter = a256gcmAnonEncrypterX25519WithA256KW(receiverPair.publicKey)\n          const jwe: JWE = await createJWE(u8a.fromString(message), [encrypter])\n          const decrypter = a256gcmAnonDecrypterX25519WithA256KW(receiverRemoteECDH)\n          const decryptedBytes = await decryptJWE(jwe, decrypter)\n          const receivedMessage = u8a.toString(decryptedBytes)\n          expect(receivedMessage).toEqual(message)\n        })\n      })\n    })\n\n    describe('Multiple recipients', () => {\n      let cleartext: any, senderkey: any\n      const recipients: any[] = []\n\n      beforeEach(() => {\n        senderkey = generateX25519KeyPairFromSeed(randomBytes(32))\n        cleartext = u8a.fromString('my secret message')\n\n        recipients[0] = {\n          kid: 'did:example:receiver1#key-1',\n          recipientkey: generateX25519KeyPairFromSeed(randomBytes(32)),\n        }\n        recipients[0] = {\n          ...recipients[0],\n          ...{\n            encrypter: a256gcmAnonEncrypterX25519WithA256KW(\n              recipients[0].recipientkey.publicKey,\n              recipients[0].kid,\n            ),\n            decrypter: a256gcmAnonDecrypterX25519WithA256KW(recipients[0].recipientkey.secretKey),\n          },\n        }\n\n        recipients[1] = {\n          kid: 'did:example:receiver2#key-1',\n          recipientkey: generateX25519KeyPairFromSeed(randomBytes(32)),\n        }\n        recipients[1] = {\n          ...recipients[1],\n          ...{\n            encrypter: a256gcmAnonEncrypterX25519WithA256KW(\n              recipients[1].recipientkey.publicKey,\n              recipients[1].kid,\n            ),\n            decrypter: a256gcmAnonDecrypterX25519WithA256KW(recipients[1].recipientkey.secretKey),\n          },\n        }\n      })\n\n      it('Creates with only ciphertext', async () => {\n        expect.assertions(4)\n        const jwe = await createJWE(cleartext, [recipients[0].encrypter, recipients[1].encrypter])\n        expect(jwe.aad).toBeUndefined()\n        expect(JSON.parse(decodeBase64url(jwe.protected))).toEqual({ enc: 'A256GCM' })\n        expect(await decryptJWE(jwe, recipients[0].decrypter)).toEqual(cleartext)\n        expect(await decryptJWE(jwe, recipients[1].decrypter)).toEqual(cleartext)\n      })\n\n      it('Creates with data in protected header', async () => {\n        expect.assertions(4)\n        const skid = 'did:example:sender#key-1'\n        const jwe = await createJWE(cleartext, [recipients[0].encrypter, recipients[1].encrypter], {\n          more: 'protected',\n          skid,\n        })\n        expect(jwe.aad).toBeUndefined()\n        expect(JSON.parse(decodeBase64url(jwe.protected))).toEqual({ enc: 'A256GCM', more: 'protected', skid })\n        expect(await decryptJWE(jwe, recipients[0].decrypter)).toEqual(cleartext)\n        expect(await decryptJWE(jwe, recipients[0].decrypter)).toEqual(cleartext)\n      })\n\n      it('Creates with aad', async () => {\n        expect.assertions(6)\n        const aad = u8a.fromString('this data is authenticated')\n        const jwe = await createJWE(\n          cleartext,\n          [recipients[0].encrypter, recipients[1].encrypter],\n          { more: 'protected' },\n          aad,\n        )\n        expect(u8a.fromString(jwe.aad!!, 'base64url')).toEqual(aad)\n        expect(JSON.parse(decodeBase64url(jwe.protected))).toEqual({ enc: 'A256GCM', more: 'protected' })\n        expect(await decryptJWE(jwe, recipients[0].decrypter)).toEqual(cleartext)\n        expect(await decryptJWE(jwe, recipients[1].decrypter)).toEqual(cleartext)\n        delete jwe.aad\n        await expect(decryptJWE(jwe, recipients[0].decrypter)).rejects.toThrow()\n        await expect(decryptJWE(jwe, recipients[1].decrypter)).rejects.toThrow()\n      })\n\n      it('Incompatible encrypters throw', async () => {\n        expect.assertions(1)\n        const enc1 = { enc: 'cool enc alg1' } as Encrypter\n        const enc2 = { enc: 'cool enc alg2' } as Encrypter\n        await expect(createJWE(cleartext, [enc1, enc2])).rejects.toThrow('Incompatible encrypters passed')\n      })\n    })\n  })\n\n  describe('ECDH-1PU+A256KW (X25519), Key Wrapping Mode with A256GCM content encryption', () => {\n    describe('One recipient', () => {\n      let cleartext: Uint8Array, recipientKey: any, senderKey: any, decrypter: Decrypter\n\n      beforeEach(() => {\n        recipientKey = generateX25519KeyPairFromSeed(randomBytes(32))\n        senderKey = generateX25519KeyPairFromSeed(randomBytes(32))\n        cleartext = u8a.fromString('my secret message')\n        decrypter = a256gcmAuthDecrypterEcdh1PuV3x25519WithA256KW(recipientKey.secretKey, senderKey.publicKey)\n      })\n\n      it('Creates with only ciphertext', async () => {\n        const encrypter = a256gcmAuthEncrypterEcdh1PuV3x25519WithA256KW(\n          recipientKey.publicKey,\n          senderKey.secretKey,\n        )\n        expect.assertions(3)\n        const jwe = await createJWE(cleartext, [encrypter])\n        expect(jwe.aad).toBeUndefined()\n        expect(JSON.parse(decodeBase64url(jwe.protected))).toEqual({ enc: 'A256GCM' })\n        expect(await decryptJWE(jwe, decrypter)).toEqual(cleartext)\n      })\n\n      it('Creates with kid, no apu and no apv', async () => {\n        const kid = 'did:example:receiver#key-1'\n        const encrypter = a256gcmAuthEncrypterEcdh1PuV3x25519WithA256KW(\n          recipientKey.publicKey,\n          senderKey.secretKey,\n          {\n            kid,\n          },\n        )\n        expect.assertions(6)\n        const jwe = await createJWE(cleartext, [encrypter])\n        expect(jwe.aad).toBeUndefined()\n        expect(JSON.parse(decodeBase64url(jwe.protected))).toEqual({ enc: 'A256GCM' })\n        expect(jwe.recipients!![0].header.kid).toEqual(kid)\n        expect(jwe.recipients!![0].header.apu).toBeUndefined()\n        expect(jwe.recipients!![0].header.apv).toBeUndefined()\n        expect(await decryptJWE(jwe, decrypter)).toEqual(cleartext)\n      })\n\n      it('Creates with no kid, with apu and apv', async () => {\n        const apu = encodeBase64url('Alice')\n        const apv = encodeBase64url('Bob')\n        const encrypter = a256gcmAuthEncrypterEcdh1PuV3x25519WithA256KW(\n          recipientKey.publicKey,\n          senderKey.secretKey,\n          {\n            apu,\n            apv,\n          },\n        )\n        expect.assertions(6)\n        const jwe = await createJWE(cleartext, [encrypter])\n        expect(jwe.aad).toBeUndefined()\n        expect(JSON.parse(decodeBase64url(jwe.protected))).toEqual({ enc: 'A256GCM' })\n        expect(jwe.recipients!![0].header.kid).toBeUndefined()\n        expect(jwe.recipients!![0].header.apu).toEqual(apu)\n        expect(jwe.recipients!![0].header.apv).toEqual(apv)\n        expect(await decryptJWE(jwe, decrypter)).toEqual(cleartext)\n      })\n\n      it('Creates with kid and apu and apv', async () => {\n        const kid = 'did:example:receiver#key-1'\n        const apu = encodeBase64url('Alice')\n        const apv = encodeBase64url('Bob')\n        const encrypter = a256gcmAuthEncrypterEcdh1PuV3x25519WithA256KW(\n          recipientKey.publicKey,\n          senderKey.secretKey,\n          {\n            kid,\n            apu,\n            apv,\n          },\n        )\n        expect.assertions(6)\n        const jwe = await createJWE(cleartext, [encrypter])\n        expect(jwe.aad).toBeUndefined()\n        expect(JSON.parse(decodeBase64url(jwe.protected))).toEqual({ enc: 'A256GCM' })\n        expect(jwe.recipients!![0].header.kid).toEqual(kid)\n        expect(jwe.recipients!![0].header.apu).toEqual(apu)\n        expect(jwe.recipients!![0].header.apv).toEqual(apv)\n        expect(await decryptJWE(jwe, decrypter)).toEqual(cleartext)\n      })\n\n      it('Creates with data in protected header', async () => {\n        const encrypter = a256gcmAuthEncrypterEcdh1PuV3x25519WithA256KW(\n          recipientKey.publicKey,\n          senderKey.secretKey,\n        )\n        const skid = 'did:example:sender#key-1'\n        expect.assertions(3)\n        const jwe = await createJWE(cleartext, [encrypter], { skid, more: 'protected' })\n        expect(jwe.aad).toBeUndefined()\n        expect(JSON.parse(decodeBase64url(jwe.protected))).toEqual({ enc: 'A256GCM', skid, more: 'protected' })\n        expect(await decryptJWE(jwe, decrypter)).toEqual(cleartext)\n      })\n\n      it('Creates with aad', async () => {\n        const encrypter = a256gcmAuthEncrypterEcdh1PuV3x25519WithA256KW(\n          recipientKey.publicKey,\n          senderKey.secretKey,\n        )\n        expect.assertions(4)\n        const aad = u8a.fromString('this data is authenticated')\n        const jwe = await createJWE(cleartext, [encrypter], { more: 'protected' }, aad)\n        expect(u8a.fromString(jwe.aad!!, 'base64url')).toEqual(aad)\n        expect(JSON.parse(decodeBase64url(jwe.protected))).toEqual({ enc: 'A256GCM', more: 'protected' })\n        expect(await decryptJWE(jwe, decrypter)).toEqual(cleartext)\n        delete jwe.aad\n        await expect(decryptJWE(jwe, decrypter)).rejects.toThrow()\n      })\n\n      describe('using remote ECDH', () => {\n        const message = 'hello world'\n        const receiverPair = generateX25519KeyPairFromSeed(randomBytes(32))\n        const receiverRemoteECDH = createX25519ECDH(receiverPair.secretKey)\n        const senderPair = generateX25519KeyPairFromSeed(randomBytes(32))\n        const senderRemoteECDH: ECDH = createX25519ECDH(senderPair.secretKey)\n\n        it('creates JWE with remote ECDH', async () => {\n          const encrypter = a256gcmAuthEncrypterEcdh1PuV3x25519WithA256KW(\n            receiverPair.publicKey,\n            senderRemoteECDH,\n          )\n          const jwe: JWE = await createJWE(u8a.fromString(message), [encrypter])\n          const decrypter = a256gcmAuthDecrypterEcdh1PuV3x25519WithA256KW(\n            receiverRemoteECDH,\n            senderPair.publicKey,\n          )\n          const decryptedBytes = await decryptJWE(jwe, decrypter)\n          const receivedMessage = u8a.toString(decryptedBytes)\n          expect(receivedMessage).toEqual(message)\n        })\n      })\n    })\n\n    describe('Multiple recipients', () => {\n      let cleartext: any, senderkey: any\n      const recipients: any[] = []\n\n      beforeEach(() => {\n        senderkey = generateX25519KeyPairFromSeed(randomBytes(32))\n        cleartext = u8a.fromString('my secret message')\n\n        recipients[0] = {\n          kid: 'did:example:receiver1#key-1',\n          recipientkey: generateX25519KeyPairFromSeed(randomBytes(32)),\n        }\n        recipients[0] = {\n          ...recipients[0],\n          ...{\n            encrypter: a256gcmAuthEncrypterEcdh1PuV3x25519WithA256KW(\n              recipients[0].recipientkey.publicKey,\n              senderkey.secretKey,\n              { kid: recipients[0].kid },\n            ),\n            decrypter: a256gcmAuthDecrypterEcdh1PuV3x25519WithA256KW(\n              recipients[0].recipientkey.secretKey,\n              senderkey.publicKey,\n            ),\n          },\n        }\n\n        recipients[1] = {\n          kid: 'did:example:receiver2#key-1',\n          recipientkey: generateX25519KeyPairFromSeed(randomBytes(32)),\n        }\n        recipients[1] = {\n          ...recipients[1],\n          ...{\n            encrypter: a256gcmAuthEncrypterEcdh1PuV3x25519WithA256KW(\n              recipients[1].recipientkey.publicKey,\n              senderkey.secretKey,\n              { kid: recipients[1].kid },\n            ),\n            decrypter: a256gcmAuthDecrypterEcdh1PuV3x25519WithA256KW(\n              recipients[1].recipientkey.secretKey,\n              senderkey.publicKey,\n            ),\n          },\n        }\n      })\n\n      it('Creates with only ciphertext', async () => {\n        expect.assertions(4)\n        const jwe = await createJWE(cleartext, [recipients[0].encrypter, recipients[1].encrypter])\n        expect(jwe.aad).toBeUndefined()\n        expect(JSON.parse(decodeBase64url(jwe.protected))).toEqual({ enc: 'A256GCM' })\n        expect(await decryptJWE(jwe, recipients[0].decrypter)).toEqual(cleartext)\n        expect(await decryptJWE(jwe, recipients[1].decrypter)).toEqual(cleartext)\n      })\n\n      it('Creates with data in protected header', async () => {\n        expect.assertions(4)\n        const skid = 'did:example:sender#key-1'\n        const jwe = await createJWE(cleartext, [recipients[0].encrypter, recipients[1].encrypter], {\n          more: 'protected',\n          skid,\n        })\n        expect(jwe.aad).toBeUndefined()\n        expect(JSON.parse(decodeBase64url(jwe.protected))).toEqual({ enc: 'A256GCM', more: 'protected', skid })\n        expect(await decryptJWE(jwe, recipients[0].decrypter)).toEqual(cleartext)\n        expect(await decryptJWE(jwe, recipients[0].decrypter)).toEqual(cleartext)\n      })\n\n      it('Creates with aad', async () => {\n        expect.assertions(6)\n        const aad = u8a.fromString('this data is authenticated')\n        const jwe = await createJWE(\n          cleartext,\n          [recipients[0].encrypter, recipients[1].encrypter],\n          { more: 'protected' },\n          aad,\n        )\n        expect(u8a.fromString(jwe.aad!!, 'base64url')).toEqual(aad)\n        expect(JSON.parse(decodeBase64url(jwe.protected))).toEqual({ enc: 'A256GCM', more: 'protected' })\n        expect(await decryptJWE(jwe, recipients[0].decrypter)).toEqual(cleartext)\n        expect(await decryptJWE(jwe, recipients[1].decrypter)).toEqual(cleartext)\n        delete jwe.aad\n        await expect(decryptJWE(jwe, recipients[0].decrypter)).rejects.toThrow()\n        await expect(decryptJWE(jwe, recipients[1].decrypter)).rejects.toThrow()\n      })\n\n      it('Incompatible encrypters throw', async () => {\n        expect.assertions(1)\n        const enc1 = { enc: 'cool enc alg1' } as Encrypter\n        const enc2 = { enc: 'cool enc alg2' } as Encrypter\n        await expect(createJWE(cleartext, [enc1, enc2])).rejects.toThrow('Incompatible encrypters passed')\n      })\n    })\n  })\n\n  describe('ECDH-ES+A256KW (X25519), Key Wrapping Mode with A256CBC-HS512 content encryption', () => {\n    describe('One recipient', () => {\n      let cleartext: Uint8Array, recipientKey: any, senderKey: any, decrypter: Decrypter\n\n      beforeEach(() => {\n        recipientKey = generateX25519KeyPairFromSeed(randomBytes(32))\n        senderKey = generateX25519KeyPairFromSeed(randomBytes(32))\n        cleartext = u8a.fromString('my secret message')\n        decrypter = a256cbcHs512AnonDecrypterX25519WithA256KW(recipientKey.secretKey)\n      })\n\n      it('Creates with only ciphertext', async () => {\n        const encrypter = a256cbcHs512AnonEncrypterX25519WithA256KW(recipientKey.publicKey)\n        expect.assertions(3)\n        const jwe = await createJWE(cleartext, [encrypter])\n        expect(jwe.aad).toBeUndefined()\n        expect(JSON.parse(decodeBase64url(jwe.protected))).toEqual({ enc: 'A256CBC-HS512' })\n        expect(await decryptJWE(jwe, decrypter)).toEqual(cleartext)\n      })\n\n      it('Creates with kid, no apu and no apv', async () => {\n        const kid = 'did:example:receiver#key-1'\n        const encrypter = a256cbcHs512AnonEncrypterX25519WithA256KW(recipientKey.publicKey, kid)\n        expect.assertions(6)\n        const jwe = await createJWE(cleartext, [encrypter])\n        expect(jwe.aad).toBeUndefined()\n        expect(JSON.parse(decodeBase64url(jwe.protected))).toEqual({ enc: 'A256CBC-HS512' })\n        expect(jwe.recipients!![0].header.kid).toEqual(kid)\n        expect(jwe.recipients!![0].header.apu).toBeUndefined()\n        expect(jwe.recipients!![0].header.apv).toBeUndefined()\n        expect(await decryptJWE(jwe, decrypter)).toEqual(cleartext)\n      })\n\n      it('Creates with no kid, with apv', async () => {\n        const apv = encodeBase64url('Bob')\n        const encrypter = a256cbcHs512AnonEncrypterX25519WithA256KW(recipientKey.publicKey, undefined, apv)\n        expect.assertions(5)\n        const jwe = await createJWE(cleartext, [encrypter])\n        expect(jwe.aad).toBeUndefined()\n        expect(JSON.parse(decodeBase64url(jwe.protected))).toEqual({ enc: 'A256CBC-HS512' })\n        expect(jwe.recipients!![0].header.kid).toBeUndefined()\n        expect(jwe.recipients!![0].header.apv).toEqual(apv)\n        expect(await decryptJWE(jwe, decrypter)).toEqual(cleartext)\n      })\n\n      it('Creates with kid and apv', async () => {\n        const kid = 'did:example:receiver#key-1'\n        const apv = encodeBase64url('Bob')\n        const encrypter = a256cbcHs512AnonEncrypterX25519WithA256KW(recipientKey.publicKey, kid, apv)\n        expect.assertions(5)\n        const jwe = await createJWE(cleartext, [encrypter])\n        expect(jwe.aad).toBeUndefined()\n        expect(JSON.parse(decodeBase64url(jwe.protected))).toEqual({ enc: 'A256CBC-HS512' })\n        expect(jwe.recipients!![0].header.kid).toEqual(kid)\n        expect(jwe.recipients!![0].header.apv).toEqual(apv)\n        expect(await decryptJWE(jwe, decrypter)).toEqual(cleartext)\n      })\n\n      it('Creates with data in protected header', async () => {\n        const encrypter = a256cbcHs512AnonEncrypterX25519WithA256KW(recipientKey.publicKey)\n        const skid = 'did:example:sender#key-1'\n        expect.assertions(3)\n        const jwe = await createJWE(cleartext, [encrypter], { skid, more: 'protected' })\n        expect(jwe.aad).toBeUndefined()\n        expect(JSON.parse(decodeBase64url(jwe.protected))).toEqual({\n          enc: 'A256CBC-HS512',\n          skid,\n          more: 'protected',\n        })\n        expect(await decryptJWE(jwe, decrypter)).toEqual(cleartext)\n      })\n\n      it('Creates with aad', async () => {\n        const encrypter = a256cbcHs512AnonEncrypterX25519WithA256KW(recipientKey.publicKey)\n        expect.assertions(4)\n        const aad = u8a.fromString('this data is authenticated')\n        const jwe = await createJWE(cleartext, [encrypter], { more: 'protected' }, aad)\n        expect(u8a.fromString(jwe.aad!!, 'base64url')).toEqual(aad)\n        expect(JSON.parse(decodeBase64url(jwe.protected))).toEqual({ enc: 'A256CBC-HS512', more: 'protected' })\n        expect(await decryptJWE(jwe, decrypter)).toEqual(cleartext)\n        delete jwe.aad\n        await expect(decryptJWE(jwe, decrypter)).rejects.toThrow('Failed to decrypt')\n      })\n\n      describe('using remote ECDH', () => {\n        const message = 'hello world'\n        const receiverPair = generateX25519KeyPairFromSeed(randomBytes(32))\n        const receiverRemoteECDH = createX25519ECDH(receiverPair.secretKey)\n\n        it('creates JWE with remote ECDH', async () => {\n          const encrypter = a256cbcHs512AnonEncrypterX25519WithA256KW(receiverPair.publicKey)\n          const jwe: JWE = await createJWE(u8a.fromString(message), [encrypter])\n          const decrypter = a256cbcHs512AnonDecrypterX25519WithA256KW(receiverRemoteECDH)\n          const decryptedBytes = await decryptJWE(jwe, decrypter)\n          const receivedMessage = u8a.toString(decryptedBytes)\n          expect(receivedMessage).toEqual(message)\n        })\n      })\n    })\n\n    describe('Multiple recipients', () => {\n      let cleartext: any, senderkey: any\n      const recipients: any[] = []\n\n      beforeEach(() => {\n        senderkey = generateX25519KeyPairFromSeed(randomBytes(32))\n        cleartext = u8a.fromString('my secret message')\n\n        recipients[0] = {\n          kid: 'did:example:receiver1#key-1',\n          recipientkey: generateX25519KeyPairFromSeed(randomBytes(32)),\n        }\n        recipients[0] = {\n          ...recipients[0],\n          ...{\n            encrypter: a256cbcHs512AnonEncrypterX25519WithA256KW(\n              recipients[0].recipientkey.publicKey,\n              recipients[0].kid,\n            ),\n            decrypter: a256cbcHs512AnonDecrypterX25519WithA256KW(recipients[0].recipientkey.secretKey),\n          },\n        }\n\n        recipients[1] = {\n          kid: 'did:example:receiver2#key-1',\n          recipientkey: generateX25519KeyPairFromSeed(randomBytes(32)),\n        }\n        recipients[1] = {\n          ...recipients[1],\n          ...{\n            encrypter: a256cbcHs512AnonEncrypterX25519WithA256KW(\n              recipients[1].recipientkey.publicKey,\n              recipients[1].kid,\n            ),\n            decrypter: a256cbcHs512AnonDecrypterX25519WithA256KW(recipients[1].recipientkey.secretKey),\n          },\n        }\n      })\n\n      it('Creates with only ciphertext', async () => {\n        expect.assertions(4)\n        const jwe = await createJWE(cleartext, [recipients[0].encrypter, recipients[1].encrypter])\n        expect(jwe.aad).toBeUndefined()\n        expect(JSON.parse(decodeBase64url(jwe.protected))).toEqual({ enc: 'A256CBC-HS512' })\n        expect(await decryptJWE(jwe, recipients[0].decrypter)).toEqual(cleartext)\n        expect(await decryptJWE(jwe, recipients[1].decrypter)).toEqual(cleartext)\n      })\n\n      it('Creates with data in protected header', async () => {\n        expect.assertions(4)\n        const skid = 'did:example:sender#key-1'\n        const jwe = await createJWE(cleartext, [recipients[0].encrypter, recipients[1].encrypter], {\n          more: 'protected',\n          skid,\n        })\n        expect(jwe.aad).toBeUndefined()\n        expect(JSON.parse(decodeBase64url(jwe.protected))).toEqual({\n          enc: 'A256CBC-HS512',\n          more: 'protected',\n          skid,\n        })\n        expect(await decryptJWE(jwe, recipients[0].decrypter)).toEqual(cleartext)\n        expect(await decryptJWE(jwe, recipients[0].decrypter)).toEqual(cleartext)\n      })\n\n      it('Creates with aad', async () => {\n        expect.assertions(6)\n        const aad = u8a.fromString('this data is authenticated')\n        const jwe = await createJWE(\n          cleartext,\n          [recipients[0].encrypter, recipients[1].encrypter],\n          { more: 'protected' },\n          aad,\n        )\n        expect(u8a.fromString(jwe.aad!!, 'base64url')).toEqual(aad)\n        expect(JSON.parse(decodeBase64url(jwe.protected))).toEqual({ enc: 'A256CBC-HS512', more: 'protected' })\n        expect(await decryptJWE(jwe, recipients[0].decrypter)).toEqual(cleartext)\n        expect(await decryptJWE(jwe, recipients[1].decrypter)).toEqual(cleartext)\n        delete jwe.aad\n        await expect(decryptJWE(jwe, recipients[0].decrypter)).rejects.toThrow('Failed to decrypt')\n        await expect(decryptJWE(jwe, recipients[1].decrypter)).rejects.toThrow('Failed to decrypt')\n      })\n\n      it('Incompatible encrypters throw', async () => {\n        expect.assertions(1)\n        const enc1 = { enc: 'cool enc alg1' } as Encrypter\n        const enc2 = { enc: 'cool enc alg2' } as Encrypter\n        await expect(createJWE(cleartext, [enc1, enc2])).rejects.toThrow('Incompatible encrypters passed')\n      })\n    })\n  })\n\n  describe('ECDH-1PU+A256KW (X25519), Key Wrapping Mode with A256CBC-HS512 content encryption', () => {\n    describe('One recipient', () => {\n      let cleartext: Uint8Array, recipientKey: any, senderKey: any, decrypter: Decrypter\n\n      beforeEach(() => {\n        recipientKey = generateX25519KeyPairFromSeed(randomBytes(32))\n        senderKey = generateX25519KeyPairFromSeed(randomBytes(32))\n        cleartext = u8a.fromString('my secret message')\n        decrypter = a256cbcHs512AuthDecrypterX25519WithA256KW(recipientKey.secretKey, senderKey.publicKey)\n      })\n\n      it('Creates with only ciphertext', async () => {\n        const encrypter = a256cbcHs512AuthEncrypterX25519WithA256KW(recipientKey.publicKey, senderKey.secretKey)\n        expect.assertions(3)\n        const jwe = await createJWE(cleartext, [encrypter])\n        expect(jwe.aad).toBeUndefined()\n        expect(JSON.parse(decodeBase64url(jwe.protected))).toEqual({ enc: 'A256CBC-HS512' })\n        expect(await decryptJWE(jwe, decrypter)).toEqual(cleartext)\n      })\n\n      it('Creates with kid, no apu and no apv', async () => {\n        const kid = 'did:example:receiver#key-1'\n        const encrypter = a256cbcHs512AuthEncrypterX25519WithA256KW(\n          recipientKey.publicKey,\n          senderKey.secretKey,\n          {\n            kid,\n          },\n        )\n        expect.assertions(6)\n        const jwe = await createJWE(cleartext, [encrypter])\n        expect(jwe.aad).toBeUndefined()\n        expect(JSON.parse(decodeBase64url(jwe.protected))).toEqual({ enc: 'A256CBC-HS512' })\n        expect(jwe.recipients!![0].header.kid).toEqual(kid)\n        expect(jwe.recipients!![0].header.apu).toBeUndefined()\n        expect(jwe.recipients!![0].header.apv).toBeUndefined()\n        expect(await decryptJWE(jwe, decrypter)).toEqual(cleartext)\n      })\n\n      it('Creates with no kid, with apu and apv', async () => {\n        const apu = encodeBase64url('Alice')\n        const apv = encodeBase64url('Bob')\n        const encrypter = a256cbcHs512AuthEncrypterX25519WithA256KW(\n          recipientKey.publicKey,\n          senderKey.secretKey,\n          {\n            apu,\n            apv,\n          },\n        )\n        expect.assertions(6)\n        const jwe = await createJWE(cleartext, [encrypter])\n        expect(jwe.aad).toBeUndefined()\n        expect(JSON.parse(decodeBase64url(jwe.protected))).toEqual({ enc: 'A256CBC-HS512' })\n        expect(jwe.recipients!![0].header.kid).toBeUndefined()\n        expect(jwe.recipients!![0].header.apu).toEqual(apu)\n        expect(jwe.recipients!![0].header.apv).toEqual(apv)\n        expect(await decryptJWE(jwe, decrypter)).toEqual(cleartext)\n      })\n\n      it('Creates with kid and apu and apv', async () => {\n        const kid = 'did:example:receiver#key-1'\n        const apu = encodeBase64url('Alice')\n        const apv = encodeBase64url('Bob')\n        const encrypter = a256cbcHs512AuthEncrypterX25519WithA256KW(\n          recipientKey.publicKey,\n          senderKey.secretKey,\n          {\n            kid,\n            apu,\n            apv,\n          },\n        )\n        expect.assertions(6)\n        const jwe = await createJWE(cleartext, [encrypter])\n        expect(jwe.aad).toBeUndefined()\n        expect(JSON.parse(decodeBase64url(jwe.protected))).toEqual({ enc: 'A256CBC-HS512' })\n        expect(jwe.recipients!![0].header.kid).toEqual(kid)\n        expect(jwe.recipients!![0].header.apu).toEqual(apu)\n        expect(jwe.recipients!![0].header.apv).toEqual(apv)\n        expect(await decryptJWE(jwe, decrypter)).toEqual(cleartext)\n      })\n\n      it('Creates with data in protected header', async () => {\n        const encrypter = a256cbcHs512AuthEncrypterX25519WithA256KW(recipientKey.publicKey, senderKey.secretKey)\n        const skid = 'did:example:sender#key-1'\n        expect.assertions(3)\n        const jwe = await createJWE(cleartext, [encrypter], { skid, more: 'protected' })\n        expect(jwe.aad).toBeUndefined()\n        expect(JSON.parse(decodeBase64url(jwe.protected))).toEqual({\n          enc: 'A256CBC-HS512',\n          skid,\n          more: 'protected',\n        })\n        expect(await decryptJWE(jwe, decrypter)).toEqual(cleartext)\n      })\n\n      it('Creates with aad', async () => {\n        const encrypter = a256cbcHs512AuthEncrypterX25519WithA256KW(recipientKey.publicKey, senderKey.secretKey)\n        expect.assertions(4)\n        const aad = u8a.fromString('this data is authenticated')\n        const jwe = await createJWE(cleartext, [encrypter], { more: 'protected' }, aad)\n        expect(u8a.fromString(jwe.aad!!, 'base64url')).toEqual(aad)\n        expect(JSON.parse(decodeBase64url(jwe.protected))).toEqual({ enc: 'A256CBC-HS512', more: 'protected' })\n        expect(await decryptJWE(jwe, decrypter)).toEqual(cleartext)\n        delete jwe.aad\n        await expect(decryptJWE(jwe, decrypter)).rejects.toThrow('Failed to decrypt')\n      })\n\n      describe('using remote ECDH', () => {\n        const message = 'hello world'\n        const receiverPair = generateX25519KeyPairFromSeed(randomBytes(32))\n        const receiverRemoteECDH = createX25519ECDH(receiverPair.secretKey)\n        const senderPair = generateX25519KeyPairFromSeed(randomBytes(32))\n        const senderRemoteECDH: ECDH = createX25519ECDH(senderPair.secretKey)\n\n        it('creates JWE with remote ECDH', async () => {\n          const encrypter = a256cbcHs512AuthEncrypterX25519WithA256KW(receiverPair.publicKey, senderRemoteECDH)\n          const jwe: JWE = await createJWE(u8a.fromString(message), [encrypter])\n          const decrypter = a256cbcHs512AuthDecrypterX25519WithA256KW(receiverRemoteECDH, senderPair.publicKey)\n          const decryptedBytes = await decryptJWE(jwe, decrypter)\n          const receivedMessage = u8a.toString(decryptedBytes)\n          expect(receivedMessage).toEqual(message)\n        })\n      })\n    })\n\n    describe('Multiple recipients', () => {\n      let cleartext: any, senderkey: any\n      const recipients: any[] = []\n\n      beforeEach(() => {\n        senderkey = generateX25519KeyPairFromSeed(randomBytes(32))\n        cleartext = u8a.fromString('my secret message')\n\n        recipients[0] = {\n          kid: 'did:example:receiver1#key-1',\n          recipientkey: generateX25519KeyPairFromSeed(randomBytes(32)),\n        }\n        recipients[0] = {\n          ...recipients[0],\n          ...{\n            encrypter: a256cbcHs512AuthEncrypterX25519WithA256KW(\n              recipients[0].recipientkey.publicKey,\n              senderkey.secretKey,\n              { kid: recipients[0].kid },\n            ),\n            decrypter: a256cbcHs512AuthDecrypterX25519WithA256KW(\n              recipients[0].recipientkey.secretKey,\n              senderkey.publicKey,\n            ),\n          },\n        }\n\n        recipients[1] = {\n          kid: 'did:example:receiver2#key-1',\n          recipientkey: generateX25519KeyPairFromSeed(randomBytes(32)),\n        }\n        recipients[1] = {\n          ...recipients[1],\n          ...{\n            encrypter: a256cbcHs512AuthEncrypterX25519WithA256KW(\n              recipients[1].recipientkey.publicKey,\n              senderkey.secretKey,\n              { kid: recipients[1].kid },\n            ),\n            decrypter: a256cbcHs512AuthDecrypterX25519WithA256KW(\n              recipients[1].recipientkey.secretKey,\n              senderkey.publicKey,\n            ),\n          },\n        }\n      })\n\n      it('Creates with only ciphertext', async () => {\n        expect.assertions(4)\n        const jwe = await createJWE(cleartext, [recipients[0].encrypter, recipients[1].encrypter])\n        expect(jwe.aad).toBeUndefined()\n        expect(JSON.parse(decodeBase64url(jwe.protected))).toEqual({ enc: 'A256CBC-HS512' })\n        expect(await decryptJWE(jwe, recipients[0].decrypter)).toEqual(cleartext)\n        expect(await decryptJWE(jwe, recipients[1].decrypter)).toEqual(cleartext)\n      })\n\n      it('Creates with data in protected header', async () => {\n        expect.assertions(4)\n        const skid = 'did:example:sender#key-1'\n        const jwe = await createJWE(cleartext, [recipients[0].encrypter, recipients[1].encrypter], {\n          more: 'protected',\n          skid,\n        })\n        expect(jwe.aad).toBeUndefined()\n        expect(JSON.parse(decodeBase64url(jwe.protected))).toEqual({\n          enc: 'A256CBC-HS512',\n          more: 'protected',\n          skid,\n        })\n        expect(await decryptJWE(jwe, recipients[0].decrypter)).toEqual(cleartext)\n        expect(await decryptJWE(jwe, recipients[0].decrypter)).toEqual(cleartext)\n      })\n\n      it('Creates with aad', async () => {\n        expect.assertions(6)\n        const aad = u8a.fromString('this data is authenticated')\n        const jwe = await createJWE(\n          cleartext,\n          [recipients[0].encrypter, recipients[1].encrypter],\n          { more: 'protected' },\n          aad,\n        )\n        expect(u8a.fromString(jwe.aad!!, 'base64url')).toEqual(aad)\n        expect(JSON.parse(decodeBase64url(jwe.protected))).toEqual({ enc: 'A256CBC-HS512', more: 'protected' })\n        expect(await decryptJWE(jwe, recipients[0].decrypter)).toEqual(cleartext)\n        expect(await decryptJWE(jwe, recipients[1].decrypter)).toEqual(cleartext)\n        delete jwe.aad\n        await expect(decryptJWE(jwe, recipients[0].decrypter)).rejects.toThrow('Failed to decrypt')\n        await expect(decryptJWE(jwe, recipients[1].decrypter)).rejects.toThrow('Failed to decrypt')\n      })\n\n      it('Incompatible encrypters throw', async () => {\n        expect.assertions(1)\n        const enc1 = { enc: 'cool enc alg1' } as Encrypter\n        const enc2 = { enc: 'cool enc alg2' } as Encrypter\n        await expect(createJWE(cleartext, [enc1, enc2])).rejects.toThrow('Incompatible encrypters passed')\n      })\n    })\n  })\n\n})\n"
  },
  {
    "path": "packages/did-comm/src/__tests__/message-handler.test.ts",
    "content": "import { DIDComm } from '../didcomm.js'\nimport {\n  IDIDManager,\n  IEventListener,\n  IIdentifier,\n  IKeyManager,\n  IMessageHandler,\n  IResolver,\n  TAgent,\n} from '../../../core-types/src'\nimport {\n  createAgent\n} from '../../../core/src'\nimport { DIDManager, MemoryDIDStore } from '../../../did-manager/src'\nimport { KeyManager, MemoryKeyStore, MemoryPrivateKeyStore } from '../../../key-manager/src'\nimport { KeyManagementSystem } from '../../../kms-local/src'\nimport { DIDResolverPlugin } from '../../../did-resolver/src'\nimport { Resolver } from 'did-resolver'\nimport { DIDCommHttpTransport } from '../transports/transports.js'\nimport { IDIDComm } from '../types/IDIDComm.js'\nimport { MessageHandler } from '../../../message-handler/src'\nimport { FakeDidProvider, FakeDidResolver } from '../../../test-utils/src'\nimport { MessagingRouter, RequestWithAgentRouter } from '../../../remote-server/src'\nimport { Entities, IDataStore, migrations } from '../../../data-store/src'\n// @ts-ignore\nimport express from 'express'\nimport { Server } from 'http'\nimport { DIDCommMessageHandler } from '../message-handler.js'\nimport { DataStore, DataStoreORM } from '../../../data-store/src'\nimport { DataSource } from 'typeorm'\nimport { v4 } from 'uuid'\nimport { jest } from '@jest/globals'\n\nconst DIDCommEventSniffer: IEventListener = {\n  eventTypes: ['DIDCommV2Message-sent', 'DIDCommV2Message-received'],\n  onEvent: jest.fn(() => Promise.resolve()),\n}\n\ndescribe('did-comm-message-handler', () => {\n  let sender: IIdentifier\n  let recipient: IIdentifier\n  let agent: TAgent<IResolver & IKeyManager & IDIDManager & IDIDComm & IMessageHandler & IDataStore>\n  let didCommEndpointServer: Server\n  let listeningPort = Math.round(Math.random() * 32000 + 2048)\n  // eslint-disable-next-line @typescript-eslint/no-explicit-any\n  let dbConnection: any // typeorm types don't seem to follow semantic release patterns leading to type errors\n\n  beforeAll(async () => {\n    dbConnection = new DataSource({\n      name: 'test',\n      type: 'sqlite',\n      database: ':memory:',\n      synchronize: false,\n      migrations: migrations,\n      migrationsRun: true,\n      logging: false,\n      entities: Entities,\n    })\n    agent = createAgent<IResolver & IKeyManager & IDIDManager & IDIDComm & IMessageHandler & IDataStore>({\n      plugins: [\n        new KeyManager({\n          store: new MemoryKeyStore(),\n          kms: {\n            // @ts-ignore\n            local: new KeyManagementSystem(new MemoryPrivateKeyStore()),\n          },\n        }),\n        new DIDManager({\n          providers: {\n            'did:fake': new FakeDidProvider(),\n            // 'did:web': new WebDIDProvider({ defaultKms: 'local' })\n          },\n          store: new MemoryDIDStore(),\n          defaultProvider: 'did:fake',\n        }),\n        new DIDResolverPlugin({\n          resolver: new Resolver({\n            ...new FakeDidResolver(() => agent).getDidFakeResolver(),\n          }),\n        }),\n        new DIDComm({ transports: [new DIDCommHttpTransport()]}),\n        new MessageHandler({\n          messageHandlers: [\n            // @ts-ignore\n            new DIDCommMessageHandler(),\n          ],\n        }),\n        new DataStore(dbConnection),\n        new DataStoreORM(dbConnection),\n        DIDCommEventSniffer,\n      ],\n    })\n\n    sender = await agent.didManagerImport({\n      did: 'did:fake:z6MkgbqNU4uF9NKSz5BqJQ4XKVHuQZYcUZP8pXGsJC8nTHwo',\n      keys: [\n        {\n          type: 'Ed25519',\n          kid: 'didcomm-senderKey-1',\n          publicKeyHex: '1fe9b397c196ab33549041b29cf93be29b9f2bdd27322f05844112fad97ff92a',\n          privateKeyHex:\n            'b57103882f7c66512dc96777cbafbeb2d48eca1e7a867f5a17a84e9a6740f7dc1fe9b397c196ab33549041b29cf93be29b9f2bdd27322f05844112fad97ff92a',\n          kms: 'local',\n        },\n      ],\n      services: [\n        {\n          id: 'msg1',\n          type: 'DIDCommMessaging',\n          serviceEndpoint: `http://localhost:${listeningPort}/messaging`,\n        },\n      ],\n      provider: 'did:fake',\n      alias: 'sender',\n    })\n\n    recipient = await agent.didManagerImport({\n      did: 'did:fake:z6MkrPhffVLBZpxH7xvKNyD4sRVZeZsNTWJkLdHdgWbfgNu3',\n      keys: [\n        {\n          type: 'Ed25519',\n          kid: 'didcomm-receiverKey-1',\n          publicKeyHex: 'b162e405b6485eff8a57932429b192ec4de13c06813e9028a7cdadf0e2703636',\n          privateKeyHex:\n            '19ed9b6949cfd0f9a57e30f0927839a985fa699491886ebcdda6a954d869732ab162e405b6485eff8a57932429b192ec4de13c06813e9028a7cdadf0e2703636',\n          kms: 'local',\n        },\n      ],\n      services: [\n        {\n          id: 'msg2',\n          type: 'DIDCommMessaging',\n          serviceEndpoint: `http://localhost:${listeningPort}/messaging`,\n        },\n      ],\n      provider: 'did:fake',\n      alias: 'receiver',\n    })\n    // console.log(\"sender: \", sender)\n    // console.log(\"recipient: \", recipient)\n\n    const requestWithAgent = RequestWithAgentRouter({ agent })\n\n    await new Promise((resolve) => {\n      //setup a server to receive HTTP messages and forward them to this agent to be processed as DIDComm messages\n      const app = express()\n      // app.use(requestWithAgent)\n      app.use(\n        '/messaging',\n        requestWithAgent,\n        MessagingRouter({\n          metaData: { type: 'DIDComm', value: 'integration test' },\n        }),\n      )\n      didCommEndpointServer = app.listen(listeningPort, () => {\n        resolve(true)\n      })\n    })\n  })\n\n  afterAll(async () => {\n    try {\n      await new Promise((resolve) => didCommEndpointServer?.close(resolve))\n    } catch (e) {\n      //nop\n    }\n    try {\n      await dbConnection?.destroy()\n    } catch (e: any) {\n      // nop\n    }\n  })\n\n  const expectMessageReceived = (id: string, packing: string) => {\n    // recipient sends response\n    // expect(DIDCommEventSniffer.onEvent).toHaveBeenCalledWith(\n    //   {\n    //     data: `${id}`,\n    //     type: 'DIDCommV2Message-sent'\n    //   },\n    //   expect.anything(),\n    // )\n\n    // original sender receives response\n    expect(DIDCommEventSniffer.onEvent).toHaveBeenCalledWith(\n      {\n        data: {\n          message: {\n            body: {\n              hello: 'world',\n            },\n            attachments: [{ data: { hash: 'some-hash', json: { some: 'attachment' } } }],\n            from: sender.did,\n            id: `${id}`,\n            to: [recipient.did],\n            type: 'fake',\n          },\n          metaData: { packing },\n        },\n        type: 'DIDCommV2Message-received',\n      },\n      expect.anything(),\n    )\n  }\n\n  const getRegularMessage = () => {\n    return { id: v4(), type: 'fake', to: [recipient.did], from: sender.did, body: { hello: 'world' } ,\n      attachments: [{ data: { hash: 'some-hash', json: { some: 'attachment' } } }],\n    }\n  }\n\n  it('should pack and unpack message with none packing', async () => {\n    const anyMessage = getRegularMessage()\n    const packedMessage = await agent.packDIDCommMessage({ message: anyMessage, packing: 'none' })\n    const unpackedMessage = await agent.unpackDIDCommMessage(packedMessage)\n    expect(unpackedMessage.message).toEqual({ ...anyMessage, typ: 'application/didcomm-plain+json' })\n  })\n\n  it('should pack and unpack message with authcrypt packing', async () => {\n    const anyMessage = getRegularMessage()\n    const packedMessage = await agent.packDIDCommMessage({ message: anyMessage, packing: 'authcrypt' })\n    const unpackedMessage = await agent.unpackDIDCommMessage(packedMessage)\n    expect(unpackedMessage.message).toEqual(anyMessage)\n  })\n\n  it('should handle packed (with authcrypt) message directly', async () => {\n    const anyMessage = getRegularMessage()\n    const packedMessage = await agent.packDIDCommMessage({ message: anyMessage, packing: 'authcrypt' })\n    const id = anyMessage.id\n    await agent.handleMessage({ raw: packedMessage.message })\n    expectMessageReceived(id, 'authcrypt')\n  })\n})\n"
  },
  {
    "path": "packages/did-comm/src/__tests__/messagepickup-message-handler.test.ts",
    "content": "import { DIDComm } from '../didcomm.js'\nimport {\n  createAgent,\n  IDIDManager,\n  IEventListener,\n  IIdentifier,\n  IKeyManager,\n  IMessageHandler,\n  IResolver,\n  TAgent,\n} from '../../../core/src'\nimport { DIDManager, MemoryDIDStore } from '../../../did-manager/src'\nimport { KeyManager, MemoryKeyStore, MemoryPrivateKeyStore } from '../../../key-manager/src'\nimport { KeyManagementSystem } from '../../../kms-local/src'\nimport { DIDResolverPlugin } from '../../../did-resolver/src'\nimport { Resolver } from 'did-resolver'\nimport { DIDCommHttpTransport } from '../transports/transports.js'\nimport { IDIDComm } from '../types/IDIDComm.js'\nimport { MessageHandler } from '../../../message-handler/src'\nimport { IDIDCommMessage, DIDCommMessageMediaType, IPackedDIDCommMessage } from '../types/message-types.js'\nimport { QUEUE_MESSAGE_TYPE } from '../protocols/routing-message-handler.js'\nimport {\n  PickupMediatorMessageHandler,\n  PickupRecipientMessageHandler,\n  STATUS_REQUEST_MESSAGE_TYPE,\n  STATUS_MESSAGE_TYPE,\n  DELIVERY_MESSAGE_TYPE,\n  DELIVERY_REQUEST_MESSAGE_TYPE,\n  MESSAGES_RECEIVED_MESSAGE_TYPE,\n} from '../protocols/messagepickup-message-handler.js'\nimport { FakeDidProvider, FakeDidResolver } from '../../../test-utils/src'\nimport { MessagingRouter, RequestWithAgentRouter } from '../../../remote-server/src'\nimport { Entities, IDataStore, migrations } from '../../../data-store/src'\n// @ts-ignore\nimport express from 'express'\nimport { Server } from 'http'\nimport { DIDCommMessageHandler } from '../message-handler.js'\nimport { DataStore, DataStoreORM } from '../../../data-store/src'\nimport { DataSource } from 'typeorm'\nimport { v4 } from 'uuid'\nimport { Message } from '@veramo/message-handler'\n\nimport { jest } from '@jest/globals'\nimport 'cross-fetch/polyfill'\n\nconst DIDCommEventSniffer: IEventListener = {\n  eventTypes: [\n    'DIDCommV2Message-sent',\n    'DIDCommV2Message-received',\n    'DIDCommV2Message-forwardMessageQueued',\n    'DIDCommV2Message-forwardMessageDequeued',\n  ],\n  onEvent: jest.fn(() => Promise.resolve()),\n}\n\ndescribe('messagepickup-message-handler', () => {\n  describe('PickupMediatorMessageHandler', () => {\n    let recipient: IIdentifier\n    let recipient2: IIdentifier\n    let mediator: IIdentifier\n    let agent: TAgent<IResolver & IKeyManager & IDIDManager & IDIDComm & IMessageHandler & IDataStore>\n    let didCommEndpointServer: Server\n    let listeningPort = Math.round(Math.random() * 32000 + 2048)\n    // eslint-disable-next-line @typescript-eslint/no-explicit-any\n    let dbConnection: any // typeorm types don't seem to follow semantic release patterns leading to type errors\n\n    let messageToQueue: Message\n    let messageToQueue1: Message\n    let innerMessage: IPackedDIDCommMessage\n\n    beforeAll(async () => {\n      dbConnection = new DataSource({\n        name: 'test',\n        type: 'sqlite',\n        database: ':memory:',\n        synchronize: false,\n        migrations: migrations,\n        migrationsRun: true,\n        logging: false,\n        entities: Entities,\n      })\n      agent = createAgent({\n        plugins: [\n          new KeyManager({\n            store: new MemoryKeyStore(),\n            kms: {\n              // @ts-ignore\n              local: new KeyManagementSystem(new MemoryPrivateKeyStore()),\n            },\n          }),\n          new DIDManager({\n            providers: {\n              'did:fake': new FakeDidProvider(),\n              // 'did:web': new WebDIDProvider({ defaultKms: 'local' })\n            },\n            store: new MemoryDIDStore(),\n            defaultProvider: 'did:fake',\n          }),\n          new DIDResolverPlugin({\n            resolver: new Resolver({\n              ...new FakeDidResolver(() => agent).getDidFakeResolver(),\n            }),\n          }),\n          new DIDComm({ transports: [new DIDCommHttpTransport()] }),\n          new MessageHandler({\n            messageHandlers: [\n              // @ts-ignore\n              new DIDCommMessageHandler(),\n              new PickupMediatorMessageHandler(),\n            ],\n          }),\n          new DataStore(dbConnection),\n          new DataStoreORM(dbConnection),\n          DIDCommEventSniffer,\n        ],\n      })\n\n      recipient = await agent.didManagerImport({\n        did: 'did:fake:z6MkgbqNU4uF9NKSz5BqJQ4XKVHuQZYcUZP8pXGsJC8nTHwo',\n        keys: [\n          {\n            type: 'Ed25519',\n            kid: 'didcomm-senderKey-1',\n            publicKeyHex: '1fe9b397c196ab33549041b29cf93be29b9f2bdd27322f05844112fad97ff92a',\n            privateKeyHex:\n              'b57103882f7c66512dc96777cbafbeb2d48eca1e7a867f5a17a84e9a6740f7dc1fe9b397c196ab33549041b29cf93be29b9f2bdd27322f05844112fad97ff92a',\n            kms: 'local',\n          },\n        ],\n        services: [\n          {\n            id: 'msg1',\n            type: 'DIDCommMessaging',\n            serviceEndpoint: `http://localhost:${listeningPort}/messaging`,\n          },\n        ],\n        provider: 'did:fake',\n        alias: 'sender',\n      })\n\n      recipient2 = await agent.didManagerImport({\n        did: 'did:fake:recipient2',\n        keys: [\n          {\n            type: 'Ed25519',\n            kid: 'didcomm-senderKey-1',\n            publicKeyHex: '1fe9b397c196ab33549041b29cf93be29b9f2bdd27322f05844112fad97ff92a',\n            privateKeyHex:\n              'b57103882f7c66512dc96777cbafbeb2d48eca1e7a867f5a17a84e9a6740f7dc1fe9b397c196ab33549041b29cf93be29b9f2bdd27322f05844112fad97ff92a',\n            kms: 'local',\n          },\n        ],\n        services: [\n          {\n            id: 'msg1',\n            type: 'DIDCommMessaging',\n            serviceEndpoint: `http://localhost:${listeningPort}/messaging`,\n          },\n        ],\n        provider: 'did:fake',\n        alias: 'recipient2',\n      })\n\n      mediator = await agent.didManagerImport({\n        did: 'did:fake:z6MkrPhffVLBZpxH7xvKNyD4sRVZeZsNTWJkLdHdgWbfgNu3',\n        keys: [\n          {\n            type: 'Ed25519',\n            kid: 'didcomm-receiverKey-1',\n            publicKeyHex: 'b162e405b6485eff8a57932429b192ec4de13c06813e9028a7cdadf0e2703636',\n            privateKeyHex:\n              '19ed9b6949cfd0f9a57e30f0927839a985fa699491886ebcdda6a954d869732ab162e405b6485eff8a57932429b192ec4de13c06813e9028a7cdadf0e2703636',\n            kms: 'local',\n          },\n        ],\n        services: [\n          {\n            id: 'msg2',\n            type: 'DIDCommMessaging',\n            serviceEndpoint: `http://localhost:${listeningPort}/messaging`,\n          },\n        ],\n        provider: 'did:fake',\n        alias: 'receiver',\n      })\n      // console.log('sender: ', sender)\n      // console.log('recipient: ', recipient)\n\n      // Save messages in queue\n      innerMessage = await agent.packDIDCommMessage({\n        packing: 'authcrypt',\n        message: {\n          type: 'test',\n          to: [recipient.did],\n          from: mediator.did,\n          id: 'test',\n          body: { hello: 'world' },\n        },\n      })\n\n      messageToQueue = new Message({ raw: innerMessage.message })\n      messageToQueue.id = 'test1'\n      messageToQueue.type = QUEUE_MESSAGE_TYPE\n      messageToQueue.to = `${recipient.did}#${recipient.keys[0].kid}`\n      messageToQueue.createdAt = new Date().toISOString()\n      await agent.dataStoreSaveMessage({ message: messageToQueue })\n\n      messageToQueue1 = new Message({ raw: innerMessage.message })\n      messageToQueue1.id = 'test2'\n      messageToQueue1.type = QUEUE_MESSAGE_TYPE\n      messageToQueue1.to = `${recipient.did}#some-other-key`\n      messageToQueue1.createdAt = new Date().toISOString()\n      await agent.dataStoreSaveMessage({ message: messageToQueue1 })\n\n      const requestWithAgent = RequestWithAgentRouter({ agent })\n\n      await new Promise((resolve) => {\n        //setup a server to receive HTTP messages and forward them to this agent to be processed as DIDComm messages\n        const app = express()\n        // app.use(requestWithAgent)\n        app.use(\n          '/messaging',\n          requestWithAgent,\n          MessagingRouter({\n            metaData: { type: 'DIDComm', value: 'integration test' },\n          }),\n        )\n        didCommEndpointServer = app.listen(listeningPort, () => {\n          resolve(true)\n        })\n      })\n    })\n\n    afterAll(async () => {\n      try {\n        await new Promise((resolve) => didCommEndpointServer?.close(resolve))\n      } catch (e: any) {\n        // nop\n      }\n      try {\n        await dbConnection?.destroy()\n      } catch (e: any) {\n        // nop\n      }\n    })\n\n    it('should respond to StatusRequest with no recipient_key', async () => {\n      expect.assertions(1)\n\n      // Send StatusRequest\n      const statusRequestMessage: IDIDCommMessage = {\n        id: v4(),\n        type: STATUS_REQUEST_MESSAGE_TYPE,\n        to: [mediator.did],\n        from: recipient.did,\n        return_route: 'all',\n        body: {},\n      }\n      const packedMessage = await agent.packDIDCommMessage({\n        packing: 'authcrypt',\n        message: statusRequestMessage,\n      })\n      await agent.sendDIDCommMessage({\n        messageId: statusRequestMessage.id,\n        packedMessage,\n        recipientDidUrl: mediator.did,\n      })\n\n      expect(DIDCommEventSniffer.onEvent).toHaveBeenCalledWith(\n        {\n          data: {\n            message: {\n              body: { message_count: 2, live_delivery: false },\n              id: expect.anything(),\n              created_time: expect.anything(),\n              thid: statusRequestMessage.id,\n              to: [recipient.did],\n              from: mediator.did,\n              type: STATUS_MESSAGE_TYPE,\n            },\n            metaData: { packing: 'authcrypt' },\n          },\n          type: 'DIDCommV2Message-received',\n        },\n        expect.anything(),\n      )\n    })\n\n    it('should respond to StatusRequest with recipient_key', async () => {\n      expect.assertions(1)\n\n      // Send StatusRequest\n      const statusRequestMessage: IDIDCommMessage = {\n        id: v4(),\n        type: STATUS_REQUEST_MESSAGE_TYPE,\n        to: [mediator.did],\n        from: recipient.did,\n        return_route: 'all',\n        body: {\n          recipient_key: `${recipient.did}#${recipient.keys[0].kid}`,\n        },\n      }\n      const packedMessage = await agent.packDIDCommMessage({\n        packing: 'authcrypt',\n        message: statusRequestMessage,\n      })\n      await agent.sendDIDCommMessage({\n        messageId: statusRequestMessage.id,\n        packedMessage,\n        recipientDidUrl: mediator.did,\n      })\n\n      expect(DIDCommEventSniffer.onEvent).toHaveBeenCalledWith(\n        {\n          data: {\n            message: {\n              body: {\n                message_count: 1,\n                live_delivery: false,\n                recipient_key: `${recipient.did}#${recipient.keys[0].kid}`,\n              },\n              id: expect.anything(),\n              created_time: expect.anything(),\n              thid: statusRequestMessage.id,\n              to: [recipient.did],\n              from: mediator.did,\n              type: STATUS_MESSAGE_TYPE,\n            },\n            metaData: { packing: 'authcrypt' },\n          },\n          type: 'DIDCommV2Message-received',\n        },\n        expect.anything(),\n      )\n    })\n\n    it('should contain returnMessage', async () => {\n      // Send StatusRequest\n      const statusRequestMessage: IDIDCommMessage = {\n        id: v4(),\n        type: STATUS_REQUEST_MESSAGE_TYPE,\n        to: [mediator.did],\n        from: recipient.did,\n        return_route: 'all',\n        body: {\n          recipient_key: `${recipient.did}#${recipient.keys[0].kid}`,\n        },\n      }\n      const packedMessage = await agent.packDIDCommMessage({\n        packing: 'authcrypt',\n        message: statusRequestMessage,\n      })\n      const result = await agent.sendDIDCommMessage({\n        messageId: statusRequestMessage.id,\n        packedMessage,\n        recipientDidUrl: mediator.did,\n      })\n\n      expect(result.transportId).toBeDefined()\n      expect(result.returnMessage).toBeDefined()\n    })\n\n    it('should not respond to StatusRequest with no return_route', async () => {\n      expect.assertions(1)\n      const statusRequestMessage: IDIDCommMessage = {\n        id: v4(),\n        type: STATUS_REQUEST_MESSAGE_TYPE,\n        to: [mediator.did],\n        from: recipient.did,\n        body: {},\n      }\n      const packedMessage = await agent.packDIDCommMessage({\n        packing: 'authcrypt',\n        message: statusRequestMessage,\n      })\n      await agent.sendDIDCommMessage({\n        messageId: statusRequestMessage.id,\n        packedMessage,\n        recipientDidUrl: mediator.did,\n      })\n\n      expect(DIDCommEventSniffer.onEvent).not.toHaveBeenCalledWith(\n        {\n          data: {\n            message: {\n              body: expect.anything(),\n              id: expect.anything(),\n              created_time: expect.anything(),\n              thid: statusRequestMessage.id,\n              to: [recipient.did],\n              from: mediator.did,\n              type: STATUS_MESSAGE_TYPE,\n            },\n            metaData: { packing: 'authcrypt' },\n          },\n          type: 'DIDCommV2Message-received',\n        },\n        expect.anything(),\n      )\n    })\n\n    it('should respond to DeliveryRequest with no recipient_key', async () => {\n      expect.assertions(1)\n\n      // Send DeliveryRequest\n      const deliveryRequestMessage: IDIDCommMessage = {\n        id: v4(),\n        type: DELIVERY_REQUEST_MESSAGE_TYPE,\n        to: [mediator.did],\n        from: recipient.did,\n        return_route: 'all',\n        body: { limit: 2 },\n      }\n      const packedMessage = await agent.packDIDCommMessage({\n        packing: 'authcrypt',\n        message: deliveryRequestMessage,\n      })\n      await agent.sendDIDCommMessage({\n        messageId: deliveryRequestMessage.id,\n        packedMessage,\n        recipientDidUrl: mediator.did,\n      })\n\n      expect(DIDCommEventSniffer.onEvent).toHaveBeenCalledWith(\n        {\n          data: {\n            message: {\n              body: {},\n              id: expect.anything(),\n              created_time: expect.anything(),\n              thid: deliveryRequestMessage.id,\n              to: [recipient.did],\n              from: mediator.did,\n              type: DELIVERY_MESSAGE_TYPE,\n              attachments: [\n                {\n                  id: messageToQueue.id,\n                  media_type: DIDCommMessageMediaType.ENCRYPTED,\n                  data: {\n                    json: JSON.parse(innerMessage.message),\n                  },\n                },\n                {\n                  id: messageToQueue1.id,\n                  media_type: DIDCommMessageMediaType.ENCRYPTED,\n                  data: {\n                    json: JSON.parse(innerMessage.message),\n                  },\n                },\n              ],\n            },\n            metaData: { packing: 'authcrypt' },\n          },\n          type: 'DIDCommV2Message-received',\n        },\n        expect.anything(),\n      )\n    })\n\n    it('should respond to DeliveryRequest with recipient_key', async () => {\n      expect.assertions(1)\n\n      // Send DeliveryRequest\n      const deliveryRequestMessage: IDIDCommMessage = {\n        id: v4(),\n        type: DELIVERY_REQUEST_MESSAGE_TYPE,\n        to: [mediator.did],\n        from: recipient.did,\n        return_route: 'all',\n        body: { limit: 2, recipient_key: `${recipient.did}#${recipient.keys[0].kid}` },\n      }\n      const packedMessage = await agent.packDIDCommMessage({\n        packing: 'authcrypt',\n        message: deliveryRequestMessage,\n      })\n      await agent.sendDIDCommMessage({\n        messageId: deliveryRequestMessage.id,\n        packedMessage,\n        recipientDidUrl: mediator.did,\n      })\n\n      expect(DIDCommEventSniffer.onEvent).toHaveBeenCalledWith(\n        {\n          data: {\n            message: {\n              body: { recipient_key: `${recipient.did}#${recipient.keys[0].kid}` },\n              id: expect.anything(),\n              created_time: expect.anything(),\n              thid: deliveryRequestMessage.id,\n              to: [recipient.did],\n              from: mediator.did,\n              type: DELIVERY_MESSAGE_TYPE,\n              attachments: [\n                {\n                  id: messageToQueue.id,\n                  media_type: DIDCommMessageMediaType.ENCRYPTED,\n                  data: {\n                    json: JSON.parse(innerMessage.message),\n                  },\n                },\n              ],\n            },\n            metaData: { packing: 'authcrypt' },\n          },\n          type: 'DIDCommV2Message-received',\n        },\n        expect.anything(),\n      )\n    })\n\n    it('should not respond to DeliveryRequest with no return_route', async () => {\n      expect.assertions(1)\n      const deliveryRequestMessage: IDIDCommMessage = {\n        id: v4(),\n        type: DELIVERY_REQUEST_MESSAGE_TYPE,\n        to: [mediator.did],\n        from: recipient.did,\n        body: { limit: 2 },\n      }\n      const packedMessage = await agent.packDIDCommMessage({\n        packing: 'authcrypt',\n        message: deliveryRequestMessage,\n      })\n      await agent.sendDIDCommMessage({\n        messageId: deliveryRequestMessage.id,\n        packedMessage,\n        recipientDidUrl: mediator.did,\n      })\n\n      expect(DIDCommEventSniffer.onEvent).not.toHaveBeenCalledWith(\n        {\n          data: {\n            message: {\n              attachments: expect.anything(),\n              body: expect.anything(),\n              id: expect.anything(),\n              created_time: expect.anything(),\n              thid: deliveryRequestMessage.id,\n              to: [recipient.did],\n              from: mediator.did,\n              type: DELIVERY_MESSAGE_TYPE,\n            },\n            metaData: { packing: 'authcrypt' },\n          },\n          type: 'DIDCommV2Message-received',\n        },\n        expect.anything(),\n      )\n    })\n\n    it('should not respond to DeliveryRequest with no limit', async () => {\n      expect.assertions(1)\n      const deliveryRequestMessage: IDIDCommMessage = {\n        id: v4(),\n        type: DELIVERY_REQUEST_MESSAGE_TYPE,\n        to: [mediator.did],\n        from: recipient.did,\n        return_route: 'all',\n        body: {},\n      }\n      const packedMessage = await agent.packDIDCommMessage({\n        packing: 'authcrypt',\n        message: deliveryRequestMessage,\n      })\n      await agent.sendDIDCommMessage({\n        messageId: deliveryRequestMessage.id,\n        packedMessage,\n        recipientDidUrl: mediator.did,\n      })\n\n      expect(DIDCommEventSniffer.onEvent).not.toHaveBeenCalledWith(\n        {\n          data: {\n            message: {\n              attachments: expect.anything(),\n              body: expect.anything(),\n              id: expect.anything(),\n              created_time: expect.anything(),\n              thid: deliveryRequestMessage.id,\n              to: [recipient.did],\n              from: mediator.did,\n              type: DELIVERY_MESSAGE_TYPE,\n            },\n            metaData: { packing: 'authcrypt' },\n          },\n          type: 'DIDCommV2Message-received',\n        },\n        expect.anything(),\n      )\n    })\n\n    it('should not respond to DeliveryRequest with bad limit', async () => {\n      expect.assertions(1)\n      const deliveryRequestMessage: IDIDCommMessage = {\n        id: v4(),\n        type: DELIVERY_REQUEST_MESSAGE_TYPE,\n        to: [mediator.did],\n        from: recipient.did,\n        return_route: 'all',\n        body: { limit: 'not a number' },\n      }\n      const packedMessage = await agent.packDIDCommMessage({\n        packing: 'authcrypt',\n        message: deliveryRequestMessage,\n      })\n      await agent.sendDIDCommMessage({\n        messageId: deliveryRequestMessage.id,\n        packedMessage,\n        recipientDidUrl: mediator.did,\n      })\n\n      expect(DIDCommEventSniffer.onEvent).not.toHaveBeenCalledWith(\n        {\n          data: {\n            message: {\n              attachments: expect.anything(),\n              body: expect.anything(),\n              id: expect.anything(),\n              created_time: expect.anything(),\n              thid: deliveryRequestMessage.id,\n              to: [recipient.did],\n              from: mediator.did,\n              type: DELIVERY_MESSAGE_TYPE,\n            },\n            metaData: { packing: 'authcrypt' },\n          },\n          type: 'DIDCommV2Message-received',\n        },\n        expect.anything(),\n      )\n    })\n\n    it('should clear message on MessagesReceived', async () => {\n      expect.assertions(2)\n\n      // Save message\n      const messageToQueue2 = new Message({ raw: innerMessage.message })\n      messageToQueue2.id = 'test3'\n      messageToQueue2.type = QUEUE_MESSAGE_TYPE\n      messageToQueue2.to = `${recipient.did}#${recipient.keys[0].kid}`\n      messageToQueue2.createdAt = new Date().toISOString()\n      await agent.dataStoreSaveMessage({ message: messageToQueue2 })\n\n      // Send MessagesRequest\n      const messagesRequestMessage: IDIDCommMessage = {\n        id: v4(),\n        type: MESSAGES_RECEIVED_MESSAGE_TYPE,\n        to: [mediator.did],\n        from: recipient.did,\n        return_route: 'all',\n        body: { message_id_list: [messageToQueue2.id] },\n      }\n      const packedMessage = await agent.packDIDCommMessage({\n        packing: 'authcrypt',\n        message: messagesRequestMessage,\n      })\n      await agent.sendDIDCommMessage({\n        messageId: messagesRequestMessage.id,\n        packedMessage,\n        recipientDidUrl: mediator.did,\n      })\n\n      expect(DIDCommEventSniffer.onEvent).toHaveBeenCalledWith(\n        {\n          data: messageToQueue2.id,\n          type: 'DIDCommV2Message-forwardMessageDequeued',\n        },\n        expect.anything(),\n      )\n      expect(DIDCommEventSniffer.onEvent).toHaveBeenCalledWith(\n        {\n          data: {\n            message: {\n              body: { message_count: 2, live_delivery: false },\n              id: expect.anything(),\n              created_time: expect.anything(),\n              thid: messagesRequestMessage.id,\n              to: [recipient.did],\n              from: mediator.did,\n              type: STATUS_MESSAGE_TYPE,\n            },\n            metaData: { packing: 'authcrypt' },\n          },\n          type: 'DIDCommV2Message-received',\n        },\n        expect.anything(),\n      )\n    })\n\n    it('should clear multiple messages on MessagesReceived', async () => {\n      expect.assertions(3)\n\n      // Save messages\n      const messageToQueue2 = new Message({ raw: innerMessage.message })\n      messageToQueue2.id = v4()\n      messageToQueue2.type = QUEUE_MESSAGE_TYPE\n      messageToQueue2.to = `${recipient.did}#${recipient.keys[0].kid}`\n      messageToQueue2.createdAt = new Date().toISOString()\n      await agent.dataStoreSaveMessage({ message: messageToQueue2 })\n\n      const messageToQueue3 = new Message({ raw: innerMessage.message })\n      messageToQueue3.id = v4()\n      messageToQueue3.type = QUEUE_MESSAGE_TYPE\n      messageToQueue3.to = `${recipient.did}#${recipient.keys[0].kid}`\n      messageToQueue3.createdAt = new Date().toISOString()\n      await agent.dataStoreSaveMessage({ message: messageToQueue3 })\n\n      // Send MessagesRequest\n      const messagesRequestMessage: IDIDCommMessage = {\n        id: v4(),\n        type: MESSAGES_RECEIVED_MESSAGE_TYPE,\n        to: [mediator.did],\n        from: recipient.did,\n        return_route: 'all',\n        body: { message_id_list: [messageToQueue2.id, messageToQueue3.id] },\n      }\n      const packedMessage = await agent.packDIDCommMessage({\n        packing: 'authcrypt',\n        message: messagesRequestMessage,\n      })\n      await agent.sendDIDCommMessage({\n        messageId: messagesRequestMessage.id,\n        packedMessage,\n        recipientDidUrl: mediator.did,\n      })\n\n      expect(DIDCommEventSniffer.onEvent).toHaveBeenCalledWith(\n        {\n          data: messageToQueue2.id,\n          type: 'DIDCommV2Message-forwardMessageDequeued',\n        },\n        expect.anything(),\n      )\n      expect(DIDCommEventSniffer.onEvent).toHaveBeenCalledWith(\n        {\n          data: messageToQueue3.id,\n          type: 'DIDCommV2Message-forwardMessageDequeued',\n        },\n        expect.anything(),\n      )\n      expect(DIDCommEventSniffer.onEvent).toHaveBeenCalledWith(\n        {\n          data: {\n            message: {\n              body: { message_count: 2, live_delivery: false },\n              id: expect.anything(),\n              created_time: expect.anything(),\n              thid: messagesRequestMessage.id,\n              to: [recipient.did],\n              from: mediator.did,\n              type: STATUS_MESSAGE_TYPE,\n            },\n            metaData: { packing: 'authcrypt' },\n          },\n          type: 'DIDCommV2Message-received',\n        },\n        expect.anything(),\n      )\n    })\n\n    it('should not clear messages on MessagesReceived for another recipient', async () => {\n      // Save message\n      const messageToQueue2 = new Message({ raw: innerMessage.message })\n      messageToQueue2.id = v4()\n      messageToQueue2.type = QUEUE_MESSAGE_TYPE\n      messageToQueue2.to = `${recipient.did}#${recipient.keys[0].kid}`\n      messageToQueue2.createdAt = new Date().toISOString()\n      await agent.dataStoreSaveMessage({ message: messageToQueue2 })\n\n      // Send MessagesRequest\n      const messagesRequestMessage: IDIDCommMessage = {\n        id: v4(),\n        type: MESSAGES_RECEIVED_MESSAGE_TYPE,\n        to: [mediator.did],\n        from: recipient2.did,\n        return_route: 'all',\n        body: { message_id_list: [messageToQueue2.id] },\n      }\n      const packedMessage = await agent.packDIDCommMessage({\n        packing: 'authcrypt',\n        message: messagesRequestMessage,\n      })\n      await agent.sendDIDCommMessage({\n        messageId: messagesRequestMessage.id,\n        packedMessage,\n        recipientDidUrl: mediator.did,\n      })\n\n      expect(DIDCommEventSniffer.onEvent).not.toHaveBeenCalledWith(\n        {\n          data: messageToQueue2.id,\n          type: 'DIDCommV2Message-forwardMessageDequeued',\n        },\n        expect.anything(),\n      )\n      expect(await agent.dataStoreGetMessage({ id: messageToQueue2.id })).toBeDefined()\n\n      // Clean up\n      await agent.dataStoreDeleteMessage({ id: messageToQueue2.id })\n    })\n  })\n\n  describe('PickupRecipientMessageHandler', () => {\n    let recipient: IIdentifier\n    let recipient2: IIdentifier\n    let mediator: IIdentifier\n    let agent: TAgent<IResolver & IKeyManager & IDIDManager & IDIDComm & IMessageHandler & IDataStore>\n    let didCommEndpointServer: Server\n    let listeningPort = Math.round(Math.random() * 32000 + 2048)\n    // eslint-disable-next-line @typescript-eslint/no-explicit-any\n    let dbConnection: any // typeorm types don't seem to follow semantic release patterns leading to type errors\n\n    let messageToQueue: Message\n    let messageToQueue1: Message\n    let innerMessage: IPackedDIDCommMessage\n\n    beforeAll(async () => {\n      dbConnection = new DataSource({\n        name: 'test',\n        type: 'sqlite',\n        database: ':memory:',\n        synchronize: false,\n        migrations: migrations,\n        migrationsRun: true,\n        logging: false,\n        entities: Entities,\n      })\n      agent = createAgent({\n        plugins: [\n          new KeyManager({\n            store: new MemoryKeyStore(),\n            kms: {\n              // @ts-ignore\n              local: new KeyManagementSystem(new MemoryPrivateKeyStore()),\n            },\n          }),\n          new DIDManager({\n            providers: {\n              'did:fake': new FakeDidProvider(),\n              // 'did:web': new WebDIDProvider({ defaultKms: 'local' })\n            },\n            store: new MemoryDIDStore(),\n            defaultProvider: 'did:fake',\n          }),\n          new DIDResolverPlugin({\n            resolver: new Resolver({\n              ...new FakeDidResolver(() => agent).getDidFakeResolver(),\n            }),\n          }),\n          new DIDComm({ transports: [new DIDCommHttpTransport()] }),\n          new MessageHandler({\n            messageHandlers: [\n              // @ts-ignore\n              new DIDCommMessageHandler(),\n              new PickupRecipientMessageHandler(),\n            ],\n          }),\n          new DataStore(dbConnection),\n          new DataStoreORM(dbConnection),\n          DIDCommEventSniffer,\n        ],\n      })\n\n      recipient = await agent.didManagerImport({\n        did: 'did:fake:z6MkgbqNU4uF9NKSz5BqJQ4XKVHuQZYcUZP8pXGsJC8nTHwo',\n        keys: [\n          {\n            type: 'Ed25519',\n            kid: 'didcomm-senderKey-1',\n            publicKeyHex: '1fe9b397c196ab33549041b29cf93be29b9f2bdd27322f05844112fad97ff92a',\n            privateKeyHex:\n              'b57103882f7c66512dc96777cbafbeb2d48eca1e7a867f5a17a84e9a6740f7dc1fe9b397c196ab33549041b29cf93be29b9f2bdd27322f05844112fad97ff92a',\n            kms: 'local',\n          },\n        ],\n        services: [\n          {\n            id: 'msg1',\n            type: 'DIDCommMessaging',\n            serviceEndpoint: `http://localhost:${listeningPort}/messaging`,\n          },\n        ],\n        provider: 'did:fake',\n        alias: 'sender',\n      })\n\n      recipient2 = await agent.didManagerImport({\n        did: 'did:fake:recipient2',\n        keys: [\n          {\n            type: 'Ed25519',\n            kid: 'didcomm-senderKey-1',\n            publicKeyHex: '1fe9b397c196ab33549041b29cf93be29b9f2bdd27322f05844112fad97ff92a',\n            privateKeyHex:\n              'b57103882f7c66512dc96777cbafbeb2d48eca1e7a867f5a17a84e9a6740f7dc1fe9b397c196ab33549041b29cf93be29b9f2bdd27322f05844112fad97ff92a',\n            kms: 'local',\n          },\n        ],\n        services: [\n          {\n            id: 'msg1',\n            type: 'DIDCommMessaging',\n            serviceEndpoint: `http://localhost:${listeningPort}/messaging`,\n          },\n        ],\n        provider: 'did:fake',\n        alias: 'recipient2',\n      })\n\n      mediator = await agent.didManagerImport({\n        did: 'did:fake:z6MkrPhffVLBZpxH7xvKNyD4sRVZeZsNTWJkLdHdgWbfgNu3',\n        keys: [\n          {\n            type: 'Ed25519',\n            kid: 'didcomm-receiverKey-1',\n            publicKeyHex: 'b162e405b6485eff8a57932429b192ec4de13c06813e9028a7cdadf0e2703636',\n            privateKeyHex:\n              '19ed9b6949cfd0f9a57e30f0927839a985fa699491886ebcdda6a954d869732ab162e405b6485eff8a57932429b192ec4de13c06813e9028a7cdadf0e2703636',\n            kms: 'local',\n          },\n        ],\n        services: [\n          {\n            id: 'msg2',\n            type: 'DIDCommMessaging',\n            serviceEndpoint: `http://localhost:${listeningPort}/messaging`,\n          },\n        ],\n        provider: 'did:fake',\n        alias: 'receiver',\n      })\n      // console.log('sender: ', sender)\n      // console.log('recipient: ', recipient)\n\n      // Save messages in queue\n      innerMessage = await agent.packDIDCommMessage({\n        packing: 'authcrypt',\n        message: {\n          type: 'test',\n          to: [recipient.did],\n          from: mediator.did,\n          id: 'test',\n          body: { hello: 'world' },\n        },\n      })\n\n      messageToQueue = new Message({ raw: innerMessage.message })\n      messageToQueue.id = 'test1'\n      messageToQueue.type = QUEUE_MESSAGE_TYPE\n      messageToQueue.to = `${recipient.did}#${recipient.keys[0].kid}`\n      messageToQueue.createdAt = new Date().toISOString()\n      await agent.dataStoreSaveMessage({ message: messageToQueue })\n\n      messageToQueue1 = new Message({ raw: innerMessage.message })\n      messageToQueue1.id = 'test2'\n      messageToQueue1.type = QUEUE_MESSAGE_TYPE\n      messageToQueue1.to = `${recipient.did}#some-other-key`\n      messageToQueue1.createdAt = new Date().toISOString()\n      await agent.dataStoreSaveMessage({ message: messageToQueue1 })\n\n      const requestWithAgent = RequestWithAgentRouter({ agent })\n\n      await new Promise((resolve) => {\n        //setup a server to receive HTTP messages and forward them to this agent to be processed as DIDComm messages\n        const app = express()\n        // app.use(requestWithAgent)\n        app.use(\n          '/messaging',\n          requestWithAgent,\n          MessagingRouter({\n            metaData: { type: 'DIDComm', value: 'integration test' },\n          }),\n        )\n        didCommEndpointServer = app.listen(listeningPort, () => {\n          resolve(true)\n        })\n      })\n    })\n\n    afterAll(async () => {\n      try {\n        await new Promise((resolve) => didCommEndpointServer?.close(resolve))\n      } catch (e: any) {\n        // nop\n      }\n      try {\n        await dbConnection?.destroy()\n      } catch (e: any) {\n        // nop\n      }\n    })\n\n    it('should handle messages from MessageDelivery batch', async () => {\n      expect.assertions(3)\n\n      // Send MessageDelivery\n      const msgId = v4()\n      const messageDeliveryMessage: IDIDCommMessage = {\n        body: {},\n        id: v4(),\n        created_time: new Date().toISOString(),\n        to: [recipient.did],\n        from: mediator.did,\n        type: DELIVERY_MESSAGE_TYPE,\n        attachments: [\n          {\n            id: msgId,\n            data: {\n              json: JSON.parse(innerMessage.message),\n            },\n          },\n        ],\n      }\n      const packedMessage = await agent.packDIDCommMessage({\n        packing: 'authcrypt',\n        message: messageDeliveryMessage,\n      })\n      await agent.sendDIDCommMessage({\n        messageId: messageDeliveryMessage.id,\n        packedMessage,\n        recipientDidUrl: recipient.did,\n      })\n\n      expect(DIDCommEventSniffer.onEvent).toHaveBeenCalledWith(\n        {\n          data: {\n            message: messageDeliveryMessage,\n            metaData: { packing: 'authcrypt' },\n          },\n          type: 'DIDCommV2Message-received',\n        },\n        expect.anything(),\n      )\n\n      expect(DIDCommEventSniffer.onEvent).toHaveBeenCalledWith(\n        {\n          data: {\n            message: {\n              type: 'test',\n              to: [recipient.did],\n              from: mediator.did,\n              id: 'test',\n              body: { hello: 'world' },\n            },\n            metaData: { packing: 'authcrypt' },\n          },\n          type: 'DIDCommV2Message-received',\n        },\n        expect.anything(),\n      )\n\n      expect(DIDCommEventSniffer.onEvent).toHaveBeenCalledWith(\n        {\n          data: {\n            message: {\n              id: expect.anything(),\n              type: MESSAGES_RECEIVED_MESSAGE_TYPE,\n              to: [mediator.did],\n              from: recipient.did,\n              created_time: expect.anything(),\n              thid: messageDeliveryMessage.id,\n              return_route: 'all',\n              body: { message_id_list: [msgId] },\n            },\n            metaData: { packing: 'authcrypt' },\n          },\n          type: 'DIDCommV2Message-received',\n        },\n        expect.anything(),\n      )\n    })\n  })\n})\n"
  },
  {
    "path": "packages/did-comm/src/__tests__/packing.test.ts",
    "content": "import { DIDComm } from '../didcomm.js'\nimport { IDIDManager, IIdentifier, IKeyManager, IResolver, TAgent } from '../../../core-types/src'\nimport { createAgent } from '../../../core/src'\nimport { DIDManager, MemoryDIDStore } from '../../../did-manager/src'\nimport { KeyManager, MemoryKeyStore, MemoryPrivateKeyStore } from '../../../key-manager/src'\nimport { KeyManagementSystem } from '../../../kms-local/src'\nimport { getDidKeyResolver, KeyDIDProvider } from '../../../did-provider-key/src'\nimport { DIDResolverPlugin } from '../../../did-resolver/src'\nimport { type DIDDocument, Resolver } from 'did-resolver'\nimport { type IDIDComm } from '../types/IDIDComm.js'\nimport { base64ToBytes, bytesToUtf8String } from '@veramo/utils'\n\nconst multiBaseDoc = {\n  '@context': ['https://www.w3.org/ns/did/v1', 'https://w3id.org/security/suites/jws-2020/v1'],\n  controller: 'did:web:portcullis.1keep.com',\n  id: 'did:web:portcullis.1keep.com',\n  keyAgreement: ['did:web:portcullis.1keep.com#1'],\n  service: [\n    {\n      accept: ['didcomm/v2'],\n      id: '#didcomm',\n      routingKeys: [],\n      serviceEndpoint: 'https://portcullis.1keep.com/didcomm',\n      type: 'DIDCommMessaging',\n    },\n  ],\n  verificationMethod: [\n    {\n      controller: 'did:web:portcullis.1keep.com',\n      id: 'did:web:portcullis.1keep.com#0',\n      publicKeyMultibase: 'z8FRmkyRH9xAsLCk51yXN2Qy6uq4eN4iAesa3v3Hv889v',\n      type: 'Ed25519VerificationKey2020',\n    },\n    {\n      controller: 'did:web:portcullis.1keep.com',\n      id: 'did:web:portcullis.1keep.com#1',\n      publicKeyMultibase: 'z6LSpSrLxbAhg2SHwKk7kwpsH7DM7QjFS5iK6qP87eViohud',\n      type: 'X25519KeyAgreementKey2020',\n    },\n  ],\n}\n\nconst base58Doc = {\n  '@context': ['https://www.w3.org/ns/did/v1', 'https://w3id.org/security/suites/jws-2020/v1'],\n  authentication: ['did:web:verifiable.ink#0'],\n  controller: 'did:web:verifiable.ink',\n  id: 'did:web:verifiable.ink',\n  keyAgreement: ['did:web:verifiable.ink#1'],\n  service: [\n    {\n      accept: ['didcomm/v2'],\n      id: 'did:web:verifiable.ink#didcomm',\n      routingKeys: [],\n      serviceEndpoint: 'https://verifiable.ink/didcomm',\n      type: 'DIDCommMessaging',\n    },\n  ],\n  verificationMethod: [\n    {\n      controller: 'did:web:verifiable.ink',\n      id: 'did:web:verifiable.ink#0',\n      publicKeyBase58: 'JDTRH3N5xMFxRnDzn4NdZc1NPUm9w9Y4ZSehnscCKqBw',\n      type: 'Ed25519VerificationKey2018',\n    },\n    {\n      controller: 'did:web:verifiable.ink',\n      id: 'did:web:verifiable.ink#1',\n      publicKeyBase58: 'Djiwiqccx8kupbtbkMYioj3F4eL9GUcsPJ9LUmNJFN7n',\n      type: 'X25519KeyAgreementKey2019',\n    },\n  ],\n}\n\nconst hexDoc = {\n  '@context': 'https://www.w3.org/ns/did/v1',\n  id: 'did:web:iiw-demo.herokuapp.com',\n  verificationMethod: [\n    {\n      id: 'did:web:iiw-demo.herokuapp.com#6eb094077b42b299c8ab5e1981e3dba7e9e331c26acdde4c6bd434dcb4bf856e',\n      type: 'Ed25519VerificationKey2018',\n      controller: 'did:web:iiw-demo.herokuapp.com',\n      publicKeyHex: '6eb094077b42b299c8ab5e1981e3dba7e9e331c26acdde4c6bd434dcb4bf856e',\n    },\n    {\n      id: 'did:web:iiw-demo.herokuapp.com#6e5db42d8d42bca9eee16fef45d41cd3cfaa52fa726ade05055f7d09dcfbf669',\n      type: 'X25519KeyAgreementKey2019',\n      controller: 'did:web:iiw-demo.herokuapp.com',\n      publicKeyHex: '6e5db42d8d42bca9eee16fef45d41cd3cfaa52fa726ade05055f7d09dcfbf669',\n    },\n  ],\n  authentication: [\n    'did:web:iiw-demo.herokuapp.com#6eb094077b42b299c8ab5e1981e3dba7e9e331c26acdde4c6bd434dcb4bf856e',\n  ],\n  assertionMethod: [\n    'did:web:iiw-demo.herokuapp.com#6eb094077b42b299c8ab5e1981e3dba7e9e331c26acdde4c6bd434dcb4bf856e',\n  ],\n  keyAgreement: [\n    'did:web:iiw-demo.herokuapp.com#6eb094077b42b299c8ab5e1981e3dba7e9e331c26acdde4c6bd434dcb4bf856e',\n    'did:web:iiw-demo.herokuapp.com#6e5db42d8d42bca9eee16fef45d41cd3cfaa52fa726ade05055f7d09dcfbf669',\n  ],\n  service: [\n    {\n      id: 'did:web:iiw-demo.herokuapp.com#msg',\n      type: 'Messaging',\n      serviceEndpoint: 'https://iiw-demo.herokuapp.com/messaging',\n      description: 'Handles incoming POST messages',\n    },\n    {\n      id: 'did:web:iiw-demo.herokuapp.com#msg-didcomm',\n      type: 'DIDCommMessaging',\n      serviceEndpoint: 'https://iiw-demo.herokuapp.com/messaging',\n      description: 'Handles incoming DIDComm messages',\n    },\n  ],\n}\n\n// https://github.com/aviarytech/didcomm/blob/master/tests/fixtures/didDocs/alice.json\nconst jwkDocX = {\n  '@context': ['https://www.w3.org/ns/did/v1', 'https://w3id.org/security/suites/jws-2020/v1'],\n  id: 'did:example:alice',\n  verificationMethod: [\n    {\n      id: 'did:example:alice#key-0',\n      controller: 'did:example:alice',\n      type: 'JsonWebKey2020',\n      publicKeyJwk: {\n        kty: 'OKP',\n        crv: 'X25519',\n        x: 'tsc9iYfy4hv2Mz5Q-ztGjKXeXzWUDWl5DLpfepJg4Wc',\n      },\n    },\n  ],\n  authentication: ['did:example:alice#key-0'],\n  assertionMethod: ['did:example:alice#key-0'],\n  keyAgreement: ['did:example:alice#key-0'],\n  service: [\n    {\n      id: 'did:example:alice#didcomm',\n      type: 'DIDCommMessaging',\n      serviceEndpoint: 'http://example.com/didcomm',\n      routingKeys: [],\n    },\n  ],\n}\n\nconst jwkDocEd = {\n  '@context': ['https://www.w3.org/ns/did/v1', 'https://w3id.org/security/suites/jws-2020/v1'],\n  id: 'did:example:alice',\n  verificationMethod: [\n    {\n      id: 'did:example:alice#key-0',\n      controller: 'did:example:alice',\n      type: 'JsonWebKey2020',\n      publicKeyJwk: {\n        kty: 'OKP',\n        crv: 'Ed25519',\n        x: 'CV-aGlld3nVdgnhoZK0D36Wk-9aIMlZjZOK2XhPMnkQ',\n      },\n    },\n  ],\n  authentication: ['did:example:alice#key-0'],\n  assertionMethod: ['did:example:alice#key-0'],\n  keyAgreement: ['did:example:alice#key-0'],\n  service: [\n    {\n      id: 'did:example:alice#didcomm',\n      type: 'DIDCommMessaging',\n      serviceEndpoint: 'http://example.com/didcomm',\n      routingKeys: [],\n    },\n  ],\n}\n\ndescribe('didComm', () => {\n  let senderDID: IIdentifier\n  let recipientDID: IIdentifier\n  let agent: TAgent<IResolver & IKeyManager & IDIDManager & IDIDComm>\n\n  beforeAll(async () => {\n    agent = createAgent<IResolver & IKeyManager & IDIDManager & IDIDComm>({\n      plugins: [\n        new KeyManager({\n          store: new MemoryKeyStore(),\n          kms: {\n            local: new KeyManagementSystem(new MemoryPrivateKeyStore()),\n          },\n        }),\n        new DIDManager({\n          providers: {\n            'did:key': new KeyDIDProvider({ defaultKms: 'local' }),\n          },\n          store: new MemoryDIDStore(),\n          defaultProvider: 'did:key',\n        }),\n        new DIDResolverPlugin({\n          resolver: new Resolver({\n            ...getDidKeyResolver(),\n            fake: async (did: string) => {\n              let doc: DIDDocument\n              if (did === 'did:fake:base58') {\n                doc = base58Doc\n              } else if (did === 'did:fake:multibase') {\n                doc = multiBaseDoc\n              } else if (did === 'did:fake:hex') {\n                doc = hexDoc\n              } else if (did === 'did:fake:jwkx') {\n                doc = jwkDocX\n              } else if (did === 'did:fake:jwked') {\n                doc = jwkDocEd\n              } else {\n                throw new Error('Bad didUrl for fake resolver: ' + did)\n              }\n\n              // DIDResolutionResult\n              return {\n                didResolutionMetadata: {},\n                didDocument: doc,\n                didDocumentMetadata: {},\n              }\n            },\n          }),\n        }),\n        new DIDComm(),\n      ],\n    })\n    senderDID = await agent.didManagerGetOrCreate({\n      provider: 'did:key',\n      alias: 'did-comm packing sender DID',\n    })\n    recipientDID = await agent.didManagerGetOrCreate({\n      provider: 'did:key',\n      alias: 'did-comm packing receiver DID',\n    })\n  })\n\n  const createTestMessage = (receiverDID: string) => {\n    return {\n      type: 'test',\n      from: senderDID.did,\n      to: [receiverDID],\n      id: 'test',\n      body: { hello: 'world' },\n    }\n  }\n\n  describe('recipient key formats', () => {\n    it('should pack message for public key as base58', async () => {\n      const packedMessage = await agent.packDIDCommMessage({\n        message: createTestMessage('did:fake:base58'),\n        packing: 'authcrypt',\n      })\n      expect(packedMessage).toBeDefined()\n    })\n\n    it.todo('should unpack message packed for base58')\n\n    it('should pack message for public key as multibase', async () => {\n      const packedMessage = await agent.packDIDCommMessage({\n        message: createTestMessage('did:fake:multibase'),\n        packing: 'authcrypt',\n      })\n      expect(packedMessage).toBeDefined()\n    })\n\n    it.todo('should unpack message packed for multibase')\n\n    it('should pack message for public key as hex', async () => {\n      const packedMessage = await agent.packDIDCommMessage({\n        message: createTestMessage('did:fake:hex'),\n        packing: 'authcrypt',\n      })\n      expect(packedMessage).toBeDefined()\n    })\n\n    it.todo('should unpack message packed for hex')\n\n    it('should pack message for public key as jwk with X25519 crv', async () => {\n      const packedMessage = await agent.packDIDCommMessage({\n        message: createTestMessage('did:fake:jwkx'),\n        packing: 'authcrypt',\n      })\n      expect(packedMessage).toBeDefined()\n    })\n\n    it.todo('should unpack message packed for jwk with X25519 crv')\n\n    it('should pack message for public key as jwk with Ed25519 crv', async () => {\n      const packedMessage = await agent.packDIDCommMessage({\n        message: createTestMessage('did:fake:jwked'),\n        packing: 'authcrypt',\n      })\n      expect(packedMessage).toBeDefined()\n    })\n\n    it.todo('should unpack message packed for jwk with Ed25519 crv')\n  })\n\n  describe('packing and algorithms', () => {\n    describe('anoncrypt packing', () => {\n      const packing = 'anoncrypt'\n      it(`should pack and unpack using ${packing}`, async () => {\n        const message = createTestMessage(recipientDID.did)\n        const packedMessage = await agent.packDIDCommMessage({\n          message,\n          packing: packing as any,\n        })\n        const unpackedMessage = await agent.unpackDIDCommMessage(packedMessage)\n        expect(unpackedMessage.message).toEqual(message)\n      })\n\n      describe.each(['XC20P', 'A256GCM', 'A256CBC-HS512'])(`%s enc`, (enc) => {\n        it(`should pack and unpack using ${packing} packing and ${enc} enc`, async () => {\n          const message = createTestMessage(recipientDID.did)\n          const packedMessage = await agent.packDIDCommMessage({\n            message,\n            packing: packing as any,\n            options: {\n              enc: enc as any,\n            },\n          })\n          const unpackedMessage = await agent.unpackDIDCommMessage(packedMessage)\n          expect(unpackedMessage.message).toEqual(message)\n        })\n\n        it.each(['ECDH-ES+A256KW', 'ECDH-ES+XC20PKW'])(\n          `should pack and unpack using ${packing} packing and ${enc} enc and %s alg`,\n          async (alg) => {\n            const message = createTestMessage(recipientDID.did)\n            const packedMessage = await agent.packDIDCommMessage({\n              message,\n              packing: packing as any,\n              options: {\n                enc: enc as any,\n                alg: alg as any,\n              },\n            })\n            const protectedHeader = JSON.parse(\n              bytesToUtf8String(base64ToBytes(JSON.parse(packedMessage.message).protected)),\n            )\n            expect(protectedHeader.alg).toEqual(alg)\n            expect(protectedHeader.enc).toEqual(enc)\n            const unpackedMessage = await agent.unpackDIDCommMessage(packedMessage)\n            expect(unpackedMessage.metaData.packing).toEqual(packing)\n            expect(unpackedMessage.message).toEqual(message)\n          },\n        )\n      })\n    })\n\n    describe('authcrypt packing', () => {\n      const packing = 'authcrypt'\n      it(`should pack and unpack using ${packing}`, async () => {\n        const message = createTestMessage(recipientDID.did)\n        const packedMessage = await agent.packDIDCommMessage({\n          message,\n          packing: packing as any,\n        })\n        const unpackedMessage = await agent.unpackDIDCommMessage(packedMessage)\n        expect(unpackedMessage.message).toEqual(message)\n      })\n\n      describe.each(['XC20P', 'A256GCM', 'A256CBC-HS512'])(`%s enc`, (enc) => {\n        it(`should pack and unpack using ${packing} packing and ${enc} enc`, async () => {\n          const message = createTestMessage(recipientDID.did)\n          const packedMessage = await agent.packDIDCommMessage({\n            message,\n            packing: packing as any,\n            options: {\n              enc: enc as any,\n            },\n          })\n          const unpackedMessage = await agent.unpackDIDCommMessage(packedMessage)\n          expect(unpackedMessage.message).toEqual(message)\n        })\n\n        it.each(['ECDH-1PU+A256KW', 'ECDH-1PU+XC20PKW'])(\n          `should pack and unpack using ${packing} packing and ${enc} enc and %s alg`,\n          async (alg) => {\n            const message = createTestMessage(recipientDID.did)\n            const packedMessage = await agent.packDIDCommMessage({\n              message,\n              packing: packing as any,\n              options: {\n                enc: enc as any,\n                alg: alg as any,\n              },\n            })\n            const unpackedMessage = await agent.unpackDIDCommMessage(packedMessage)\n            expect(unpackedMessage.metaData.packing).toEqual(packing)\n            expect(unpackedMessage.message).toEqual(message)\n          },\n        )\n      })\n    })\n  })\n})\n"
  },
  {
    "path": "packages/did-comm/src/__tests__/routing-message-handler-v3-coordinate-mediation.test.ts",
    "content": "import { DIDComm } from '../didcomm.js'\nimport { KeyValueStore } from '../../../kv-store/src'\nimport {\n  createAgent,\n  IDIDManager,\n  IEventListener,\n  IIdentifier,\n  IKeyManager,\n  IMessageHandler,\n  IResolver,\n  TAgent,\n} from '../../../core/src'\nimport {\n  RequesterDid,\n  MediationResponse,\n  IMediationManager,\n  PreMediationRequestPolicy,\n} from '../../../mediation-manager'\nimport { DIDManager, MemoryDIDStore } from '../../../did-manager/src'\nimport { KeyManager, MemoryKeyStore, MemoryPrivateKeyStore } from '../../../key-manager/src'\nimport { KeyManagementSystem } from '../../../kms-local/src'\nimport { DIDResolverPlugin } from '../../../did-resolver/src'\nimport { Resolver } from 'did-resolver'\nimport { DIDCommHttpTransport } from '../transports/transports.js'\nimport { IDIDComm } from '../types/IDIDComm.js'\nimport { MessageHandler } from '../../../message-handler/src'\nimport {\n  CoordinateMediationV3MediatorMessageHandler,\n  CoordinateMediationV3RecipientMessageHandler,\n  createV3MediateRequestMessage,\n  CoordinateMediation,\n  createV3RecipientUpdateMessage,\n  Update,\n  UpdateAction,\n} from '../protocols/coordinate-mediation-v3-message-handler.js'\nimport { DIDCommMessageMediaType } from '../types/message-types.js'\nimport {\n  RoutingMessageHandler,\n  FORWARD_MESSAGE_TYPE,\n  QUEUE_MESSAGE_TYPE,\n} from '../protocols/routing-message-handler.js'\nimport { FakeDidProvider, FakeDidResolver } from '../../../test-utils/src'\nimport { MessagingRouter, RequestWithAgentRouter } from '../../../remote-server/src'\nimport { Entities, IDataStore, migrations } from '../../../data-store/src'\nimport express from 'express'\nimport { Server } from 'http'\nimport { DIDCommMessageHandler } from '../message-handler.js'\nimport { DataStore, DataStoreORM } from '../../../data-store/src'\nimport { DataSource } from 'typeorm'\nimport { v4 } from 'uuid'\nimport { MediationManagerPlugin } from '../../../mediation-manager/src'\n\nimport { jest } from '@jest/globals'\nimport 'cross-fetch/polyfill'\n\nconst DIDCommEventSniffer: IEventListener = {\n  eventTypes: ['DIDCommV2Message-sent', 'DIDCommV2Message-received', 'DIDCommV2Message-forwardMessageQueued'],\n  onEvent: jest.fn(() => Promise.resolve()),\n}\n\nconst policyStore = new KeyValueStore<PreMediationRequestPolicy>({ store: new Map() })\nconst mediationStore = new KeyValueStore<MediationResponse>({ store: new Map() })\nconst recipientDidStore = new KeyValueStore<RequesterDid>({ store: new Map() })\n\ndescribe('routing-message-handler [V3 CoordinateMediation]', () => {\n  let recipient: IIdentifier\n  let mediator: IIdentifier\n  let agent: TAgent<\n    IResolver & IKeyManager & IDIDManager & IDIDComm & IMessageHandler & IDataStore & IMediationManager\n  >\n  let didCommEndpointServer: Server\n  let listeningPort = Math.round(Math.random() * 32000 + 2048)\n  // eslint-disable-next-line @typescript-eslint/no-explicit-any\n  let dbConnection: any // typeorm types don't seem to follow semantic release patterns leading to type errors\n\n  beforeAll(async () => {\n    dbConnection = new DataSource({\n      name: 'test',\n      type: 'sqlite',\n      database: ':memory:',\n      synchronize: false,\n      migrations: migrations,\n      migrationsRun: true,\n      logging: false,\n      entities: Entities,\n    })\n    agent = createAgent({\n      plugins: [\n        new KeyManager({\n          store: new MemoryKeyStore(),\n          kms: {\n            // @ts-ignore\n            local: new KeyManagementSystem(new MemoryPrivateKeyStore()),\n          },\n        }),\n        new DIDManager({\n          providers: {\n            'did:fake': new FakeDidProvider(),\n            // 'did:web': new WebDIDProvider({ defaultKms: 'local' })\n          },\n          store: new MemoryDIDStore(),\n          defaultProvider: 'did:fake',\n        }),\n        new DIDResolverPlugin({\n          resolver: new Resolver({\n            ...new FakeDidResolver(() => agent).getDidFakeResolver(),\n          }),\n        }),\n        new DIDComm({ transports: [new DIDCommHttpTransport()] }),\n        new MessageHandler({\n          messageHandlers: [\n            new DIDCommMessageHandler(),\n            new CoordinateMediationV3MediatorMessageHandler(),\n            new CoordinateMediationV3RecipientMessageHandler(),\n            new RoutingMessageHandler(),\n          ],\n        }),\n        // @ts-ignore\n        new MediationManagerPlugin(true, policyStore, mediationStore, recipientDidStore),\n        new DataStore(dbConnection),\n        new DataStoreORM(dbConnection),\n        DIDCommEventSniffer,\n      ],\n    })\n\n    recipient = await agent.didManagerImport({\n      did: 'did:fake:z6MkgbqNU4uF9NKSz5BqJQ4XKVHuQZYcUZP8pXGsJC8nTHwo',\n      keys: [\n        {\n          type: 'Ed25519',\n          kid: 'didcomm-senderKey-1',\n          publicKeyHex: '1fe9b397c196ab33549041b29cf93be29b9f2bdd27322f05844112fad97ff92a',\n          privateKeyHex:\n            'b57103882f7c66512dc96777cbafbeb2d48eca1e7a867f5a17a84e9a6740f7dc1fe9b397c196ab33549041b29cf93be29b9f2bdd27322f05844112fad97ff92a',\n          kms: 'local',\n        },\n      ],\n      services: [\n        {\n          id: 'msg1',\n          type: 'DIDCommMessaging',\n          serviceEndpoint: `http://localhost:${listeningPort}/messaging`,\n        },\n      ],\n      provider: 'did:fake',\n      alias: 'sender',\n    })\n\n    mediator = await agent.didManagerImport({\n      did: 'did:fake:z6MkrPhffVLBZpxH7xvKNyD4sRVZeZsNTWJkLdHdgWbfgNu3',\n      keys: [\n        {\n          type: 'Ed25519',\n          kid: 'didcomm-receiverKey-1',\n          publicKeyHex: 'b162e405b6485eff8a57932429b192ec4de13c06813e9028a7cdadf0e2703636',\n          privateKeyHex:\n            '19ed9b6949cfd0f9a57e30f0927839a985fa699491886ebcdda6a954d869732ab162e405b6485eff8a57932429b192ec4de13c06813e9028a7cdadf0e2703636',\n          kms: 'local',\n        },\n      ],\n      services: [\n        {\n          id: 'msg2',\n          type: 'DIDCommMessaging',\n          serviceEndpoint: `http://localhost:${listeningPort}/messaging`,\n        },\n      ],\n      provider: 'did:fake',\n      alias: 'receiver',\n    })\n\n    const requestWithAgent = RequestWithAgentRouter({ agent })\n\n    await new Promise((resolve) => {\n      //setup a server to receive HTTP messages and forward them to this agent to be processed as DIDComm messages\n      const app = express()\n      // app.use(requestWithAgent)\n      app.use(\n        '/messaging',\n        requestWithAgent,\n        MessagingRouter({\n          metaData: { type: 'DIDComm', value: 'integration test' },\n        }),\n      )\n      didCommEndpointServer = app.listen(listeningPort, () => {\n        resolve(true)\n      })\n    })\n  })\n\n  afterAll(async () => {\n    try {\n      await new Promise((resolve, _reject) => didCommEndpointServer?.close(resolve))\n    } catch (e: any) {\n      //nop\n    }\n    try {\n      await dbConnection?.destroy()\n    } catch (e: any) {\n      // nop\n    }\n  })\n\n  it('should save forward message in queue for recipient', async () => {\n    expect.assertions(2)\n\n    // 1. Request Mediation\n    const mediateRequestMessage = createV3MediateRequestMessage(recipient.did, mediator.did)\n    const mediateRequestMessageContents = { packing: 'authcrypt', message: mediateRequestMessage } as const\n    const packedMediateRequestMessage = await agent.packDIDCommMessage(mediateRequestMessageContents)\n    const recipientDidUrl = mediator.did\n    await agent.sendDIDCommMessage({\n      messageId: mediateRequestMessage.id,\n      packedMessage: packedMediateRequestMessage,\n      recipientDidUrl,\n    })\n\n    // 2. Recipient Update\n    const update: Update = { recipient_did: recipient.did, action: UpdateAction.ADD }\n    const updateMessage = createV3RecipientUpdateMessage(recipient.did, mediator.did, [update])\n    const updateMessageContents = { packing: 'authcrypt', message: updateMessage } as const\n    const packedUpdateMessage = await agent.packDIDCommMessage(updateMessageContents)\n    await agent.sendDIDCommMessage({\n      messageId: updateMessage.id,\n      packedMessage: packedUpdateMessage,\n      recipientDidUrl,\n    })\n\n    // 2. Forward message\n    const innerMessage = await agent.packDIDCommMessage({\n      packing: 'authcrypt',\n      message: {\n        type: 'test',\n        to: [recipient.did],\n        from: mediator.did,\n        id: 'test',\n        body: { hello: 'world' },\n      },\n    })\n    const msgId = v4()\n    const packedForwardMessage = await agent.packDIDCommMessage({\n      packing: 'anoncrypt',\n      message: {\n        type: FORWARD_MESSAGE_TYPE,\n        to: [mediator.did],\n        id: msgId,\n        body: {\n          next: recipient.did,\n        },\n        attachments: [\n          { media_type: DIDCommMessageMediaType.ENCRYPTED, data: { json: JSON.parse(innerMessage.message) } },\n        ],\n      },\n    })\n    await agent.sendDIDCommMessage({\n      messageId: msgId,\n      packedMessage: packedForwardMessage,\n      recipientDidUrl: mediator.did,\n    })\n\n    expect(DIDCommEventSniffer.onEvent).toHaveBeenCalledWith(\n      {\n        data: {\n          message: {\n            body: { next: recipient.did },\n            id: msgId,\n            to: [mediator.did],\n            type: FORWARD_MESSAGE_TYPE,\n            attachments: [\n              {\n                media_type: DIDCommMessageMediaType.ENCRYPTED,\n                data: { json: JSON.parse(innerMessage.message) },\n              },\n            ],\n          },\n          metaData: { packing: 'anoncrypt' },\n        },\n        type: 'DIDCommV2Message-received',\n      },\n      expect.anything(),\n    )\n\n    expect(DIDCommEventSniffer.onEvent).toHaveBeenCalledWith(\n      {\n        data: {\n          id: expect.anything(),\n          to: `${recipient.did}#${recipient.keys[0].kid}`,\n          type: QUEUE_MESSAGE_TYPE,\n          raw: innerMessage.message,\n          createdAt: expect.anything(),\n          metaData: [{ type: 'didCommForwardMsgId', value: msgId }],\n        },\n        type: 'DIDCommV2Message-forwardMessageQueued',\n      },\n      expect.anything(),\n    )\n  })\n\n  it('should save forward message in queue for recipient previously denied', async () => {\n    // set up agent to deny mediation\n    agent.isMediateDefaultGrantAll = jest.fn(() => Promise.resolve(false))\n\n    expect.assertions(1)\n    // 1. Request Mediation\n    const mediateRequestMessage = createV3MediateRequestMessage(recipient.did, mediator.did)\n    const mediateRequestMessageContents = { packing: 'authcrypt', message: mediateRequestMessage } as const\n    const packedMediateRequestMessage = await agent.packDIDCommMessage(mediateRequestMessageContents)\n    const recipientDidUrl = mediator.did\n    await agent.sendDIDCommMessage({\n      messageId: mediateRequestMessage.id,\n      packedMessage: packedMediateRequestMessage,\n      recipientDidUrl,\n    })\n\n    // 2. Recipient Update\n    const update: Update = { recipient_did: recipient.did, action: UpdateAction.ADD }\n    const updateMessage = createV3RecipientUpdateMessage(recipient.did, mediator.did, [update])\n    const updateMessageContents = { packing: 'authcrypt', message: updateMessage } as const\n    const packedUpdateMessage = await agent.packDIDCommMessage(updateMessageContents)\n    await agent.sendDIDCommMessage({\n      messageId: updateMessage.id,\n      packedMessage: packedUpdateMessage,\n      recipientDidUrl,\n    })\n\n    // 3. Forward message\n    const innerMessage = await agent.packDIDCommMessage({\n      packing: 'authcrypt',\n      message: {\n        type: 'test',\n        to: [recipient.did],\n        from: mediator.did,\n        id: 'test',\n        body: { hello: 'world' },\n      },\n    })\n    const msgId = v4()\n    const packedForwardMessage = await agent.packDIDCommMessage({\n      packing: 'anoncrypt',\n      message: {\n        type: FORWARD_MESSAGE_TYPE,\n        to: [mediator.did],\n        id: msgId,\n        body: {\n          next: recipient.did,\n        },\n        attachments: [\n          { media_type: DIDCommMessageMediaType.ENCRYPTED, data: { json: JSON.parse(innerMessage.message) } },\n        ],\n      },\n    })\n    await agent.sendDIDCommMessage({\n      messageId: msgId,\n      packedMessage: packedForwardMessage,\n      recipientDidUrl: mediator.did,\n    })\n\n    expect(DIDCommEventSniffer.onEvent).toHaveBeenCalledWith(\n      {\n        data: {\n          id: expect.anything(),\n          to: `${recipient.did}#${recipient.keys[0].kid}`,\n          type: QUEUE_MESSAGE_TYPE,\n          raw: innerMessage.message,\n          createdAt: expect.anything(),\n          metaData: [{ type: 'didCommForwardMsgId', value: msgId }],\n        },\n        type: 'DIDCommV2Message-forwardMessageQueued',\n      },\n      expect.anything(),\n    )\n  })\n\n  it('should not save forward message in queue for recipient denied', async () => {\n    // set up agent to deny mediation\n    agent.isMediateDefaultGrantAll = jest.fn(() => Promise.resolve(false))\n\n    expect.assertions(1)\n    // 1. Request Mediation\n    const mediateRequestMessage = createV3MediateRequestMessage(recipient.did, mediator.did)\n    const mediateRequestMessageContents = { packing: 'authcrypt', message: mediateRequestMessage } as const\n    const packedMediateRequestMessage = await agent.packDIDCommMessage(mediateRequestMessageContents)\n    const recipientDidUrl = mediator.did\n    await agent.sendDIDCommMessage({\n      messageId: mediateRequestMessage.id,\n      packedMessage: packedMediateRequestMessage,\n      recipientDidUrl,\n    })\n\n    // 2. Recipient Update\n    const update: Update = { recipient_did: recipient.did, action: UpdateAction.ADD }\n    const updateMessage = createV3RecipientUpdateMessage(recipient.did, mediator.did, [update])\n    const updateMessageContents = { packing: 'authcrypt', message: updateMessage } as const\n    const packedUpdateMessage = await agent.packDIDCommMessage(updateMessageContents)\n    await agent.sendDIDCommMessage({\n      messageId: updateMessage.id,\n      packedMessage: packedUpdateMessage,\n      recipientDidUrl,\n    })\n\n    // 3. Save deny message\n    await agent.dataStoreSaveMessage({\n      message: {\n        type: CoordinateMediation.MEDIATE_DENY,\n        from: mediator.did,\n        to: recipient.did,\n        id: v4(),\n        createdAt: new Date().toISOString(),\n        data: {},\n      },\n    })\n\n    // 4. Forward message\n    const innerMessage = await agent.packDIDCommMessage({\n      packing: 'authcrypt',\n      message: {\n        type: 'test',\n        to: [recipient.did],\n        from: mediator.did,\n        id: 'test',\n        body: { hello: 'world' },\n      },\n    })\n    const msgId = v4()\n    const packedForwardMessage = await agent.packDIDCommMessage({\n      packing: 'anoncrypt',\n      message: {\n        type: FORWARD_MESSAGE_TYPE,\n        to: [mediator.did],\n        id: msgId,\n        body: {\n          next: recipient.did,\n        },\n        attachments: [\n          { media_type: DIDCommMessageMediaType.ENCRYPTED, data: { json: JSON.parse(innerMessage.message) } },\n        ],\n      },\n    })\n    await agent.sendDIDCommMessage({\n      messageId: msgId,\n      packedMessage: packedForwardMessage,\n      recipientDidUrl: mediator.did,\n    })\n\n    expect(DIDCommEventSniffer.onEvent).not.toHaveBeenCalledWith(\n      {\n        data: {\n          id: expect.anything(),\n          to: `${recipient.did}#${recipient.keys[0].kid}`,\n          type: QUEUE_MESSAGE_TYPE,\n          raw: innerMessage,\n          createdAt: expect.anything(),\n          metaData: [{ type: 'didCommForwardMsgId', value: msgId }],\n        },\n        type: 'DIDCommV2Message-forwardMessageQueued',\n      },\n      expect.anything(),\n    )\n  })\n})\n"
  },
  {
    "path": "packages/did-comm/src/__tests__/routing-message-handler.test.ts",
    "content": "import { DIDComm } from '../didcomm.js'\nimport {\n  createAgent,\n  IDIDManager,\n  IEventListener,\n  IIdentifier,\n  IKeyManager,\n  IMessageHandler,\n  IResolver,\n  TAgent,\n} from '../../../core/src'\nimport { DIDManager, MemoryDIDStore } from '../../../did-manager/src'\nimport { KeyManager, MemoryKeyStore, MemoryPrivateKeyStore } from '../../../key-manager/src'\nimport { KeyManagementSystem } from '../../../kms-local/src'\nimport { DIDResolverPlugin } from '../../../did-resolver/src'\nimport { Resolver } from 'did-resolver'\nimport { DIDCommHttpTransport } from '../transports/transports.js'\nimport { IDIDComm } from '../types/IDIDComm.js'\nimport { MessageHandler } from '../../../message-handler/src'\nimport {\n  CoordinateMediationMediatorMessageHandler,\n  CoordinateMediationRecipientMessageHandler,\n  createMediateRequestMessage,\n  MEDIATE_DENY_MESSAGE_TYPE,\n} from '../protocols/coordinate-mediation-message-handler.js'\nimport { DIDCommMessageMediaType } from '../types/message-types.js'\nimport {\n  RoutingMessageHandler,\n  FORWARD_MESSAGE_TYPE,\n  QUEUE_MESSAGE_TYPE,\n} from '../protocols/routing-message-handler.js'\nimport { FakeDidProvider, FakeDidResolver } from '../../../test-utils/src'\nimport { MessagingRouter, RequestWithAgentRouter } from '../../../remote-server/src'\nimport { Entities, IDataStore, migrations } from '../../../data-store/src'\n// @ts-ignore\nimport express from 'express'\nimport { Server } from 'http'\nimport { DIDCommMessageHandler } from '../message-handler.js'\nimport { DataStore, DataStoreORM } from '../../../data-store/src'\nimport { DataSource } from 'typeorm'\nimport { v4 } from 'uuid'\nimport { jest } from '@jest/globals'\nimport 'cross-fetch/polyfill'\n\nconst DIDCommEventSniffer: IEventListener = {\n  eventTypes: ['DIDCommV2Message-sent', 'DIDCommV2Message-received', 'DIDCommV2Message-forwardMessageQueued'],\n  onEvent: jest.fn(() => Promise.resolve()),\n}\n\ndescribe('routing-message-handler', () => {\n  let recipient: IIdentifier\n  let mediator: IIdentifier\n  let agent: TAgent<IResolver & IKeyManager & IDIDManager & IDIDComm & IMessageHandler & IDataStore>\n  let didCommEndpointServer: Server\n  let listeningPort = Math.round(Math.random() * 32000 + 2048)\n  // eslint-disable-next-line @typescript-eslint/no-explicit-any\n  let dbConnection: any // typeorm types don't seem to follow semantic release patterns leading to type errors\n\n  beforeAll(async () => {\n    dbConnection = new DataSource({\n      name: 'test',\n      type: 'sqlite',\n      database: ':memory:',\n      synchronize: false,\n      migrations: migrations,\n      migrationsRun: true,\n      logging: false,\n      entities: Entities,\n    })\n    agent = createAgent({\n      plugins: [\n        new KeyManager({\n          store: new MemoryKeyStore(),\n          kms: {\n            // @ts-ignore\n            local: new KeyManagementSystem(new MemoryPrivateKeyStore()),\n          },\n        }),\n        new DIDManager({\n          providers: {\n            'did:fake': new FakeDidProvider(),\n            // 'did:web': new WebDIDProvider({ defaultKms: 'local' })\n          },\n          store: new MemoryDIDStore(),\n          defaultProvider: 'did:fake',\n        }),\n        new DIDResolverPlugin({\n          resolver: new Resolver({\n            ...new FakeDidResolver(() => agent).getDidFakeResolver(),\n          }),\n        }),\n        // @ts-ignore\n        new DIDComm([new DIDCommHttpTransport()]),\n        new MessageHandler({\n          messageHandlers: [\n            // @ts-ignore\n            new DIDCommMessageHandler(),\n            new CoordinateMediationMediatorMessageHandler(),\n            new CoordinateMediationRecipientMessageHandler(),\n            new RoutingMessageHandler(),\n          ],\n        }),\n        new DataStore(dbConnection),\n        new DataStoreORM(dbConnection),\n        DIDCommEventSniffer,\n      ],\n    })\n\n    recipient = await agent.didManagerImport({\n      did: 'did:fake:z6MkgbqNU4uF9NKSz5BqJQ4XKVHuQZYcUZP8pXGsJC8nTHwo',\n      keys: [\n        {\n          type: 'Ed25519',\n          kid: 'didcomm-senderKey-1',\n          publicKeyHex: '1fe9b397c196ab33549041b29cf93be29b9f2bdd27322f05844112fad97ff92a',\n          privateKeyHex:\n            'b57103882f7c66512dc96777cbafbeb2d48eca1e7a867f5a17a84e9a6740f7dc1fe9b397c196ab33549041b29cf93be29b9f2bdd27322f05844112fad97ff92a',\n          kms: 'local',\n        },\n      ],\n      services: [\n        {\n          id: 'msg1',\n          type: 'DIDCommMessaging',\n          serviceEndpoint: `http://localhost:${listeningPort}/messaging`,\n        },\n      ],\n      provider: 'did:fake',\n      alias: 'sender',\n    })\n\n    mediator = await agent.didManagerImport({\n      did: 'did:fake:z6MkrPhffVLBZpxH7xvKNyD4sRVZeZsNTWJkLdHdgWbfgNu3',\n      keys: [\n        {\n          type: 'Ed25519',\n          kid: 'didcomm-receiverKey-1',\n          publicKeyHex: 'b162e405b6485eff8a57932429b192ec4de13c06813e9028a7cdadf0e2703636',\n          privateKeyHex:\n            '19ed9b6949cfd0f9a57e30f0927839a985fa699491886ebcdda6a954d869732ab162e405b6485eff8a57932429b192ec4de13c06813e9028a7cdadf0e2703636',\n          kms: 'local',\n        },\n      ],\n      services: [\n        {\n          id: 'msg2',\n          type: 'DIDCommMessaging',\n          serviceEndpoint: `http://localhost:${listeningPort}/messaging`,\n        },\n      ],\n      provider: 'did:fake',\n      alias: 'receiver',\n    })\n    // console.log('sender: ', sender)\n    // console.log('recipient: ', recipient)\n\n    const requestWithAgent = RequestWithAgentRouter({ agent })\n\n    await new Promise((resolve) => {\n      //setup a server to receive HTTP messages and forward them to this agent to be processed as DIDComm messages\n      const app = express()\n      // app.use(requestWithAgent)\n      app.use(\n        '/messaging',\n        requestWithAgent,\n        MessagingRouter({\n          metaData: { type: 'DIDComm', value: 'integration test' },\n        }),\n      )\n      didCommEndpointServer = app.listen(listeningPort, () => {\n        resolve(true)\n      })\n    })\n  })\n\n  afterAll(async () => {\n    try {\n      await new Promise((resolve, _reject) => didCommEndpointServer?.close(resolve))\n    } catch (e: any) {\n      //nop\n    }\n    try {\n      await dbConnection?.destroy()\n    } catch (e: any) {\n      // nop\n    }\n  })\n\n  it('should save forward message in queue for recipient', async () => {\n    expect.assertions(2)\n\n    // 1. Coordinate mediation\n    const mediateRequestMessage = createMediateRequestMessage(recipient.did, mediator.did)\n    const packedMessage = await agent.packDIDCommMessage({\n      packing: 'authcrypt',\n      message: mediateRequestMessage,\n    })\n    await agent.sendDIDCommMessage({\n      messageId: mediateRequestMessage.id,\n      packedMessage,\n      recipientDidUrl: mediator.did,\n    })\n\n    // 2. Forward message\n    const innerMessage = await agent.packDIDCommMessage({\n      packing: 'authcrypt',\n      message: {\n        type: 'test',\n        to: [recipient.did],\n        from: mediator.did,\n        id: 'test',\n        body: { hello: 'world' },\n      },\n    })\n    const msgId = v4()\n    const packedForwardMessage = await agent.packDIDCommMessage({\n      packing: 'anoncrypt',\n      message: {\n        type: FORWARD_MESSAGE_TYPE,\n        to: [mediator.did],\n        id: msgId,\n        body: {\n          next: recipient.did,\n        },\n        attachments: [\n          { media_type: DIDCommMessageMediaType.ENCRYPTED, data: { json: JSON.parse(innerMessage.message) } },\n        ],\n      },\n    })\n    await agent.sendDIDCommMessage({\n      messageId: msgId,\n      packedMessage: packedForwardMessage,\n      recipientDidUrl: mediator.did,\n    })\n\n    expect(DIDCommEventSniffer.onEvent).toHaveBeenCalledWith(\n      {\n        data: {\n          message: {\n            body: { next: recipient.did },\n            id: msgId,\n            to: [mediator.did],\n            type: FORWARD_MESSAGE_TYPE,\n            attachments: [\n              {\n                media_type: DIDCommMessageMediaType.ENCRYPTED,\n                data: { json: JSON.parse(innerMessage.message) },\n              },\n            ],\n          },\n          metaData: { packing: 'anoncrypt' },\n        },\n        type: 'DIDCommV2Message-received',\n      },\n      expect.anything(),\n    )\n\n    expect(DIDCommEventSniffer.onEvent).toHaveBeenCalledWith(\n      {\n        data: {\n          id: expect.anything(),\n          to: `${recipient.did}#${recipient.keys[0].kid}`,\n          type: QUEUE_MESSAGE_TYPE,\n          raw: innerMessage.message,\n          createdAt: expect.anything(),\n          metaData: [{ type: 'didCommForwardMsgId', value: msgId }],\n        },\n        type: 'DIDCommV2Message-forwardMessageQueued',\n      },\n      expect.anything(),\n    )\n  })\n\n  it('should save forward message in queue for recipient previously denied', async () => {\n    expect.assertions(1)\n\n    // 1. Coordinate mediation\n    const mediateRequestMessage = createMediateRequestMessage(recipient.did, mediator.did)\n    const packedMessage = await agent.packDIDCommMessage({\n      packing: 'authcrypt',\n      message: mediateRequestMessage,\n    })\n    await agent.sendDIDCommMessage({\n      messageId: mediateRequestMessage.id,\n      packedMessage,\n      recipientDidUrl: mediator.did,\n    })\n\n    // 2. Save deny message\n    await agent.dataStoreSaveMessage({\n      message: {\n        type: MEDIATE_DENY_MESSAGE_TYPE,\n        from: mediator.did,\n        to: recipient.did,\n        id: v4(),\n        createdAt: new Date().toISOString(),\n        data: {},\n      },\n    })\n\n    // 3. Request again\n    await agent.sendDIDCommMessage({\n      messageId: mediateRequestMessage.id,\n      packedMessage,\n      recipientDidUrl: mediator.did,\n    })\n\n    // 4. Forward message\n    const innerMessage = await agent.packDIDCommMessage({\n      packing: 'authcrypt',\n      message: {\n        type: 'test',\n        to: [recipient.did],\n        from: mediator.did,\n        id: 'test',\n        body: { hello: 'world' },\n      },\n    })\n    const msgId = v4()\n    const packedForwardMessage = await agent.packDIDCommMessage({\n      packing: 'anoncrypt',\n      message: {\n        type: FORWARD_MESSAGE_TYPE,\n        to: [mediator.did],\n        id: msgId,\n        body: {\n          next: recipient.did,\n        },\n        attachments: [\n          { media_type: DIDCommMessageMediaType.ENCRYPTED, data: { json: JSON.parse(innerMessage.message) } },\n        ],\n      },\n    })\n    await agent.sendDIDCommMessage({\n      messageId: msgId,\n      packedMessage: packedForwardMessage,\n      recipientDidUrl: mediator.did,\n    })\n\n    expect(DIDCommEventSniffer.onEvent).toHaveBeenCalledWith(\n      {\n        data: {\n          id: expect.anything(),\n          to: `${recipient.did}#${recipient.keys[0].kid}`,\n          type: QUEUE_MESSAGE_TYPE,\n          raw: innerMessage.message,\n          createdAt: expect.anything(),\n          metaData: [{ type: 'didCommForwardMsgId', value: msgId }],\n        },\n        type: 'DIDCommV2Message-forwardMessageQueued',\n      },\n      expect.anything(),\n    )\n  })\n\n  it('should not save forward message in queue for recipient denied', async () => {\n    expect.assertions(1)\n\n    // 1. Coordinate mediation\n    const mediateRequestMessage = createMediateRequestMessage(recipient.did, mediator.did)\n    const packedMessage = await agent.packDIDCommMessage({\n      packing: 'authcrypt',\n      message: mediateRequestMessage,\n    })\n    await agent.sendDIDCommMessage({\n      messageId: mediateRequestMessage.id,\n      packedMessage,\n      recipientDidUrl: mediator.did,\n    })\n\n    // 2. Save deny message\n    await agent.dataStoreSaveMessage({\n      message: {\n        type: MEDIATE_DENY_MESSAGE_TYPE,\n        from: mediator.did,\n        to: recipient.did,\n        id: v4(),\n        createdAt: new Date().toISOString(),\n        data: {},\n      },\n    })\n\n    // 3. Forward message\n    const innerMessage = await agent.packDIDCommMessage({\n      packing: 'authcrypt',\n      message: {\n        type: 'test',\n        to: [recipient.did],\n        from: mediator.did,\n        id: 'test',\n        body: { hello: 'world' },\n      },\n    })\n    const msgId = v4()\n    const packedForwardMessage = await agent.packDIDCommMessage({\n      packing: 'anoncrypt',\n      message: {\n        type: FORWARD_MESSAGE_TYPE,\n        to: [mediator.did],\n        id: msgId,\n        body: {\n          next: recipient.did,\n        },\n        attachments: [\n          { media_type: DIDCommMessageMediaType.ENCRYPTED, data: { json: JSON.parse(innerMessage.message) } },\n        ],\n      },\n    })\n    await agent.sendDIDCommMessage({\n      messageId: msgId,\n      packedMessage: packedForwardMessage,\n      recipientDidUrl: mediator.did,\n    })\n\n    expect(DIDCommEventSniffer.onEvent).not.toHaveBeenCalledWith(\n      {\n        data: {\n          id: expect.anything(),\n          to: `${recipient.did}#${recipient.keys[0].kid}`,\n          type: QUEUE_MESSAGE_TYPE,\n          raw: innerMessage,\n          createdAt: expect.anything(),\n          metaData: [{ type: 'didCommForwardMsgId', value: msgId }],\n        },\n        type: 'DIDCommV2Message-forwardMessageQueued',\n      },\n      expect.anything(),\n    )\n  })\n})\n"
  },
  {
    "path": "packages/did-comm/src/__tests__/trust-ping-interop.test.ts",
    "content": "import { DIDComm } from '../didcomm.js'\nimport { IDIDManager, IIdentifier, IKeyManager, IResolver, TAgent } from '../../../core-types/src'\nimport { createAgent } from '../../../core/src'\nimport { DIDManager, MemoryDIDStore } from '../../../did-manager/src'\nimport { KeyManager, MemoryKeyStore, MemoryPrivateKeyStore } from '../../../key-manager/src'\nimport { KeyManagementSystem } from '../../../kms-local/src'\nimport { DIDResolverPlugin } from '../../../did-resolver/src'\nimport { DIDDocument, Resolver } from 'did-resolver'\nimport { IDIDComm } from '../types/IDIDComm.js'\nimport { ExampleDidProvider } from '../../../test-utils/src'\nimport 'cross-fetch/polyfill'\nimport { base64ToBytes, bytesToHex } from '../../../utils/src'\n\nimport * as u8a from 'uint8arrays'\n\nconst aliceDoc = {\n  '@context': ['https://www.w3.org/ns/did/v1', 'https://w3id.org/security/suites/jws-2020/v1'],\n  id: 'did:example:alice',\n  authentication: [\n    {\n      id: 'did:example:alice#key-1',\n      type: 'JsonWebKey2020',\n      controller: 'did:example:alice',\n      publicKeyJwk: {\n        kty: 'OKP',\n        crv: 'Ed25519',\n        x: 'G-boxFB6vOZBu-wXkm-9Lh79I8nf9Z50cILaOgKKGww',\n      },\n    },\n    {\n      id: 'did:example:alice#key-2',\n      type: 'JsonWebKey2020',\n      controller: 'did:example:alice',\n      publicKeyJwk: {\n        kty: 'EC',\n        crv: 'P-256',\n        x: '2syLh57B-dGpa0F8p1JrO6JU7UUSF6j7qL-vfk1eOoY',\n        y: 'BgsGtI7UPsObMRjdElxLOrgAO9JggNMjOcfzEPox18w',\n      },\n    },\n    {\n      id: 'did:example:alice#key-3',\n      type: 'JsonWebKey2020',\n      controller: 'did:example:alice',\n      publicKeyJwk: {\n        kty: 'EC',\n        crv: 'secp256k1',\n        x: 'aToW5EaTq5mlAf8C5ECYDSkqsJycrW-e1SQ6_GJcAOk',\n        y: 'JAGX94caA21WKreXwYUaOCYTBMrqaX4KWIlsQZTHWCk',\n      },\n    },\n  ],\n  keyAgreement: [\n    {\n      id: 'did:example:alice#key-x25519-1',\n      type: 'JsonWebKey2020',\n      controller: 'did:example:alice',\n      publicKeyJwk: {\n        kty: 'OKP',\n        crv: 'X25519',\n        x: 'avH0O2Y4tqLAq8y9zpianr8ajii5m4F_mICrzNlatXs',\n      },\n    },\n    {\n      id: 'did:example:alice#key-p256-1',\n      type: 'JsonWebKey2020',\n      controller: 'did:example:alice',\n      publicKeyJwk: {\n        kty: 'EC',\n        crv: 'P-256',\n        x: 'L0crjMN1g0Ih4sYAJ_nGoHUck2cloltUpUVQDhF2nHE',\n        y: 'SxYgE7CmEJYi7IDhgK5jI4ZiajO8jPRZDldVhqFpYoo',\n      },\n    },\n    {\n      id: 'did:example:alice#key-p521-1',\n      type: 'JsonWebKey2020',\n      controller: 'did:example:alice',\n      publicKeyJwk: {\n        kty: 'EC',\n        crv: 'P-521',\n        x: 'AHBEVPRhAv-WHDEvxVM9S0px9WxxwHL641Pemgk9sDdxvli9VpKCBdra5gg_4kupBDhz__AlaBgKOC_15J2Byptz',\n        y: 'AciGcHJCD_yMikQvlmqpkBbVqqbg93mMVcgvXBYAQPP-u9AF7adybwZrNfHWCKAQwGF9ugd0Zhg7mLMEszIONFRk',\n      },\n    },\n  ],\n}\n\nconst bobDoc = {\n  '@context': ['https://www.w3.org/ns/did/v2'],\n  id: 'did:example:bob',\n  keyAgreement: [\n    {\n      id: 'did:example:bob#key-x25519-1',\n      type: 'JsonWebKey2020',\n      controller: 'did:example:bob',\n      publicKeyJwk: {\n        kty: 'OKP',\n        crv: 'X25519',\n        x: 'GDTrI66K0pFfO54tlCSvfjjNapIs44dzpneBgyx0S3E',\n      },\n    },\n    {\n      id: 'did:example:bob#key-x25519-2',\n      type: 'JsonWebKey2020',\n      controller: 'did:example:bob',\n      publicKeyJwk: {\n        kty: 'OKP',\n        crv: 'X25519',\n        x: 'UT9S3F5ep16KSNBBShU2wh3qSfqYjlasZimn0mB8_VM',\n      },\n    },\n    {\n      id: 'did:example:bob#key-x25519-3',\n      type: 'JsonWebKey2020',\n      controller: 'did:example:bob',\n      publicKeyJwk: {\n        kty: 'OKP',\n        crv: 'X25519',\n        x: '82k2BTUiywKv49fKLZa-WwDi8RBf0tB0M8bvSAUQ3yY',\n      },\n    },\n    {\n      id: 'did:example:bob#key-p256-1',\n      type: 'JsonWebKey2020',\n      controller: 'did:example:bob',\n      publicKeyJwk: {\n        kty: 'EC',\n        crv: 'P-256',\n        x: 'FQVaTOksf-XsCUrt4J1L2UGvtWaDwpboVlqbKBY2AIo',\n        y: '6XFB9PYo7dyC5ViJSO9uXNYkxTJWn0d_mqJ__ZYhcNY',\n      },\n    },\n    {\n      id: 'did:example:bob#key-p256-2',\n      type: 'JsonWebKey2020',\n      controller: 'did:example:bob',\n      publicKeyJwk: {\n        kty: 'EC',\n        crv: 'P-256',\n        x: 'n0yBsGrwGZup9ywKhzD4KoORGicilzIUyfcXb1CSwe0',\n        y: 'ov0buZJ8GHzV128jmCw1CaFbajZoFFmiJDbMrceCXIw',\n      },\n    },\n    {\n      id: 'did:example:bob#key-p384-1',\n      type: 'JsonWebKey2020',\n      controller: 'did:example:bob',\n      publicKeyJwk: {\n        kty: 'EC',\n        crv: 'P-384',\n        x: 'MvnE_OwKoTcJVfHyTX-DLSRhhNwlu5LNoQ5UWD9Jmgtdxp_kpjsMuTTBnxg5RF_Y',\n        y: 'X_3HJBcKFQEG35PZbEOBn8u9_z8V1F9V1Kv-Vh0aSzmH-y9aOuDJUE3D4Hvmi5l7',\n      },\n    },\n    {\n      id: 'did:example:bob#key-p384-2',\n      type: 'JsonWebKey2020',\n      controller: 'did:example:bob',\n      publicKeyJwk: {\n        kty: 'EC',\n        crv: 'P-384',\n        x: '2x3HOTvR8e-Tu6U4UqMd1wUWsNXMD0RgIunZTMcZsS-zWOwDgsrhYVHmv3k_DjV3',\n        y: 'W9LLaBjlWYcXUxOf6ECSfcXKaC3-K9z4hCoP0PS87Q_4ExMgIwxVCXUEB6nf0GDd',\n      },\n    },\n    {\n      id: 'did:example:bob#key-p521-1',\n      type: 'JsonWebKey2020',\n      controller: 'did:example:bob',\n      publicKeyJwk: {\n        kty: 'EC',\n        crv: 'P-521',\n        x: 'Af9O5THFENlqQbh2Ehipt1Yf4gAd9RCa3QzPktfcgUIFADMc4kAaYVViTaDOuvVS2vMS1KZe0D5kXedSXPQ3QbHi',\n        y: 'ATZVigRQ7UdGsQ9j-omyff6JIeeUv3CBWYsZ0l6x3C_SYqhqVV7dEG-TafCCNiIxs8qeUiXQ8cHWVclqkH4Lo1qH',\n      },\n    },\n    {\n      id: 'did:example:bob#key-p521-2',\n      type: 'JsonWebKey2020',\n      controller: 'did:example:bob',\n      publicKeyJwk: {\n        kty: 'EC',\n        crv: 'P-521',\n        x: 'ATp_WxCfIK_SriBoStmA0QrJc2pUR1djpen0VdpmogtnKxJbitiPq-HJXYXDKriXfVnkrl2i952MsIOMfD2j0Ots',\n        y: 'AEJipR0Dc-aBZYDqN51SKHYSWs9hM58SmRY1MxgXANgZrPaq1EeGMGOjkbLMEJtBThdjXhkS5VlXMkF0cYhZELiH',\n      },\n    },\n  ],\n}\n\nconst trustPingMessage = {\n  type: 'https://didcomm.org/trust-ping/2.0/ping',\n  from: 'did:example:alice',\n  to: ['did:example:bob'],\n  id: 'trust-ping-test',\n  body: {\n    responseRequested: true,\n  },\n}\n\ndescribe('trust-ping-interop', () => {\n  let sender: IIdentifier\n  let recipient: IIdentifier\n  let agent: TAgent<IResolver & IKeyManager & IDIDManager & IDIDComm>\n\n  beforeAll(async () => {\n    agent = createAgent<IResolver & IKeyManager & IDIDManager & IDIDComm>({\n      plugins: [\n        new KeyManager({\n          store: new MemoryKeyStore(),\n          kms: {\n            local: new KeyManagementSystem(new MemoryPrivateKeyStore()),\n          },\n        }),\n        new DIDManager({\n          providers: {\n            'did:example': new ExampleDidProvider(),\n          },\n          store: new MemoryDIDStore(),\n          defaultProvider: 'did:example',\n        }),\n        new DIDResolverPlugin({\n          resolver: new Resolver({\n            example: async (did: string) => {\n              let doc: DIDDocument\n              if (did === 'did:example:alice') {\n                doc = aliceDoc\n              } else if (did === 'did:example:bob') {\n                doc = bobDoc\n              } else {\n                throw new Error('Bad didUrl for fake resolver: ' + did)\n              }\n\n              // DIDResolutionResult\n              return {\n                didResolutionMetadata: {},\n                didDocument: doc,\n                didDocumentMetadata: {},\n              }\n            },\n          }),\n        }),\n        new DIDComm(),\n      ],\n    })\n\n    // https://identity.foundation/didcomm-messaging/spec/#a1-sender-secrets\n    const senderSecretEd25519X = 'G-boxFB6vOZBu-wXkm-9Lh79I8nf9Z50cILaOgKKGww'\n    const senderSecretEd25519D = 'pFRUKkyzx4kHdJtFSnlPA9WzqkDT1HWV0xZ5OYZd2SY'\n\n    const senderSecretX25519X = 'avH0O2Y4tqLAq8y9zpianr8ajii5m4F_mICrzNlatXs'\n    const senderSecretX25519D = 'r-jK2cO3taR8LQnJB1_ikLBTAnOtShJOsHXRUWT-aZA'\n\n    sender = await agent.didManagerImport({\n      did: 'did:example:alice',\n      keys: [\n        {\n          type: 'Ed25519',\n          kid: 'did:example:alice#key-1',\n          publicKeyHex: bytesToHex(base64ToBytes(senderSecretEd25519X)),\n          // we use stablelib/nacl for ed25519, and the preferred encoding for the privateKey there is a 64 byte\n          // string, where the second half is the precomputed 32 byte encoding of the publicKey. This seems to be the\n          // preferred encoding in other related libraries too, as the pre-computation speeds up the signing by a few\n          // milliseconds.\n          // https://github.com/StableLib/stablelib/blob/a89a438fcbf855de6b2e9faa2630f03c3f3b3a54/packages/ed25519/ed25519.ts#L669\n          // https://crypto.stackexchange.com/a/54367\n          // https://github.com/libp2p/specs/blob/master/peer-ids/peer-ids.md#ed25519\n          privateKeyHex: bytesToHex(\n            u8a.concat([base64ToBytes(senderSecretEd25519D), base64ToBytes(senderSecretEd25519X)]),\n          ),\n          kms: 'local',\n        },\n        {\n          type: 'X25519',\n          kid: 'did:example:alice#key-x25519-1',\n          publicKeyHex: bytesToHex(base64ToBytes(senderSecretX25519X)),\n          privateKeyHex: bytesToHex(base64ToBytes(senderSecretX25519D)),\n          kms: 'local',\n        },\n      ],\n      provider: 'did:example',\n      alias: 'alice',\n    })\n\n    recipient = await agent.didManagerImport({\n      did: 'did:example:bob',\n      keys: [\n        {\n          type: 'X25519',\n          kid: 'did:example:bob#key-x25519-1',\n          publicKeyHex: bytesToHex(base64ToBytes('GDTrI66K0pFfO54tlCSvfjjNapIs44dzpneBgyx0S3E')),\n          privateKeyHex: bytesToHex(base64ToBytes('b9NnuOCB0hm7YGNvaE9DMhwH_wjZA1-gWD6dA0JWdL0')),\n          kms: 'local',\n        },\n        {\n          type: 'X25519',\n          kid: 'did:example:bob#key-x25519-2',\n          publicKeyHex: bytesToHex(base64ToBytes('UT9S3F5ep16KSNBBShU2wh3qSfqYjlasZimn0mB8_VM')),\n          privateKeyHex: bytesToHex(base64ToBytes('p-vteoF1gopny1HXywt76xz_uC83UUmrgszsI-ThBKk')),\n          kms: 'local',\n        },\n        {\n          type: 'X25519',\n          kid: 'did:example:bob#key-x25519-3',\n          publicKeyHex: bytesToHex(base64ToBytes('82k2BTUiywKv49fKLZa-WwDi8RBf0tB0M8bvSAUQ3yY')),\n          privateKeyHex: bytesToHex(base64ToBytes('f9WJeuQXEItkGM8shN4dqFr5fLQLBasHnWZ-8dPaSo0')),\n          kms: 'local',\n        },\n      ],\n      provider: 'did:example',\n      alias: 'bob',\n    })\n  })\n\n  it('should pack and unpack trust ping message with authcrypt packing', async () => {\n    const packedMessage = await agent.packDIDCommMessage({ message: trustPingMessage, packing: 'authcrypt' })\n    const unpackedMessage = await agent.unpackDIDCommMessage(packedMessage)\n    expect(unpackedMessage.message.id).toEqual(trustPingMessage.id)\n  })\n\n  it('should unpack encrypted message from test vector', async () => {\n    const unpackedMessage = await agent.unpackDIDCommMessage({\n      message:\n        '{\"protected\":\"eyJ0eXAiOiJhcHBsaWNhdGlvbi9kaWRjb21tLWVuY3J5cHRlZCtqc29uIiwic2tpZCI6ImRpZDpleGFtcGxlOmFsaWNlI2tleS14MjU1MTktMSIsImVuYyI6IlhDMjBQIn0\",\"iv\":\"VfXAqOwRdCqkCOXtCZmM7xRY6b2cTT5K\",\"ciphertext\":\"_urtE_Pqw8rGEVkR4iKZiR9qs7U7CCiY5T5sujlSwJnI9V6l4MqXAkfQ_EmSS0bKqrpvB1kXT0vgQQUEfwUeqkXBGiNqd-lBopM1zbaUFIr8x7AobjiVlhDkoA0KVQqICuTUhmt3po5h3wTfNZtB1wiQPF3cYeXg9y6sUVAQ7DyAJdItFcYKiboB3b15nIIP1ld6Bb9r50KD3Gm_DQ\",\"tag\":\"oq6URRWgtmXePhwQXLeZow\",\"recipients\":[{\"encrypted_key\":\"iI92IB_c6z-z9OKbK6GMS54uPJrGefJ9BY5papAvc00\",\"header\":{\"alg\":\"ECDH-1PU+XC20PKW\",\"iv\":\"04K4bQO4q0-x3oiSwvx1vjfIo7DEggyl\",\"tag\":\"q5DzsirJ4Qrnqr0zosx-sg\",\"epk\":{\"kty\":\"OKP\",\"crv\":\"X25519\",\"x\":\"KqNpwX_5bvCFMpMwB-ww1z8mJB7jq8Sy1jSbQPHqHxA\"},\"kid\":\"did:example:bob#key-x25519-1\"}},{\"encrypted_key\":\"Z8mGUR1Q-UIOts1LxIhZNIzbcyp5vj_8ZTWuJ6CxWJE\",\"header\":{\"alg\":\"ECDH-1PU+XC20PKW\",\"iv\":\"g1LwvctMeKDtEcJKQGepuevJnho9WdnX\",\"tag\":\"up_m3F6B-8RAWvlNEhD4Cg\",\"epk\":{\"kty\":\"OKP\",\"crv\":\"X25519\",\"x\":\"11cPGXIykWfZBVyCIcn7CisnxXgIS988MtHYD9d3HlM\"},\"kid\":\"did:example:bob#key-x25519-2\"}},{\"encrypted_key\":\"CsnDZ8TEfeIa5Tu7XqYdxx3r5SnzQDssvhTcmkvzA8g\",\"header\":{\"alg\":\"ECDH-1PU+XC20PKW\",\"iv\":\"-2i2CV7T5ylzk7TLK81lKO1xlvRefIMW\",\"tag\":\"RtaehpY4C6HxXSuy-PSd6w\",\"epk\":{\"kty\":\"OKP\",\"crv\":\"X25519\",\"x\":\"nH9Pdu9RCm8znYmhCtGp9hPR_VuS6kcf5zJndTYBVzI\"},\"kid\":\"did:example:bob#key-x25519-3\"}}]}',\n    })\n    expect(unpackedMessage.message.id).toEqual(trustPingMessage.id)\n  })\n\n  it('should pack and unpack trust ping message with anoncrypt packing', async () => {\n    const packedMessage = await agent.packDIDCommMessage({ message: trustPingMessage, packing: 'anoncrypt' })\n    const unpackedMessage = await agent.unpackDIDCommMessage(packedMessage)\n    expect(unpackedMessage.message.id).toEqual(trustPingMessage.id)\n  })\n\n  it('should unpack encrypted message from test vector', async () => {\n    const unpackedMessage = await agent.unpackDIDCommMessage({\n      message:\n        '{\"protected\":\"eyJ0eXAiOiJhcHBsaWNhdGlvbi9kaWRjb21tLWVuY3J5cHRlZCtqc29uIiwic2tpZCI6ImRpZDpleGFtcGxlOmFsaWNlI2tleS14MjU1MTktMSIsImVuYyI6IlhDMjBQIn0\",\"iv\":\"8e7Q16uLi4YL7VCEw2E2B9vlC9O7IVn4\",\"ciphertext\":\"aE0DnTMiiPVxo0WaUNqma4qXnTzPojXnJOkv2vvJ36hoXc5gf5kyCXV8JGVmuR0ib62bZt8RhZCzt-2dmyJc9qot2oz7VesSfrxNOFb1-LB4Tfp2d1KVi96wCeQ_Ca5gr5RPRiQIBuoHHQsuZ2P1_9o49txTlt1AlCS4GwY4QCTnLVNyQTfDweQLwp-OJTMlDoKKgHzBljfovHv4yQ\",\"tag\":\"ZeItOIGZS3-NvGMbDDKu3w\",\"recipients\":[{\"encrypted_key\":\"wDMR_DerdPHrua7edijfseiVsTXKkHXou-U3y_XH2VE\",\"header\":{\"alg\":\"ECDH-1PU+XC20PKW\",\"iv\":\"K8twVbKqWnmISiiwnrCK8308vy0g0By9\",\"tag\":\"fcgKH3VwAjpSnz-T0UP4bw\",\"epk\":{\"kty\":\"OKP\",\"crv\":\"X25519\",\"x\":\"zN8qTfSPmxA_OwTnK-JOmVrpwvPTlhFuOXm9qlFsozc\"},\"kid\":\"did:example:bob#key-x25519-1\"}},{\"encrypted_key\":\"eEJ62Naux0w2xUz-5u2aA-Bt4mcxyeZDOUJS16PxUj8\",\"header\":{\"alg\":\"ECDH-1PU+XC20PKW\",\"iv\":\"uvkmZEbeJ-ThAYTcZHIdSW1O4diVWgTM\",\"tag\":\"PKxx4DWaPAzWBW_pizYckw\",\"epk\":{\"kty\":\"OKP\",\"crv\":\"X25519\",\"x\":\"90TtJUXASLgYRUctFByDBUNULqsB47W0-QisRdiDOhg\"},\"kid\":\"did:example:bob#key-x25519-2\"}},{\"encrypted_key\":\"GEYY8xb9e07x7mmJGrPAJssoZayTBUgDrF9RO2FWHEE\",\"header\":{\"alg\":\"ECDH-1PU+XC20PKW\",\"iv\":\"rp9Oi7vEkD0gJjPe3LMU_IR1Yq5_2umv\",\"tag\":\"zvFBqklSbyRP4Lsp_eyQEg\",\"epk\":{\"kty\":\"OKP\",\"crv\":\"X25519\",\"x\":\"R9AkOBdF4nN489pQgqI_NstsdrSpnNsGGEgjgNhdeE8\"},\"kid\":\"did:example:bob#key-x25519-3\"}}]}',\n    })\n    expect(unpackedMessage.message.id).toEqual(trustPingMessage.id)\n  })\n})\n"
  },
  {
    "path": "packages/did-comm/src/__tests__/trust-ping-message-handler.test.ts",
    "content": "import { DIDComm } from '../didcomm.js'\nimport {\n  IDIDManager,\n  IEventListener,\n  IIdentifier,\n  IKeyManager,\n  IMessageHandler,\n  IResolver,\n  TAgent,\n} from '../../../core-types/src'\nimport { createAgent } from '../../../core/src'\nimport { DIDManager, MemoryDIDStore } from '../../../did-manager/src'\nimport { KeyManager, MemoryKeyStore, MemoryPrivateKeyStore } from '../../../key-manager/src'\nimport { KeyManagementSystem } from '../../../kms-local/src'\nimport { DIDResolverPlugin } from '../../../did-resolver/src'\nimport { Resolver } from 'did-resolver'\nimport { DIDCommHttpTransport } from '../transports/transports.js'\nimport { IDIDComm } from '../types/IDIDComm.js'\nimport { MessageHandler } from '../../../message-handler/src'\nimport { createTrustPingMessage, TrustPingMessageHandler } from '../protocols/trust-ping-message-handler.js'\nimport { FakeDidProvider, FakeDidResolver } from '../../../test-utils/src'\nimport { MessagingRouter, RequestWithAgentRouter } from '../../../remote-server/src'\nimport { Entities, IDataStore, MetaData, migrations } from '../../../data-store/src'\n// @ts-ignore\nimport express from 'express'\nimport { Server } from 'http'\nimport { DIDCommMessageHandler } from '../message-handler.js'\nimport { DataStore, DataStoreORM } from '../../../data-store/src'\nimport { DataSource } from 'typeorm'\n\nimport { jest } from '@jest/globals'\nimport 'cross-fetch/polyfill'\nimport { asArray } from '../../../utils/src'\n\nconst DIDCommEventSniffer: IEventListener = {\n  eventTypes: ['DIDCommV2Message-sent', 'DIDCommV2Message-received'],\n  onEvent: jest.fn(() => Promise.resolve()),\n}\n\n\ndescribe('trust-ping-message-handler', () => {\n  let sender: IIdentifier\n  let recipient: IIdentifier\n  let agent: TAgent<IResolver & IKeyManager & IDIDManager & IDIDComm & IMessageHandler & IDataStore>\n  let didCommEndpointServer: Server\n  let listeningPort = Math.round(Math.random() * 32000 + 2048)\n  // eslint-disable-next-line @typescript-eslint/no-explicit-any\n  let dbConnection: any // typeorm types don't seem to follow semantic release patterns leading to type errors\n\n  beforeAll(async () => {\n    dbConnection = new DataSource({\n      name: 'test',\n      type: 'sqlite',\n      database: ':memory:',\n      synchronize: false,\n      migrations: migrations,\n      migrationsRun: true,\n      logging: false,\n      entities: Entities,\n    })\n    agent = createAgent<IResolver & IKeyManager & IDIDManager & IDIDComm & IMessageHandler & IDataStore>({\n      plugins: [\n        new KeyManager({\n          store: new MemoryKeyStore(),\n          kms: {\n            // @ts-ignore\n            local: new KeyManagementSystem(new MemoryPrivateKeyStore()),\n          },\n        }),\n        new DIDManager({\n          providers: {\n            'did:fake': new FakeDidProvider(),\n            // 'did:web': new WebDIDProvider({ defaultKms: 'local' })\n          },\n          store: new MemoryDIDStore(),\n          defaultProvider: 'did:fake',\n        }),\n        new DIDResolverPlugin({\n          resolver: new Resolver({\n            ...new FakeDidResolver(() => agent).getDidFakeResolver(),\n          }),\n        }),\n        new DIDComm({ transports: [new DIDCommHttpTransport()]}),\n        new MessageHandler({\n          messageHandlers: [\n            // @ts-ignore\n            new DIDCommMessageHandler(),\n            // @ts-ignore\n            new TrustPingMessageHandler(),\n          ],\n        }),\n        new DataStore(dbConnection),\n        new DataStoreORM(dbConnection),\n        DIDCommEventSniffer,\n      ],\n    })\n\n    sender = await agent.didManagerImport({\n      did: 'did:fake:z6MkgbqNU4uF9NKSz5BqJQ4XKVHuQZYcUZP8pXGsJC8nTHwo',\n      keys: [\n        {\n          type: 'Ed25519',\n          kid: 'didcomm-senderKey-1',\n          publicKeyHex: '1fe9b397c196ab33549041b29cf93be29b9f2bdd27322f05844112fad97ff92a',\n          privateKeyHex:\n            'b57103882f7c66512dc96777cbafbeb2d48eca1e7a867f5a17a84e9a6740f7dc1fe9b397c196ab33549041b29cf93be29b9f2bdd27322f05844112fad97ff92a',\n          kms: 'local',\n        },\n      ],\n      services: [\n        {\n          id: 'msg1',\n          type: 'DIDCommMessaging',\n          serviceEndpoint: `http://localhost:${listeningPort}/messaging`,\n        },\n      ],\n      provider: 'did:fake',\n      alias: 'sender',\n    })\n\n    recipient = await agent.didManagerImport({\n      did: 'did:fake:z6MkrPhffVLBZpxH7xvKNyD4sRVZeZsNTWJkLdHdgWbfgNu3',\n      keys: [\n        {\n          type: 'Ed25519',\n          kid: 'didcomm-receiverKey-1',\n          publicKeyHex: 'b162e405b6485eff8a57932429b192ec4de13c06813e9028a7cdadf0e2703636',\n          privateKeyHex:\n            '19ed9b6949cfd0f9a57e30f0927839a985fa699491886ebcdda6a954d869732ab162e405b6485eff8a57932429b192ec4de13c06813e9028a7cdadf0e2703636',\n          kms: 'local',\n        },\n      ],\n      services: [\n        {\n          id: 'msg2',\n          type: 'DIDCommMessaging',\n          serviceEndpoint: `http://localhost:${listeningPort}/messaging`,\n        },\n      ],\n      provider: 'did:fake',\n      alias: 'receiver',\n    })\n    // console.log('sender: ', sender)\n    // console.log('recipient: ', recipient)\n\n    const requestWithAgent = RequestWithAgentRouter({ agent })\n\n    await new Promise((resolve) => {\n      //setup a server to receive HTTP messages and forward them to this agent to be processed as DIDComm messages\n      const app = express()\n      // app.use(requestWithAgent)\n      app.use(\n        '/messaging',\n        requestWithAgent,\n        MessagingRouter({\n          metaData: { type: 'DIDComm', value: 'integration test' },\n        }),\n      )\n      didCommEndpointServer = app.listen(listeningPort, () => {\n        resolve(true)\n      })\n    })\n  })\n\n  afterAll(async () => {\n    try {\n      await new Promise((resolve) => didCommEndpointServer?.close(resolve))\n    } catch (e: any) {\n      // nop\n    }\n    try {\n      dbConnection?.destroy()\n    } catch (e: any) {\n      // nop\n    }\n  })\n\n  const expectResponse = (tpid: string) => {\n    // recipient sends response\n    expect(DIDCommEventSniffer.onEvent).toHaveBeenCalledWith(\n      {\n        data: `${tpid}-response`,\n        type: 'DIDCommV2Message-sent',\n      },\n      expect.anything(),\n    )\n\n    // original sender receives response\n    expect(DIDCommEventSniffer.onEvent).toHaveBeenCalledWith(\n      {\n        data: {\n          message: {\n            body: {},\n            from: recipient.did,\n            id: `${tpid}-response`,\n            thid: tpid,\n            to: [sender.did],\n            type: 'https://didcomm.org/trust-ping/2.0/ping-response',\n          },\n          metaData: { packing: 'authcrypt' },\n        },\n        type: 'DIDCommV2Message-received',\n      },\n      expect.anything(),\n    )\n  }\n\n  const expectPing = (tpid: string, packing: string) => {\n    // recipient sends response\n    expect(DIDCommEventSniffer.onEvent).toHaveBeenCalledWith(\n      {\n        data: `${tpid}`,\n        type: 'DIDCommV2Message-sent',\n      },\n      expect.anything(),\n    )\n\n    // original sender receives response\n    expect(DIDCommEventSniffer.onEvent).toHaveBeenCalledWith(\n      {\n        data: {\n          message: {\n            body: {\n              responseRequested: true,\n            },\n            from: sender.did,\n            id: `${tpid}`,\n            to: [recipient.did],\n            type: 'https://didcomm.org/trust-ping/2.0/ping',\n          },\n          metaData: { packing },\n        },\n        type: 'DIDCommV2Message-received',\n      },\n      expect.anything(),\n    )\n  }\n\n  // this test should cover message handler directly without any DIDCommMessageHandler 'pre-processing'\n  it('should handle trust ping message directly', async () => {\n    const trustPingMessage = createTrustPingMessage(sender.did, recipient.did)\n    const {to, ...messageContent} = trustPingMessage\n    const tpid = trustPingMessage.id\n    let metaData: MetaData[] = []\n    await new TrustPingMessageHandler().handle(\n      {\n        ...messageContent,\n        to: asArray(to)[0],\n        isValid: () => true,\n        addMetaData: (meta) => {\n          metaData.push(meta)\n        },\n        getLastMetaData: () => {\n          return { type: 'fake', value: 'fake' }\n        },\n      },\n      { agent },\n    )\n    expectResponse(tpid)\n    expect(DIDCommEventSniffer.onEvent).toHaveBeenCalledTimes(2)\n  })\n\n  it('should pack and unpack trust ping message with none packing', async () => {\n    const trustPingMessage = createTrustPingMessage(sender.did, recipient.did)\n    const packedMessage = await agent.packDIDCommMessage({ message: trustPingMessage, packing: 'none' })\n    const unpackedMessage = await agent.unpackDIDCommMessage(packedMessage)\n    expect(unpackedMessage.message.id).toEqual(trustPingMessage.id)\n  })\n\n  it('should pack and unpack trust ping message with authcrypt packing', async () => {\n    const trustPingMessage = createTrustPingMessage(sender.did, recipient.did)\n    const packedMessage = await agent.packDIDCommMessage({ message: trustPingMessage, packing: 'authcrypt' })\n    const unpackedMessage = await agent.unpackDIDCommMessage(packedMessage)\n    expect(unpackedMessage.message.id).toEqual(trustPingMessage.id)\n  })\n\n  it('should handle packed (with authcrypt) trust ping message directly', async () => {\n    const trustPingMessage = createTrustPingMessage(sender.did, recipient.did)\n    const packedMessage = await agent.packDIDCommMessage({ message: trustPingMessage, packing: 'authcrypt' })\n    const tpid = trustPingMessage.id\n    await agent.handleMessage({ raw: packedMessage.message })\n\n    expectResponse(tpid)\n  })\n\n  it('should handle none-packed trust ping message sent via didcomm', async () => {\n    const trustPingMessage = createTrustPingMessage(sender.did, recipient.did)\n    const packedMessage = await agent.packDIDCommMessage({ packing: 'none', message: trustPingMessage })\n    const tpid = trustPingMessage.id\n    await agent.sendDIDCommMessage({\n      messageId: trustPingMessage.id,\n      packedMessage,\n      recipientDidUrl: recipient.did,\n    })\n\n    // recipient sends response\n    expect(DIDCommEventSniffer.onEvent).toHaveBeenCalledWith(\n      {\n        data: `${tpid}`,\n        type: 'DIDCommV2Message-sent',\n      },\n      expect.anything(),\n    )\n\n    // original sender receives response\n    expect(DIDCommEventSniffer.onEvent).toHaveBeenCalledWith(\n      {\n        data: {\n          message: {\n            body: {\n              responseRequested: true,\n            },\n            from: sender.did,\n            id: `${tpid}`,\n            to: [recipient.did],\n            type: 'https://didcomm.org/trust-ping/2.0/ping',\n            typ: 'application/didcomm-plain+json',\n          },\n          metaData: { packing: 'none' },\n        },\n        type: 'DIDCommV2Message-received',\n      },\n      expect.anything(),\n    )\n  })\n\n  it('should handle authcrypt-packed trust ping message sent via didcomm', async () => {\n    const trustPingMessage = createTrustPingMessage(sender.did, recipient.did)\n    const tpid = trustPingMessage.id\n    const packedMessage = await agent.packDIDCommMessage({ packing: 'authcrypt', message: trustPingMessage })\n    await agent.sendDIDCommMessage({\n      messageId: trustPingMessage.id,\n      packedMessage,\n      recipientDidUrl: recipient.did,\n    })\n\n    expectPing(tpid, 'authcrypt')\n    expectResponse(tpid)\n  })\n})\n"
  },
  {
    "path": "packages/did-comm/src/didcomm.ts",
    "content": "import type {\n  IAgentContext,\n  IAgentPlugin,\n  IDIDManager,\n  IIdentifier,\n  IKeyManager,\n  IMessage,\n  IMessageHandler,\n  IResolver,\n} from '@veramo/core-types'\nimport {\n  createJWE,\n  type Decrypter,\n  decryptJWE,\n  type ECDH,\n  type Encrypter,\n  type JWE,\n  verifyJWS,\n} from 'did-jwt'\nimport {\n  type DIDDocument,\n  type DIDResolutionOptions,\n  parse as parseDidUrl,\n  type Service,\n  type ServiceEndpoint,\n  type VerificationMethod,\n} from 'did-resolver'\nimport {\n  a256cbcHs512AnonDecrypterX25519WithA256KW,\n  a256cbcHs512AnonEncrypterX25519WithA256KW,\n  a256cbcHs512AuthDecrypterX25519WithA256KW,\n  a256cbcHs512AuthEncrypterX25519WithA256KW,\n  a256gcmAnonDecrypterX25519WithA256KW,\n  a256gcmAnonEncrypterX25519WithA256KW,\n  a256gcmAuthDecrypterEcdh1PuV3x25519WithA256KW,\n  a256gcmAuthEncrypterEcdh1PuV3x25519WithA256KW,\n  xc20pAnonDecrypterX25519WithA256KW,\n  xc20pAnonEncrypterX25519WithA256KW,\n  xc20pAuthDecrypterEcdh1PuV3x25519WithA256KW,\n  xc20pAuthEncrypterEcdh1PuV3x25519WithA256KW,\n} from './encryption/a256kw-encrypters.js'\n\nimport {\n  a256cbcHs512AnonDecrypterX25519WithXC20PKW,\n  a256cbcHs512AnonEncrypterX25519WithXC20PKW,\n  a256cbcHs512AuthDecrypterX25519WithXC20PKW,\n  a256cbcHs512AuthEncrypterX25519WithXC20PKW,\n  a256gcmAnonDecrypterX25519WithXC20PKW,\n  a256gcmAnonEncrypterX25519WithXC20PKW,\n  a256gcmAuthDecrypterEcdh1PuV3x25519WithXC20PKW,\n  a256gcmAuthEncrypterEcdh1PuV3x25519WithXC20PKW,\n  xc20pAnonDecrypterX25519WithXC20PKW,\n  xc20pAnonEncrypterX25519WithXC20PKW,\n  xc20pAuthDecrypterEcdh1PuV3x25519WithXC20PKW,\n  xc20pAuthEncrypterEcdh1PuV3x25519WithXC20PKW,\n} from './encryption/xc20pkw-encrypters.js'\n\nimport { schema } from './plugin.schema.js'\n\nimport { v4 as uuidv4 } from 'uuid'\n\nimport {\n  createEcdhWrapper,\n  extractManagedRecipients,\n  extractSenderEncryptionKey,\n  mapRecipientsToLocalKeys,\n} from './utils.js'\n\nimport {\n  _ExtendedIKey,\n  _NormalizedVerificationMethod,\n  asArray,\n  bytesToUtf8String,\n  decodeJoseBlob,\n  dereferenceDidKeys,\n  encodeJoseBlob,\n  extractPublicKeyHex,\n  hexToBytes,\n  isDefined,\n  mapIdentifierKeysToDoc,\n  resolveDidOrThrow,\n  stringToUtf8Bytes,\n} from '@veramo/utils'\n\nimport Debug from 'debug'\nimport {\n  IDIDComm,\n  IPackDIDCommMessageArgs,\n  ISendDIDCommMessageArgs,\n  ISendDIDCommMessageResponse,\n  IUnpackDIDCommMessageArgs,\n} from './types/IDIDComm.js'\nimport { DIDCommHttpTransport, IDIDCommTransport } from './transports/transports.js'\nimport {\n  DIDCommMessageMediaType,\n  IDIDCommMessage,\n  IPackedDIDCommMessage,\n  IUnpackedDIDCommMessage,\n} from './types/message-types.js'\nimport {\n  _DIDCommEncryptedMessage,\n  _DIDCommPlainMessage,\n  _DIDCommSignedMessage,\n  _FlattenedJWS,\n  _GenericJWS,\n} from './types/utility-types.js'\n\nconst debug = Debug('veramo:did-comm:action-handler')\n\n/**\n * @deprecated Please use {@link IDIDComm.sendDIDCommMessage} instead. This will be removed in Veramo 4.0.\n * Input arguments for {@link IDIDComm.sendMessageDIDCommAlpha1}\n *\n * @beta This API may change without a BREAKING CHANGE notice.\n */\nexport interface ISendMessageDIDCommAlpha1Args {\n  url?: string\n  save?: boolean\n  data: {\n    id?: string\n    from: string\n    to: string\n    type: string\n    body: object | string\n  }\n  headers?: Record<string, string>\n}\n\n/**\n * The config for the {@link DIDComm} DIDComm plugin.\n *\n * @beta This API may change without a BREAKING CHANGE notice.\n */\nexport interface DIDCommConfig<T extends IDIDCommTransport = DIDCommHttpTransport> {\n  transports?: T[]\n}\n\n/**\n * DID Comm plugin for {@link @veramo/core#Agent}\n *\n * This plugin provides a method of creating an encrypted message according to the initial\n * {@link https://github.com/decentralized-identifier/DIDComm-js | DIDComm-js} implementation.\n *\n * @remarks Be advised that this spec is still not final and that this protocol may need to change.\n *\n * @beta This API may change without a BREAKING CHANGE notice.\n */\nexport class DIDComm implements IAgentPlugin {\n  readonly transports: IDIDCommTransport[]\n\n  /** Plugin methods */\n  readonly methods: IDIDComm\n  readonly schema = schema.IDIDComm\n\n  /**\n   * Constructor that takes a list of {@link IDIDCommTransport} objects.\n   * @param transports - A list of {@link IDIDCommTransport} objects. Defaults to\n   *   {@link @veramo/did-comm#DIDCommHttpTransport | DIDCommHttpTransport}\n   */\n  constructor({ transports = [new DIDCommHttpTransport()] }: DIDCommConfig = {}) {\n    this.transports = transports\n    this.methods = {\n      sendMessageDIDCommAlpha1: this.sendMessageDIDCommAlpha1.bind(this),\n      getDIDCommMessageMediaType: this.getDidCommMessageMediaType.bind(this),\n      unpackDIDCommMessage: this.unpackDIDCommMessage.bind(this),\n      packDIDCommMessage: this.packDIDCommMessage.bind(this),\n      sendDIDCommMessage: this.sendDIDCommMessage.bind(this),\n    }\n  }\n\n  /** {@inheritdoc IDIDComm.packDIDCommMessage} */\n  async packDIDCommMessage(\n    args: IPackDIDCommMessageArgs,\n    context: IAgentContext<IDIDManager & IKeyManager & IResolver>,\n  ): Promise<IPackedDIDCommMessage> {\n    switch (args.packing) {\n      case 'authcrypt': // intentionally omitting break\n      case 'anoncrypt':\n        return this.packDIDCommMessageJWE(args, context)\n      case 'none':\n        const message = {\n          ...args.message,\n          typ: DIDCommMessageMediaType.PLAIN,\n        }\n        return { message: JSON.stringify(message) }\n      case 'jws':\n        return this.packDIDCommMessageJWS(args, context)\n      default:\n        throw new Error(`not_implemented: packing messages as ${args.packing} is not supported yet`)\n    }\n  }\n\n  private async packDIDCommMessageJWS(\n    args: IPackDIDCommMessageArgs,\n    context: IAgentContext<IDIDManager & IKeyManager & IResolver>,\n  ): Promise<IPackedDIDCommMessage> {\n    const message = args.message\n    let keyRef: string | undefined = args.keyRef\n    let kid: string\n    // check that the message has from field that is managed\n    let managedSender: IIdentifier | undefined\n    try {\n      managedSender = await context.agent.didManagerGet({ did: message.from || '' })\n    } catch (e) {\n      debug(`message.from(${message.from}) is not managed by this agent`)\n    }\n    if (!message.from || !isDefined(managedSender)) {\n      throw new Error('invalid_argument: `from` field must be a DID managed by this agent')\n    }\n\n    // obtain sender signing key(s) from authentication section\n    const senderKeys = await mapIdentifierKeysToDoc(\n      managedSender,\n      'authentication',\n      context,\n      args.resolutionOptions,\n    )\n    // try to find a managed signing key that matches keyRef\n    let signingKey = null\n    if (isDefined(keyRef)) {\n      signingKey = senderKeys.find((key) => key.kid === keyRef || key.meta.verificationMethod.id === keyRef)\n    }\n    // otherwise use the first available one.\n    signingKey = signingKey ? signingKey : senderKeys[0]\n\n    if (!signingKey) {\n      throw new Error(`key_not_found: could not locate a suitable signing key for ${message.from}`)\n    } else {\n      kid = signingKey.meta.verificationMethod.id\n    }\n    let alg: string\n    if (signingKey.type === 'Ed25519') {\n      alg = 'EdDSA'\n    } else if (signingKey.type === 'Secp256k1') {\n      alg = 'ES256K'\n    } else {\n      throw new Error(\n        `not_supported: key of type ${signingKey.type} is not supported for JWS didcomm message`,\n      )\n    }\n    // construct the protected header with alg, typ and kid\n    const headerObj = { alg, kid, typ: DIDCommMessageMediaType.SIGNED }\n    const header = encodeJoseBlob(headerObj)\n    const payload = encodeJoseBlob(args.message)\n    // construct signing input and obtain signature\n    const signingInput = header + '.' + payload\n    const signature: string = await context.agent.keyManagerSign({\n      data: signingInput,\n      encoding: 'utf-8',\n      keyRef: signingKey.kid,\n      algorithm: alg,\n    })\n    // create flattened JWS\n    const packedMessage = {\n      protected: header,\n      payload,\n      signature,\n    }\n    // serialize flattened JWS JSON and return\n    return { message: JSON.stringify(packedMessage) }\n  }\n\n  private async packDIDCommMessageJWE(\n    args: IPackDIDCommMessageArgs,\n    context: IAgentContext<IDIDManager & IKeyManager & IResolver>,\n  ): Promise<IPackedDIDCommMessage> {\n    // 1. check if args.packing requires authentication and map sender key to skid\n    let senderECDH: ECDH | null = null\n    let keyRef: string | undefined = args.keyRef\n    let protectedHeader: {\n      skid?: string\n      typ: string\n    } = {\n      typ: DIDCommMessageMediaType.ENCRYPTED,\n    }\n    if (args.packing === 'authcrypt') {\n      // TODO: what to do about from_prior?\n      if (!args?.message?.from) {\n        throw new Error(\n          `invalid_argument: cannot create authenticated did-comm message without a 'from' field`,\n        )\n      }\n      //    1.1 check that args.message.from is a managed DID\n      const sender: IIdentifier = await context.agent.didManagerGet({ did: args?.message?.from })\n      //    1.2 match key agreement keys from DID to managed keys\n      const senderKeys: _ExtendedIKey[] = await mapIdentifierKeysToDoc(\n        sender,\n        'keyAgreement',\n        context,\n        args.resolutionOptions,\n      )\n      // try to find a sender key by keyRef, otherwise pick the first one\n      let senderKey\n      if (isDefined(keyRef)) {\n        senderKey = senderKeys.find((key) => key.kid === keyRef || key.meta.verificationMethod.id === keyRef)\n      }\n      senderKey = senderKey || senderKeys[0]\n      //    1.3 use kid from DID doc(skid) + local IKey to bundle a sender key\n      if (senderKey) {\n        senderECDH = createEcdhWrapper(senderKey.kid, context)\n        protectedHeader = { ...protectedHeader, skid: senderKey.meta.verificationMethod.id }\n      } else {\n        throw new Error(`key_not_found: could not map an agent key to an skid for ${args?.message?.from}`)\n      }\n    }\n\n    const defaults = {\n      alg: args.packing === 'authcrypt' ? 'ECDH-1PU+A256KW' : 'ECDH-ES+A256KW',\n      enc: 'A256GCM', // 'XC20P' or 'A256CBC-HS512' can also be specified\n    }\n\n    const options = { ...defaults, ...args.options }\n\n    // 2: compute recipients\n    interface IRecipient {\n      kid: string\n      publicKeyBytes: Uint8Array\n      keyType: string\n    }\n\n    let recipients: IRecipient[] = []\n\n    async function computeRecipients(\n      to: string,\n      resolutionOptions?: DIDResolutionOptions,\n    ): Promise<IRecipient[]> {\n      // 2.1 resolve DID for \"to\"\n      const didDocument: DIDDocument = await resolveDidOrThrow(to, context, resolutionOptions)\n\n      // 2.2 extract all recipient key agreement keys and normalize them\n      const keyAgreementKeys: _NormalizedVerificationMethod[] = (\n        await dereferenceDidKeys(didDocument, 'keyAgreement', context)\n      )\n        .filter((k) => k.publicKeyHex?.length! > 0)\n        .filter((k) => (args.options?.recipientKids ? args.options?.recipientKids.includes(k.id) : true))\n\n      if (keyAgreementKeys.length === 0) {\n        throw new Error(`key_not_found: no key agreement keys found for recipient ${to}`)\n      }\n\n      // 2.3 get public key bytes and key IDs for supported recipient keys\n      const tempRecipients = keyAgreementKeys\n        .map((pk) => {\n          // FIXME: only supporting X25519 keys for now. Add support for P-256 and P-384 & others\n          const { publicKeyHex, keyType } = extractPublicKeyHex(pk, true)\n          if (keyType === 'X25519') {\n            return { kid: pk.id, publicKeyBytes: hexToBytes(publicKeyHex), keyType: pk.type }\n          } else {\n            debug(`not_supported: key agreement key type ${pk.type} is not supported for encryption`)\n            return null\n          }\n        })\n        .filter(isDefined)\n\n      if (tempRecipients.length === 0) {\n        throw new Error(`not_supported: no compatible key agreement keys found for recipient ${to}`)\n      }\n      return tempRecipients\n    }\n\n    const recipientDIDs = asArray(args.message.to).concat(asArray(args.options?.bcc))\n    for (const to of recipientDIDs) {\n      recipients.push(...(await computeRecipients(to)))\n    }\n\n    // 3. create Encrypter for each recipient\n    const encrypters: Encrypter[] = recipients\n      .map((recipient) => {\n        if (options.enc === 'A256GCM') {\n          if (args.packing === 'authcrypt' && (!options.alg || options.alg?.startsWith('ECDH-1PU'))) {\n            if (options.alg?.endsWith('+XC20PKW')) {\n              // FIXME: the didcomm spec actually links to ECDH-1PU(v4)\n              return a256gcmAuthEncrypterEcdh1PuV3x25519WithXC20PKW(\n                recipient.publicKeyBytes,\n                <ECDH>senderECDH,\n                {\n                  kid: recipient.kid,\n                },\n              )\n            } else if (options?.alg?.endsWith('+A256KW')) {\n              // FIXME: the didcomm spec actually links to ECDH-1PU(v4)\n              return a256gcmAuthEncrypterEcdh1PuV3x25519WithA256KW(\n                recipient.publicKeyBytes,\n                <ECDH>senderECDH,\n                {\n                  kid: recipient.kid,\n                },\n              )\n            }\n          } else if (args.packing === 'anoncrypt' && (!options.alg || options.alg?.startsWith('ECDH-ES'))) {\n            if (options.alg?.endsWith('+XC20PKW')) {\n              return a256gcmAnonEncrypterX25519WithXC20PKW(recipient.publicKeyBytes, recipient.kid)\n            } else if (options?.alg?.endsWith('+A256KW')) {\n              return a256gcmAnonEncrypterX25519WithA256KW(recipient.publicKeyBytes, recipient.kid)\n            }\n          }\n        } else if (options.enc === 'A256CBC-HS512') {\n          if (args.packing === 'authcrypt' && (!options.alg || options.alg?.startsWith('ECDH-1PU'))) {\n            if (options.alg?.endsWith('+XC20PKW')) {\n              // FIXME: the didcomm spec actually links to ECDH-1PU(v4)\n              return a256cbcHs512AuthEncrypterX25519WithXC20PKW(recipient.publicKeyBytes, <ECDH>senderECDH, {\n                kid: recipient.kid,\n              })\n            } else if (options?.alg?.endsWith('+A256KW')) {\n              // FIXME: the didcomm spec actually links to ECDH-1PU(v4)\n              return a256cbcHs512AuthEncrypterX25519WithA256KW(recipient.publicKeyBytes, <ECDH>senderECDH, {\n                kid: recipient.kid,\n              })\n            }\n          } else if (args.packing === 'anoncrypt' && (!options.alg || options.alg?.startsWith('ECDH-ES'))) {\n            if (options.alg?.endsWith('+XC20PKW')) {\n              return a256cbcHs512AnonEncrypterX25519WithXC20PKW(recipient.publicKeyBytes, recipient.kid)\n            } else if (options?.alg?.endsWith('+A256KW')) {\n              return a256cbcHs512AnonEncrypterX25519WithA256KW(recipient.publicKeyBytes, recipient.kid)\n            }\n          }\n        } else if (options.enc === 'XC20P') {\n          if (args.packing === 'authcrypt' && (!options.alg || options.alg?.startsWith('ECDH-1PU'))) {\n            if (options.alg?.endsWith('+XC20PKW')) {\n              // FIXME: the didcomm spec actually links to ECDH-1PU(v4)\n              return xc20pAuthEncrypterEcdh1PuV3x25519WithXC20PKW(\n                recipient.publicKeyBytes,\n                <ECDH>senderECDH,\n                { kid: recipient.kid },\n              )\n            } else if (options?.alg?.endsWith('+A256KW')) {\n              // FIXME: the didcomm spec actually links to ECDH-1PU(v4)\n              return xc20pAuthEncrypterEcdh1PuV3x25519WithA256KW(recipient.publicKeyBytes, <ECDH>senderECDH, {\n                kid: recipient.kid,\n              })\n            }\n          } else if (args.packing === 'anoncrypt' && (!options.alg || options.alg?.startsWith('ECDH-ES'))) {\n            if (options.alg?.endsWith('+XC20PKW')) {\n              return xc20pAnonEncrypterX25519WithXC20PKW(recipient.publicKeyBytes, recipient.kid)\n            } else if (options?.alg?.endsWith('+A256KW')) {\n              return xc20pAnonEncrypterX25519WithA256KW(recipient.publicKeyBytes, recipient.kid)\n            }\n          }\n        }\n        debug(\n          `not_supported: could not create suitable ${args.packing} encrypter for recipient ${recipient.kid} with alg=${options.alg}, enc=${options.enc}`,\n        )\n        return null\n      })\n      .filter(isDefined)\n\n    if (encrypters.length === 0) {\n      throw new Error(\n        `not_supported: could not create suitable ${args.packing} encrypter for recipient ${args?.message?.to} with alg=${options.alg}, enc=${options.enc}`,\n      )\n    }\n\n    // 4. createJWE\n    const messageBytes = stringToUtf8Bytes(JSON.stringify(args.message))\n    const jwe = await createJWE(messageBytes, encrypters, protectedHeader, undefined, true)\n    const message = JSON.stringify(jwe)\n    return { message }\n  }\n\n  /** {@inheritdoc IDIDComm.getDIDCommMessageMediaType} */\n  async getDidCommMessageMediaType({ message }: IPackedDIDCommMessage): Promise<DIDCommMessageMediaType> {\n    try {\n      const { mediaType } = this.decodeMessageAndMediaType(message)\n      return mediaType\n    } catch (e) {\n      debug(`Could not parse message as DIDComm v2 message: ${e}`)\n      throw e\n    }\n  }\n\n  /** {@inheritdoc IDIDComm.unpackDIDCommMessage} */\n  async unpackDIDCommMessage(\n    args: IUnpackDIDCommMessageArgs,\n    context: IAgentContext<IDIDManager & IKeyManager & IResolver & IMessageHandler>,\n  ): Promise<IUnpackedDIDCommMessage> {\n    const { msgObj, mediaType } = this.decodeMessageAndMediaType(args.message)\n    if (mediaType === DIDCommMessageMediaType.SIGNED) {\n      return this.unpackDIDCommMessageJWS(msgObj as _DIDCommSignedMessage, context, args.resolutionOptions)\n    } else if (mediaType === DIDCommMessageMediaType.PLAIN) {\n      return { message: <IDIDCommMessage>msgObj, metaData: { packing: 'none' } }\n    } else if (mediaType === DIDCommMessageMediaType.ENCRYPTED) {\n      return this.unpackDIDCommMessageJWE({ jwe: msgObj as JWE }, context, args.resolutionOptions)\n    } else {\n      throw Error('not_supported: ' + mediaType)\n    }\n  }\n\n  private async unpackDIDCommMessageJWS(\n    jws: _DIDCommSignedMessage,\n    context: IAgentContext<IDIDManager & IKeyManager & IResolver>,\n    resolutionOptions?: DIDResolutionOptions,\n  ): Promise<IUnpackedDIDCommMessage> {\n    // TODO: currently only supporting one signature\n    const signatureEncoded: string = isDefined((<_FlattenedJWS>jws).signature)\n      ? (<_FlattenedJWS>jws).signature\n      : (<_GenericJWS>jws).signatures[0]?.signature\n    const headerEncoded = isDefined((<_FlattenedJWS>jws).protected)\n      ? (<_FlattenedJWS>jws).protected\n      : (<_GenericJWS>jws).signatures[0]?.protected\n    if (!isDefined(headerEncoded) || !isDefined(signatureEncoded)) {\n      throw new Error('invalid_argument: could not interpret message as JWS')\n    }\n    const message = <IDIDCommMessage>decodeJoseBlob(jws.payload)\n    const header = decodeJoseBlob(headerEncoded)\n    const sender = parseDidUrl(header.kid)?.did\n    if (!isDefined(sender) || sender !== message.from) {\n      throw new Error('invalid_jws: sender is not a DID or does not match the `kid`')\n    }\n    const senderDoc = await resolveDidOrThrow(sender, context, resolutionOptions)\n    const senderKey = (await context.agent.getDIDComponentById({\n      didDocument: senderDoc,\n      didUrl: header.kid,\n      section: 'authentication',\n    })) as VerificationMethod\n    const verifiedSenderKey = verifyJWS(`${headerEncoded}.${jws.payload}.${signatureEncoded}`, senderKey)\n    if (isDefined(verifiedSenderKey)) {\n      return { message, metaData: { packing: 'jws' } }\n    } else {\n      throw new Error('invalid_jws: sender `kid` could not be validated as the signer of the message')\n    }\n  }\n\n  private async unpackDIDCommMessageJWE(\n    { jwe }: { jwe: JWE },\n    context: IAgentContext<IDIDManager & IKeyManager & IResolver>,\n    resolutionOptions?: DIDResolutionOptions,\n  ): Promise<IUnpackedDIDCommMessage> {\n    // 0 resolve skid to DID doc\n    //   - find skid in DID doc and convert to 'X25519' byte array (if type matches)\n    let senderKeyBytes: Uint8Array | null = await extractSenderEncryptionKey(jwe, context, resolutionOptions)\n\n    // 1. check whether kid is one of my DID URIs\n    //   - get recipient DID URIs\n    //   - extract DIDs from recipient DID URIs\n    //   - match DIDs against locally managed DIDs\n    let managedRecipients = await extractManagedRecipients(jwe, context)\n\n    // 1.5 distribute protected header to each recipient\n    const protectedHeader = decodeJoseBlob(jwe.protected)\n    managedRecipients = managedRecipients.map((mr) => {\n      mr.recipient.header = { ...protectedHeader, ...mr.recipient.header }\n      return mr\n    })\n\n    // 2. get internal IKey instance for each recipient.kid\n    //   - resolve locally managed DIDs that match recipients\n    //   - filter to the keyAgreementKeys that match the recipient.kid\n    //   - match identifier.keys.publicKeyHex to (verificationMethod.publicKey*)\n    //   - return a list of `IKey`\n    const localKeys = await mapRecipientsToLocalKeys(managedRecipients, context, resolutionOptions)\n\n    // 3. for each recipient\n    //  if isAuthcrypted? (if senderKey != null)\n    //   - construct auth decrypter\n    //  else\n    //   - construct anon decrypter\n    for (const localKey of localKeys) {\n      let packing: string = 'anoncrypt'\n      let decrypter: Decrypter | null = null\n      const recipientECDH: ECDH = createEcdhWrapper(localKey.localKeyRef, context)\n      // TODO: here's where more algorithms should be supported\n      if (localKey.recipient?.header?.epk?.crv === 'X25519') {\n        if (localKey.recipient?.header?.enc === 'A256GCM') {\n          if (senderKeyBytes && localKey.recipient?.header?.alg?.includes('ECDH-1PU')) {\n            packing = 'authcrypt'\n            if (localKey.recipient?.header?.alg?.endsWith('+A256KW')) {\n              decrypter = a256gcmAuthDecrypterEcdh1PuV3x25519WithA256KW(recipientECDH, senderKeyBytes)\n            } else if (localKey.recipient?.header?.alg?.endsWith('+XC20PKW')) {\n              decrypter = a256gcmAuthDecrypterEcdh1PuV3x25519WithXC20PKW(recipientECDH, senderKeyBytes)\n            }\n          } else {\n            packing = 'anoncrypt'\n            if (localKey.recipient?.header?.alg?.endsWith('+A256KW')) {\n              decrypter = a256gcmAnonDecrypterX25519WithA256KW(recipientECDH)\n            } else if (localKey.recipient?.header?.alg?.endsWith('+XC20PKW')) {\n              decrypter = a256gcmAnonDecrypterX25519WithXC20PKW(recipientECDH)\n            }\n          }\n        } else if (localKey.recipient?.header?.enc === 'A256CBC-HS512') {\n          if (senderKeyBytes && localKey.recipient?.header?.alg?.includes('ECDH-1PU')) {\n            packing = 'authcrypt'\n            if (localKey.recipient?.header?.alg?.endsWith('+A256KW')) {\n              decrypter = a256cbcHs512AuthDecrypterX25519WithA256KW(recipientECDH, senderKeyBytes)\n            } else if (localKey.recipient?.header?.alg?.endsWith('+XC20PKW')) {\n              decrypter = a256cbcHs512AuthDecrypterX25519WithXC20PKW(recipientECDH, senderKeyBytes)\n            }\n          } else {\n            packing = 'anoncrypt'\n            if (localKey.recipient?.header?.alg?.endsWith('+A256KW')) {\n              decrypter = a256cbcHs512AnonDecrypterX25519WithA256KW(recipientECDH)\n            } else if (localKey.recipient?.header?.alg?.endsWith('+XC20PKW')) {\n              decrypter = a256cbcHs512AnonDecrypterX25519WithXC20PKW(recipientECDH)\n            }\n          }\n        } else if (localKey.recipient?.header?.enc === 'XC20P') {\n          if (senderKeyBytes && localKey.recipient?.header?.alg?.includes('ECDH-1PU')) {\n            packing = 'authcrypt'\n            if (localKey.recipient?.header?.alg?.endsWith('+A256KW')) {\n              decrypter = xc20pAuthDecrypterEcdh1PuV3x25519WithA256KW(recipientECDH, senderKeyBytes)\n            } else if (localKey.recipient?.header?.alg?.endsWith('+XC20PKW')) {\n              decrypter = xc20pAuthDecrypterEcdh1PuV3x25519WithXC20PKW(recipientECDH, senderKeyBytes)\n            }\n          } else {\n            packing = 'anoncrypt'\n            if (localKey.recipient?.header?.alg?.endsWith('+A256KW')) {\n              decrypter = xc20pAnonDecrypterX25519WithA256KW(recipientECDH)\n            } else if (localKey.recipient?.header?.alg?.endsWith('+XC20PKW')) {\n              decrypter = xc20pAnonDecrypterX25519WithXC20PKW(recipientECDH)\n            }\n          }\n        }\n      }\n\n      if (!decrypter) {\n        throw new Error('unable to decrypt DIDComm message with any of the locally managed keys')\n      }\n      // 4. decryptJWE(jwe, decrypter)\n      try {\n        const decryptedBytes = await decryptJWE(jwe, decrypter)\n        const decryptedMsg = bytesToUtf8String(decryptedBytes)\n        const message = JSON.parse(decryptedMsg)\n        return { message, metaData: { packing } } as IUnpackedDIDCommMessage\n      } catch (e) {\n        debug(\n          `unable to decrypt DIDComm msg using ${localKey.localKeyRef} (${localKey.recipient.header.kid})`,\n        )\n      }\n    }\n\n    throw new Error('unable to decrypt DIDComm message with any of the locally managed keys')\n  }\n\n  private decodeMessageAndMediaType(message: string): {\n    msgObj: _DIDCommPlainMessage | _DIDCommSignedMessage | _DIDCommEncryptedMessage\n    mediaType: DIDCommMessageMediaType\n  } {\n    let msgObj\n    if (typeof message === 'string') {\n      try {\n        msgObj = JSON.parse(message)\n      } catch (e) {\n        throw new Error('invalid_argument: unable to parse message as JSON')\n        // TODO: try to interpret as compact serialized JWS / JWM?\n      }\n    } else {\n      msgObj = message\n    }\n    let mediaType: DIDCommMessageMediaType | null = null\n    if ((<_DIDCommPlainMessage>msgObj).typ === DIDCommMessageMediaType.PLAIN) {\n      mediaType = DIDCommMessageMediaType.PLAIN\n    } else if ((<_FlattenedJWS | _DIDCommEncryptedMessage>msgObj).protected) {\n      const protectedHeader = decodeJoseBlob(msgObj.protected)\n      if (protectedHeader.typ === DIDCommMessageMediaType.SIGNED) {\n        mediaType = DIDCommMessageMediaType.SIGNED\n      } else if (protectedHeader.typ === DIDCommMessageMediaType.ENCRYPTED) {\n        mediaType = DIDCommMessageMediaType.ENCRYPTED\n      } else {\n        throw new Error('invalid_argument: unable to determine message type')\n      }\n    } else if ((<_GenericJWS>msgObj).signatures) {\n      mediaType = DIDCommMessageMediaType.SIGNED\n    } else {\n      throw new Error('invalid_argument: unable to determine message type')\n    }\n    return { msgObj, mediaType }\n  }\n\n  private findPreferredDIDCommService(services: Service[]) {\n    // FIXME: TODO: get preferred service endpoint according to configuration; now defaulting to first service\n    return services[0]\n  }\n\n  private async wrapDIDCommForwardMessage(\n    recipientDidUrl: string,\n    messageId: string,\n    packedMessageToForward: IPackedDIDCommMessage,\n    routingKey: string,\n    context: IAgentContext<IDIDManager & IKeyManager & IResolver>,\n  ): Promise<IPackedDIDCommMessage> {\n    const splitKey = routingKey.split('#')\n    const shouldUseSpecificKid = splitKey.length > 1\n    const mediatorDidUrl = splitKey[0]\n    const msgJson = JSON.parse(packedMessageToForward.message)\n    // 1. Create forward message\n    const forwardMessage: IDIDCommMessage = {\n      id: uuidv4(),\n      type: 'https://didcomm.org/routing/2.0/forward',\n      to: [mediatorDidUrl],\n      body: {\n        next: recipientDidUrl,\n      },\n      attachments: [\n        {\n          media_type: msgJson?.typ ?? DIDCommMessageMediaType.ENCRYPTED,\n          data: {\n            json: msgJson,\n          },\n        },\n      ],\n    }\n\n    context.agent.emit('DIDCommV2Message-forwarded', {\n      messageId,\n      next: recipientDidUrl,\n      routingKey: routingKey,\n    })\n\n    // 2. Pack message for routingKey with anoncrypt\n    if (shouldUseSpecificKid) {\n      return this.packDIDCommMessageJWE(\n        { message: forwardMessage, packing: 'anoncrypt', options: { recipientKids: [routingKey] } },\n        context,\n      )\n    } else {\n      return this.packDIDCommMessageJWE({ message: forwardMessage, packing: 'anoncrypt' }, context)\n    }\n  }\n\n  /** {@inheritdoc IDIDComm.sendDIDCommMessage} */\n  async sendDIDCommMessage(\n    args: ISendDIDCommMessageArgs,\n    context: IAgentContext<IDIDManager & IKeyManager & IResolver & IMessageHandler>,\n  ): Promise<ISendDIDCommMessageResponse> {\n    const { packedMessage, returnTransportId, recipientDidUrl, messageId } = args\n\n    if (returnTransportId) {\n      // FIXME: TODO: check if previous message was ok with reusing transport?\n      // if so, retrieve transport from transport manager\n      //transport = this.findDIDCommTransport(returnTransportId)\n      throw new Error(`not_supported: return routes not supported yet`)\n    }\n\n    const didDoc = await resolveDidOrThrow(recipientDidUrl, context, args.resolutionOptions)\n\n    function processServiceObject(service: Service) {\n      if (service.type === 'DIDCommMessaging') {\n        return service\n      } else if (service.t === 'dm') {\n        return {\n          type: 'DIDCommMessaging',\n          serviceEndpoint: service.s,\n          accept: service.a,\n          routingKeys: service.r,\n          id: `#dm+` + (service.id ?? service.s),\n        } as Service\n      }\n    }\n\n    // FIXME: only send the message if the service section either explicitly supports `didcomm/v2`, or no\n    // `accept` property is present.\n\n    const services = (didDoc.service || [])\n      ?.map((service: any) => {\n        if (Array.isArray(service)) {\n          // This is a workaround for some malformed DID documents that bundle multiple service entries into an array\n          return service.map((s) => {\n            if (typeof s === 'object') {\n              return processServiceObject(s)\n            }\n          })\n        } else {\n          return processServiceObject(service)\n        }\n      })\n      .flat()\n      .filter(isDefined)\n\n    if (!services || services.length === 0) {\n      throw new Error(\n        `not_found: could not find DIDComm Messaging service in DID document for '${recipientDidUrl}'`,\n      )\n    }\n\n    // spray all endpoints and transports that match and gather results\n    // TODO: investigate if we should queue the requests and stop when the first transport succeeds\n    const results: (ISendDIDCommMessageResponse | Error)[] = []\n\n    for (const service of services) {\n      // serviceEndpoint can be a string, a ServiceEndpoint object, or an array of strings or ServiceEndpoint objects\n      let routingKeys: string[] = []\n      let serviceEndpointUrl = ''\n      if (typeof service.serviceEndpoint === 'string') {\n        serviceEndpointUrl = service.serviceEndpoint\n      } else if ((service.serviceEndpoint as any).uri) {\n        serviceEndpointUrl = (service.serviceEndpoint as any).uri\n      } else if (Array.isArray(service.serviceEndpoint) && service.serviceEndpoint.length > 0) {\n        if (typeof service.serviceEndpoint[0] === 'string') {\n          serviceEndpointUrl = service.serviceEndpoint[0]\n        } else if (service.serviceEndpoint[0].uri) {\n          serviceEndpointUrl = service.serviceEndpoint[0].uri\n        }\n      }\n\n      if (typeof service.serviceEndpoint !== 'string') {\n        if (\n          Array.isArray(service.serviceEndpoint) &&\n          service.serviceEndpoint.length > 0 &&\n          service.serviceEndpoint[0].routingKeys\n        ) {\n          routingKeys = service.serviceEndpoint[0].routingKeys\n        } else if ((service.serviceEndpoint as any).routingKeys) {\n          routingKeys = (<Exclude<ServiceEndpoint, string>>service.serviceEndpoint).routingKeys\n        }\n      }\n\n      if (routingKeys.length > 0) {\n        // routingKeys found, wrap forward messages\n        let wrappedMessage: IPackedDIDCommMessage = packedMessage\n        for (let i = routingKeys.length - 1; i >= 0; i--) {\n          const recipient = i >= routingKeys.length - 1 ? recipientDidUrl : routingKeys[i + 1].split('#')[0]\n          wrappedMessage = await this.wrapDIDCommForwardMessage(\n            recipient,\n            messageId,\n            wrappedMessage,\n            routingKeys[i],\n            context,\n          )\n        }\n        packedMessage.message = wrappedMessage.message\n      }\n\n      const isServiceEndpointDid = serviceEndpointUrl.startsWith('did:')\n\n      if (isServiceEndpointDid) {\n        // Final wrapping and send to mediator DID\n        const recipient =\n          routingKeys.length > 0 ? routingKeys[routingKeys.length - 1].split('#')[0] : recipientDidUrl\n        const wrappedMessage = await this.wrapDIDCommForwardMessage(\n          recipient,\n          messageId,\n          packedMessage,\n          serviceEndpointUrl,\n          context,\n        )\n        try {\n          results.push(\n            await this.sendDIDCommMessage(\n              { packedMessage: wrappedMessage, recipientDidUrl: serviceEndpointUrl, messageId },\n              context,\n            ),\n          )\n        } catch (e: any) {\n          debug(e)\n          results.push(e)\n        }\n      }\n\n      const transports = this.transports.filter(\n        (t) => t.isServiceSupported(service) && (!returnTransportId || t.id === returnTransportId),\n      )\n      if (!transports || transports.length < 1) {\n        const err = new Error('not_found: no transport type found for service: ' + JSON.stringify(service))\n        debug(err)\n        results.push(err)\n      }\n\n      for (const transport of transports) {\n        let response\n        try {\n          response = await transport.send(service, packedMessage.message)\n          if (response.error) {\n            const err = new Error(\n              `Error when sending DIDComm message through transport with id: '${transport.id}': ${response.error}`,\n            )\n            debug(err)\n            results.push(err)\n          } else {\n            results.push({\n              transportId: transport.id,\n              returnMessage: response.returnMessage\n                ? {\n                    id: '',\n                    type: 'unprocessed',\n                    raw: response.returnMessage,\n                  }\n                : undefined,\n            })\n          }\n        } catch (e) {\n          const err = new Error(\n            `Cannot send DIDComm message through transport with id: '${transport.id}': ${e}`,\n          )\n          debug(err)\n          results.push(err)\n        }\n      }\n    }\n\n    const successful: ISendDIDCommMessageResponse[] = results.filter(\n      (r) => !(r instanceof Error),\n    ) as ISendDIDCommMessageResponse[]\n\n    if (successful.length > 0) {\n      context.agent.emit('DIDCommV2Message-sent', messageId)\n      for (const response of successful) {\n        if (response.returnMessage) {\n          const returnMessage = await context.agent.handleMessage({\n            raw: response.returnMessage.raw ?? '',\n          })\n          return { transportId: response.transportId, returnMessage }\n        }\n      }\n      return successful[0]\n    } else {\n      const errors = results.filter((r) => r instanceof Error) as Error[]\n      const err = new Error('Could not send DIDComm message using any of the attepmpted transports')\n      err.cause = new AggregateError(errors)\n      throw err\n    }\n  }\n\n  /** {@inheritdoc IDIDComm.sendMessageDIDCommAlpha1} */\n  async sendMessageDIDCommAlpha1(\n    args: ISendMessageDIDCommAlpha1Args,\n    context: IAgentContext<IDIDManager & IKeyManager & IResolver & IMessageHandler>,\n  ): Promise<IMessage> {\n    const { data, url, headers, save = true } = args\n\n    debug('Resolving didDoc')\n    const didDoc = (await context.agent.resolveDid({ didUrl: data.to })).didDocument\n    let serviceEndpoint\n    if (url) {\n      serviceEndpoint = url\n    } else {\n      const service = didDoc && didDoc.service && didDoc.service.find((item) => item.type == 'Messaging')\n      serviceEndpoint = service?.serviceEndpoint\n    }\n\n    if (serviceEndpoint) {\n      try {\n        data.id = data.id || uuidv4()\n        let postPayload = JSON.stringify(data)\n        try {\n          const identifier = await context.agent.didManagerGet({ did: data.from })\n          const key = identifier.keys.find((k) => k.type === 'Ed25519')\n          if (!key) throw Error('No encryption key')\n          const publicKey = didDoc?.publicKey?.find((item) => item.type == 'Ed25519VerificationKey2018')\n          if (!publicKey?.publicKeyHex) throw Error('Recipient does not have encryption publicKey')\n\n          postPayload = await context.agent.keyManagerEncryptJWE({\n            kid: key.kid,\n            to: {\n              type: 'Ed25519',\n              publicKeyHex: publicKey?.publicKeyHex,\n              kid: publicKey?.publicKeyHex,\n            },\n            data: postPayload,\n          })\n\n          debug('Encrypted:', postPayload)\n        } catch (e) {}\n\n        debug('Sending to %s', serviceEndpoint)\n        const endpointUri =\n          typeof serviceEndpoint === 'string'\n            ? serviceEndpoint\n            : (<Exclude<ServiceEndpoint, string>>serviceEndpoint).uri ?? ''\n\n        const res = await fetch(endpointUri, {\n          method: 'POST',\n          body: postPayload,\n          headers,\n        })\n        debug('Status', res.status, res.statusText)\n\n        if (res.status == 200) {\n          return await context.agent.handleMessage({\n            raw: JSON.stringify(data),\n            metaData: [{ type: 'DIDComm-sent' }],\n            save,\n          })\n        }\n\n        return Promise.reject(new Error('Message not sent'))\n      } catch (e) {\n        return Promise.reject(e)\n      }\n    } else {\n      debug('No Messaging service in didDoc')\n      return Promise.reject(new Error('No service endpoint'))\n    }\n  }\n}\n"
  },
  {
    "path": "packages/did-comm/src/encryption/a256cbc-hs512-dir.ts",
    "content": "import { randomBytes } from '@noble/hashes/utils'\nimport { hmac } from '@noble/hashes/hmac'\nimport { sha512 } from '@noble/hashes/sha512'\nimport { cbc } from '@noble/ciphers/aes'\nimport { base64ToBytes, bytesToBase64url, concat, encodeBase64url } from '@veramo/utils'\nimport { Decrypter, Encrypter, EncryptionResult, ProtectedHeader } from 'did-jwt'\nimport { fromString } from 'uint8arrays/from-string'\n\nconst MAX_INT32 = 2 ** 32\n\nfunction writeUInt32BE(buf: Uint8Array, value: number, offset?: number) {\n  if (value < 0 || value >= MAX_INT32) {\n    throw new RangeError(`value must be >= 0 and <= ${MAX_INT32 - 1}. Received ${value}`)\n  }\n  buf.set([value >>> 24, value >>> 16, value >>> 8, value & 0xff], offset)\n}\n\nfunction uint64be(value: number) {\n  const high = Math.floor(value / MAX_INT32)\n  const low = value % MAX_INT32\n  const buf = new Uint8Array(8)\n  writeUInt32BE(buf, high, 0)\n  writeUInt32BE(buf, low, 4)\n  return buf\n}\n\n/**\n * Code copied and adapted from https://github.com/panva/jose\n * @param enc - the JWE content encryption algorithm (e.g. A256CBC-HS512)\n * @param plaintext - the content to encrypt\n * @param cek - the raw content encryption key\n * @param providedIV - optional provided Initialization Vector\n * @param aad - optional additional authenticated data\n */\nasync function cbcEncrypt(\n  enc: string = 'A256CBC-HS512',\n  plaintext: Uint8Array,\n  cek: Uint8Array,\n  providedIV?: Uint8Array,\n  aad: Uint8Array = new Uint8Array(0),\n) {\n  // A256CBC-HS512 CEK size should be 512 bits; first 256 bits are used for HMAC with SHA-512 and the rest for AES-CBC\n  const keySize = parseInt(enc.slice(1, 4), 10)\n  const encKey = cek.subarray(keySize >> 3)\n  const macKey = cek.subarray(0, keySize >> 3)\n\n  if (providedIV && providedIV.length !== keySize >> 4) {\n    throw new Error(`illegal_argument: Invalid IV size, expected ${keySize >> 4}, got ${providedIV.length}`)\n  }\n  const iv = providedIV ?? randomBytes(keySize >> 4)\n\n  const ciphertext = cbc(encKey, iv).encrypt(plaintext)\n\n  const macData = concat([aad, iv, ciphertext, uint64be(aad.length << 3)])\n  const tag = hmac(sha512, macKey, macData).slice(0, keySize >> 3)\n\n  return { enc: 'dir', ciphertext, tag, iv }\n}\n\nexport function timingSafeEqual(a: Uint8Array, b: Uint8Array): boolean {\n  if (a.length !== b.length) {\n    return false\n  }\n  let result = 0\n  let len = a.length\n  for (let i = 0; i < len; i++) {\n    result |= a[i] ^ b[i]\n  }\n  return result === 0\n}\n\nasync function cbcDecrypt(\n  enc: string = 'A256CBC-HS512',\n  cek: Uint8Array,\n  ciphertext: Uint8Array,\n  iv: Uint8Array,\n  tag: Uint8Array,\n  aad: Uint8Array,\n) {\n  const keySize = parseInt(enc.slice(1, 4), 10)\n  const encKey = cek.subarray(keySize >> 3)\n  const macKey = cek.subarray(0, keySize >> 3)\n\n  const macData = concat([aad, iv, ciphertext, uint64be(aad.length << 3)])\n  const expectedTag = hmac(sha512, macKey, macData).slice(0, keySize >> 3)\n\n  let macCheckPassed: boolean = false\n  try {\n    macCheckPassed = timingSafeEqual(tag, expectedTag)\n  } catch {\n    // nop\n  }\n  if (!macCheckPassed) {\n    // current JWE decryption pipeline tries to decrypt multiple times with different keys, so return null instead of\n    // throwing an error\n    return null\n    // throw new Error('jwe_decryption_failed: MAC check failed')\n  }\n\n  let plaintext: Uint8Array | null = null\n  try {\n    plaintext = cbc(encKey, iv).decrypt(ciphertext)\n  } catch (e: any) {\n    // current JWE decryption pipeline tries to decrypt multiple times with different keys, so return null instead of\n    // throwing an error\n  }\n\n  return plaintext\n}\n\nexport function a256cbcHs512DirDecrypter(key: Uint8Array): Decrypter {\n  // const cipher = new GCM(new AES(key))\n\n  async function decrypt(sealed: Uint8Array, iv: Uint8Array, aad?: Uint8Array): Promise<Uint8Array | null> {\n    // did-jwt#decryptJWE combines the ciphertext and the tag into a single `sealed` array\n    const TAG_LENGTH = 32\n    const ciphertext = sealed.subarray(0, sealed.length - TAG_LENGTH)\n    const tag = sealed.subarray(sealed.length - TAG_LENGTH)\n    return cbcDecrypt('A256CBC-HS512', key, ciphertext, iv, tag, aad ?? new Uint8Array(0))\n  }\n\n  return { alg: 'dir', enc: 'A256GCM', decrypt }\n}\n\nexport function a256cbcHs512DirEncrypter(cek: Uint8Array): Encrypter {\n  const enc = 'A256CBC-HS512'\n  const alg = 'dir'\n\n  async function encrypt(\n    cleartext: Uint8Array,\n    protectedHeader: ProtectedHeader = {},\n    aad?: Uint8Array,\n  ): Promise<EncryptionResult> {\n    const protHeader = encodeBase64url(JSON.stringify(Object.assign({ alg }, protectedHeader, { enc })))\n    const encodedAad = fromString(aad ? `${protHeader}.${bytesToBase64url(aad)}` : protHeader, 'utf-8')\n    const iv: Uint8Array | undefined = protectedHeader.iv ? base64ToBytes(protectedHeader.iv) : undefined\n    return {\n      ...(await cbcEncrypt('A256CBC-HS512', cleartext, cek, iv, encodedAad)),\n      protectedHeader: protHeader,\n    }\n  }\n\n  return { alg, enc, encrypt }\n}\n"
  },
  {
    "path": "packages/did-comm/src/encryption/a256gcm-dir.ts",
    "content": "import type { Decrypter, Encrypter, EncryptionResult, ProtectedHeader } from 'did-jwt'\nimport { gcm } from '@noble/ciphers/aes'\nimport { randomBytes } from '@noble/hashes/utils'\nimport { bytesToBase64url, encodeBase64url } from '@veramo/utils'\nimport { fromString } from 'uint8arrays/from-string'\n\nfunction createA256GCMEncrypter(\n  key: Uint8Array,\n): (cleartext: Uint8Array, aad?: Uint8Array) => EncryptionResult {\n  return (cleartext: Uint8Array, aad?: Uint8Array) => {\n    const iv = randomBytes(gcm.nonceLength)\n    const sealed = gcm(key, iv, aad).encrypt(cleartext)\n    return {\n      ciphertext: sealed.subarray(0, sealed.length - gcm.tagLength),\n      tag: sealed.subarray(sealed.length - gcm.tagLength),\n      iv,\n    }\n  }\n}\n\nexport function a256gcmDirEncrypter(key: Uint8Array): Encrypter {\n  const enc = 'A256GCM'\n  const alg = 'dir'\n\n  async function encrypt(\n    cleartext: Uint8Array,\n    protectedHeader: ProtectedHeader = {},\n    aad?: Uint8Array,\n  ): Promise<EncryptionResult> {\n    const protHeader = encodeBase64url(JSON.stringify(Object.assign({ alg }, protectedHeader, { enc })))\n    const encodedAad = fromString(aad ? `${protHeader}.${bytesToBase64url(aad)}` : protHeader, 'utf-8')\n    return {\n      ...createA256GCMEncrypter(key)(cleartext, encodedAad),\n      protectedHeader: protHeader,\n    }\n  }\n\n  return { alg, enc, encrypt }\n}\n\nexport function a256gcmDirDecrypter(key: Uint8Array): Decrypter {\n\n  async function decrypt(sealed: Uint8Array, iv: Uint8Array, aad?: Uint8Array): Promise<Uint8Array | null> {\n    return gcm(key, iv, aad).decrypt(sealed)\n  }\n\n  return { alg: 'dir', enc: 'A256GCM', decrypt }\n}\n"
  },
  {
    "path": "packages/did-comm/src/encryption/a256kw-encrypters.ts",
    "content": "import type { AuthEncryptParams, Decrypter, ECDH, Encrypter, Recipient } from 'did-jwt'\nimport {\n  computeX25519Ecdh1PUv3Kek,\n  computeX25519EcdhEsKek,\n  createX25519Ecdh1PUv3Kek,\n  createX25519EcdhEsKek,\n  xc20pDirDecrypter,\n  xc20pDirEncrypter,\n} from 'did-jwt'\nimport { base64ToBytes } from '@veramo/utils'\nimport { createFullEncrypter } from './createEncrypter.js'\nimport { a256KeyUnwrapper, a256KeyWrapper } from './a256kw.js'\nimport { a256gcmDirDecrypter, a256gcmDirEncrypter } from './a256gcm-dir.js'\nimport { a256cbcHs512DirDecrypter, a256cbcHs512DirEncrypter } from './a256cbc-hs512-dir.js'\n\n////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////\n// A256CBC-HS512\n////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////\n\nexport function a256cbcHs512AnonEncrypterX25519WithA256KW(\n  recipientPublicKey: Uint8Array,\n  kid?: string,\n  apv?: string,\n): Encrypter {\n  return createFullEncrypter(\n    recipientPublicKey,\n    undefined,\n    { apv, kid },\n    { createKek: createX25519EcdhEsKek, alg: 'ECDH-ES' },\n    a256KeyWrapper,\n    { from: (cek: Uint8Array) => a256cbcHs512DirEncrypter(cek), enc: 'A256CBC-HS512' },\n  )\n}\n\nexport function a256cbcHs512AnonDecrypterX25519WithA256KW(receiverSecret: Uint8Array | ECDH): Decrypter {\n  const alg = 'ECDH-ES+A256KW'\n  const enc = 'A256CBC-HS512'\n\n  async function decrypt(\n    sealed: Uint8Array,\n    iv: Uint8Array,\n    aad?: Uint8Array,\n    recipient?: Recipient,\n  ): Promise<Uint8Array | null> {\n    recipient = <Recipient>recipient\n    const kek = await computeX25519EcdhEsKek(recipient, receiverSecret, alg)\n    if (kek === null) return null\n    // Content Encryption Key\n    const unwrapper = a256KeyUnwrapper(kek)\n    const cek = await unwrapper.unwrap(base64ToBytes(recipient.encrypted_key))\n    if (cek === null) return null\n\n    return a256cbcHs512DirDecrypter(cek).decrypt(sealed, iv, aad)\n  }\n\n  return { alg, enc, decrypt }\n}\n\nexport function a256cbcHs512AuthEncrypterX25519WithA256KW(\n  recipientPublicKey: Uint8Array,\n  senderSecret: Uint8Array | ECDH,\n  options: Partial<AuthEncryptParams> = {},\n): Encrypter {\n  return createFullEncrypter(\n    recipientPublicKey,\n    senderSecret,\n    options,\n    { createKek: createX25519Ecdh1PUv3Kek, alg: 'ECDH-1PU' },\n    a256KeyWrapper,\n    { from: (cek: Uint8Array) => a256cbcHs512DirEncrypter(cek), enc: 'A256CBC-HS512' },\n  )\n}\n\nexport function a256cbcHs512AuthDecrypterX25519WithA256KW(\n  recipientSecret: Uint8Array | ECDH,\n  senderPublicKey: Uint8Array,\n): Decrypter {\n  const alg = 'ECDH-1PU+A256KW'\n  const enc = 'A256CBC-HS512'\n\n  async function decrypt(\n    sealed: Uint8Array,\n    iv: Uint8Array,\n    aad?: Uint8Array,\n    recipient?: Recipient,\n  ): Promise<Uint8Array | null> {\n    recipient = <Recipient>recipient\n    const kek = await computeX25519Ecdh1PUv3Kek(recipient, recipientSecret, senderPublicKey, alg)\n    if (kek === null) return null\n    // Content Encryption Key\n    const unwrapper = a256KeyUnwrapper(kek)\n    const cek = await unwrapper.unwrap(base64ToBytes(recipient.encrypted_key))\n    if (cek === null) return null\n\n    return a256cbcHs512DirDecrypter(cek).decrypt(sealed, iv, aad)\n  }\n\n  return { alg, enc, decrypt }\n}\n\n////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////\n// A256GCM\n////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////\n\nexport function a256gcmAnonEncrypterX25519WithA256KW(\n  recipientPublicKey: Uint8Array,\n  kid?: string,\n  apv?: string,\n): Encrypter {\n  return createFullEncrypter(\n    recipientPublicKey,\n    undefined,\n    { apv, kid },\n    { createKek: createX25519EcdhEsKek, alg: 'ECDH-ES' },\n    a256KeyWrapper,\n    { from: (cek: Uint8Array) => a256gcmDirEncrypter(cek), enc: 'XC20P' },\n  )\n}\n\nexport function a256gcmAnonDecrypterX25519WithA256KW(receiverSecret: Uint8Array | ECDH): Decrypter {\n  const alg = 'ECDH-ES+A256KW'\n  const enc = 'A256GCM'\n\n  async function decrypt(\n    sealed: Uint8Array,\n    iv: Uint8Array,\n    aad?: Uint8Array,\n    recipient?: Recipient,\n  ): Promise<Uint8Array | null> {\n    recipient = <Recipient>recipient\n    const kek = await computeX25519EcdhEsKek(recipient, receiverSecret, alg)\n    if (kek === null) return null\n    // Content Encryption Key\n    const unwrapper = a256KeyUnwrapper(kek)\n    const cek = await unwrapper.unwrap(base64ToBytes(recipient.encrypted_key))\n    if (cek === null) return null\n\n    return a256gcmDirDecrypter(cek).decrypt(sealed, iv, aad)\n  }\n\n  return { alg, enc, decrypt }\n}\n\nexport function a256gcmAuthEncrypterEcdh1PuV3x25519WithA256KW(\n  recipientPublicKey: Uint8Array,\n  senderSecret: Uint8Array | ECDH,\n  options: Partial<AuthEncryptParams> = {},\n): Encrypter {\n  return createFullEncrypter(\n    recipientPublicKey,\n    senderSecret,\n    options,\n    { createKek: createX25519Ecdh1PUv3Kek, alg: 'ECDH-1PU' },\n    a256KeyWrapper,\n    { from: (cek: Uint8Array) => a256gcmDirEncrypter(cek), enc: 'A256GCM' },\n  )\n}\n\nexport function a256gcmAuthDecrypterEcdh1PuV3x25519WithA256KW(\n  recipientSecret: Uint8Array | ECDH,\n  senderPublicKey: Uint8Array,\n): Decrypter {\n  const alg = 'ECDH-1PU+A256KW'\n  const enc = 'A256GCM'\n\n  async function decrypt(\n    sealed: Uint8Array,\n    iv: Uint8Array,\n    aad?: Uint8Array,\n    recipient?: Recipient,\n  ): Promise<Uint8Array | null> {\n    recipient = <Recipient>recipient\n    const kek = await computeX25519Ecdh1PUv3Kek(recipient, recipientSecret, senderPublicKey, alg)\n    if (!kek) return null\n    // Content Encryption Key\n    const unwrapper = a256KeyUnwrapper(kek)\n    const cek = await unwrapper.unwrap(base64ToBytes(recipient.encrypted_key))\n    if (cek === null) return null\n\n    return a256gcmDirDecrypter(cek).decrypt(sealed, iv, aad)\n  }\n\n  return { alg, enc, decrypt }\n}\n\n////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////\n// XC20P\n////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////\n\nexport function xc20pAnonEncrypterX25519WithA256KW(\n  recipientPublicKey: Uint8Array,\n  kid?: string,\n  apv?: string,\n): Encrypter {\n  return createFullEncrypter(\n    recipientPublicKey,\n    undefined,\n    { apv, kid },\n    { createKek: createX25519EcdhEsKek, alg: 'ECDH-ES' },\n    a256KeyWrapper,\n    { from: (cek: Uint8Array) => xc20pDirEncrypter(cek), enc: 'XC20P' },\n  )\n}\n\nexport function xc20pAnonDecrypterX25519WithA256KW(receiverSecret: Uint8Array | ECDH): Decrypter {\n  const alg = 'ECDH-ES+A256KW'\n  const enc = 'XC20P'\n\n  async function decrypt(\n    sealed: Uint8Array,\n    iv: Uint8Array,\n    aad?: Uint8Array,\n    recipient?: Recipient,\n  ): Promise<Uint8Array | null> {\n    recipient = <Recipient>recipient\n    const kek = await computeX25519EcdhEsKek(recipient, receiverSecret, alg)\n    if (kek === null) return null\n    // Content Encryption Key\n    const unwrapper = a256KeyUnwrapper(kek)\n    // FIXME: why is there no tag and IV check here?\n    const cek = await unwrapper.unwrap(base64ToBytes(recipient.encrypted_key))\n    if (cek === null) return null\n\n    return xc20pDirDecrypter(cek).decrypt(sealed, iv, aad)\n  }\n\n  return { alg, enc, decrypt }\n}\n\nexport function xc20pAuthEncrypterEcdh1PuV3x25519WithA256KW(\n  recipientPublicKey: Uint8Array,\n  senderSecret: Uint8Array | ECDH,\n  options: Partial<AuthEncryptParams> = {},\n): Encrypter {\n  return createFullEncrypter(\n    recipientPublicKey,\n    senderSecret,\n    options,\n    { createKek: createX25519Ecdh1PUv3Kek, alg: 'ECDH-1PU' },\n    a256KeyWrapper,\n    { from: (cek: Uint8Array) => xc20pDirEncrypter(cek), enc: 'XC20P' },\n  )\n}\n\nexport function xc20pAuthDecrypterEcdh1PuV3x25519WithA256KW(\n  recipientSecret: Uint8Array | ECDH,\n  senderPublicKey: Uint8Array,\n): Decrypter {\n  const alg = 'ECDH-1PU+A256KW'\n  const enc = 'XC20P'\n\n  async function decrypt(\n    sealed: Uint8Array,\n    iv: Uint8Array,\n    aad?: Uint8Array,\n    recipient?: Recipient,\n  ): Promise<Uint8Array | null> {\n    recipient = <Recipient>recipient\n    const kek = await computeX25519Ecdh1PUv3Kek(recipient, recipientSecret, senderPublicKey, alg)\n    if (!kek) return null\n    // Content Encryption Key\n    const unwrapper = a256KeyUnwrapper(kek)\n    const cek = await unwrapper.unwrap(base64ToBytes(recipient.encrypted_key))\n    if (cek === null) return null\n\n    return xc20pDirDecrypter(cek).decrypt(sealed, iv, aad)\n  }\n\n  return { alg, enc, decrypt }\n}\n"
  },
  {
    "path": "packages/did-comm/src/encryption/a256kw.ts",
    "content": "import { AESKW } from '@stablelib/aes-kw'\nimport type { EncryptionResult, KeyWrapper } from 'did-jwt'\n\n/**\n * Creates a wrapper using AES-KW\n * @param wrappingKey\n */\nexport const a256KeyWrapper: KeyWrapper = {\n  from: (wrappingKey: Uint8Array) => {\n    const wrap = async (cek: Uint8Array): Promise<EncryptionResult> => {\n      return { ciphertext: new AESKW(wrappingKey).wrapKey(cek) }\n    }\n    return { wrap }\n  },\n\n  alg: 'A256KW',\n}\n\nexport function a256KeyUnwrapper(wrappingKey: Uint8Array) {\n  const unwrap = async (wrappedCek: Uint8Array): Promise<Uint8Array | null> => {\n    try {\n      return new AESKW(wrappingKey).unwrapKey(wrappedCek)\n    } catch (e) {\n      return null\n    }\n  }\n  return { unwrap, alg: 'A256KW' }\n}\n"
  },
  {
    "path": "packages/did-comm/src/encryption/createEncrypter.ts",
    "content": "import {\n  AuthEncryptParams,\n  ContentEncrypter,\n  ECDH,\n  Encrypter,\n  EncryptionResult,\n  EphemeralKeyPair,\n  genX25519EphemeralKeyPair,\n  KekCreator,\n  KeyWrapper,\n  ProtectedHeader,\n  Recipient,\n} from 'did-jwt'\nimport { bytesToBase64url } from '@veramo/utils'\nimport { randomBytes } from '@noble/hashes/utils'\n\n/**\n * Compute the length of the content encryption key based on the algorithm.\n * Only considering the algorithms known to did-comm.\n * @param enc\n */\nconst cekLength = (enc: string) => {\n  switch (enc) {\n    case 'A256CBC-HS512':\n      return 512\n    case 'A256GCM':\n    case 'XC20P':\n      return 256\n    default:\n      return 256\n  }\n}\n\n// duplicate of the method from did-jwt, where the Content Encryption key length is assumed to be 256 bits\nexport function createFullEncrypter(\n  recipientPublicKey: Uint8Array,\n  senderSecret: Uint8Array | ECDH | undefined,\n  options: Partial<AuthEncryptParams> = {},\n  kekCreator: KekCreator,\n  keyWrapper: KeyWrapper,\n  contentEncrypter: ContentEncrypter,\n): Encrypter {\n  async function encryptCek(cek: Uint8Array, ephemeralKeyPair?: EphemeralKeyPair): Promise<Recipient> {\n    const { epk, kek } = await kekCreator.createKek(\n      recipientPublicKey,\n      senderSecret,\n      `${kekCreator.alg}+${keyWrapper.alg}`,\n      options.apu,\n      options.apv,\n      ephemeralKeyPair,\n    )\n    const res = await keyWrapper.from(kek).wrap(cek)\n    const recipient: Recipient = {\n      encrypted_key: bytesToBase64url(res.ciphertext),\n      header: {},\n    }\n    if (res.iv) recipient.header.iv = bytesToBase64url(res.iv)\n    if (res.tag) recipient.header.tag = bytesToBase64url(res.tag)\n    if (options.kid) recipient.header.kid = options.kid\n    if (options.apu) recipient.header.apu = options.apu\n    if (options.apv) recipient.header.apv = options.apv\n    if (!ephemeralKeyPair) {\n      recipient.header.alg = `${kekCreator.alg}+${keyWrapper.alg}`\n      recipient.header.epk = epk\n    }\n\n    return recipient\n  }\n\n  async function encrypt(\n    cleartext: Uint8Array,\n    protectedHeader: ProtectedHeader = {},\n    aad?: Uint8Array,\n    ephemeralKeyPair?: EphemeralKeyPair,\n  ): Promise<EncryptionResult> {\n    // we won't want alg to be set to dir from xc20pDirEncrypter\n    Object.assign(protectedHeader, { alg: undefined })\n    // Content Encryption Key\n    const cek = randomBytes(cekLength(contentEncrypter.enc) >> 3)\n    const recipient: Recipient = await encryptCek(cek, ephemeralKeyPair)\n    // getting an ephemeral key means the epk is set only once per all recipients\n    if (ephemeralKeyPair) {\n      protectedHeader.alg = `${kekCreator.alg}+${keyWrapper.alg}`\n      protectedHeader.epk = ephemeralKeyPair.publicKeyJWK\n    }\n    return {\n      ...(await contentEncrypter.from(cek).encrypt(cleartext, protectedHeader, aad)),\n      recipient,\n      cek,\n    }\n  }\n\n  return {\n    alg: keyWrapper.alg,\n    enc: contentEncrypter.enc,\n    encrypt,\n    encryptCek,\n    genEpk: genX25519EphemeralKeyPair,\n  }\n}\n"
  },
  {
    "path": "packages/did-comm/src/encryption/p256-ECDH-1PU.ts",
    "content": "// // TODO: Implement this\n// // kept the X25519 code for reference\n\n\n\n\n\n\n// import type { ECDH, EphemeralKeyPair, Recipient } from 'did-jwt'\n// import { concatKDF } from 'did-jwt'\n// import { x25519 } from '@noble/curves/ed25519'\n// import { generateX25519KeyPair, generateX25519KeyPairFromSeed } from '../utils.js'\n// import { base64ToBytes, bytesToBase64url } from '@veramo/utils'\n//\n// export async function computeX25519Ecdh1PUv3Kek(\n//   recipient: Recipient,\n//   recipientSecret: Uint8Array | ECDH,\n//   senderPublicKey: Uint8Array,\n//   alg: string,\n// ) {\n//   const crv = 'X25519'\n//   const keyLen = 256\n//   const header = recipient.header\n//   if (header.epk?.crv !== crv || typeof header.epk.x == 'undefined') return null\n//   // ECDH-1PU requires additional shared secret between\n//   // static key of sender and static key of recipient\n//   const publicKey = base64ToBytes(header.epk.x)\n//   let zE: Uint8Array\n//   let zS: Uint8Array\n//\n//   if (recipientSecret instanceof Uint8Array) {\n//     zE = x25519.getSharedSecret(recipientSecret, publicKey)\n//     zS = x25519.getSharedSecret(recipientSecret, senderPublicKey)\n//   } else {\n//     zE = await recipientSecret(publicKey)\n//     zS = await recipientSecret(senderPublicKey)\n//   }\n//\n//   const sharedSecret = new Uint8Array(zE.length + zS.length)\n//   sharedSecret.set(zE)\n//   sharedSecret.set(zS, zE.length)\n//\n//   // Key Encryption Key\n//   let producerInfo\n//   let consumerInfo\n//   if (recipient.header.apu) producerInfo = base64ToBytes(recipient.header.apu)\n//   if (recipient.header.apv) consumerInfo = base64ToBytes(recipient.header.apv)\n//\n//   return concatKDF(sharedSecret, keyLen, alg, producerInfo, consumerInfo)\n// }\n//\n// export async function createX25519Ecdh1PUv3Kek(\n//   recipientPublicKey: Uint8Array,\n//   senderSecret: Uint8Array | ECDH,\n//   alg: string, // must be provided as this is the key agreement alg + the key wrapper alg, Example: 'ECDH-ES+A256KW'\n//   apu: string | undefined,\n//   apv: string | undefined,\n//   ephemeralKeyPair: EphemeralKeyPair | undefined\n// ) {\n//   const crv = 'X25519'\n//   const keyLen = 256\n//   const ephemeral = ephemeralKeyPair ? generateX25519KeyPairFromSeed(ephemeralKeyPair.secretKey) : generateX25519KeyPair()\n//   const epk = { kty: 'OKP', crv, x: bytesToBase64url(ephemeral.publicKey) }\n//   const zE = x25519.getSharedSecret(ephemeral.secretKey, recipientPublicKey)\n//\n//   // ECDH-1PU requires additional shared secret between\n//   // static key of sender and static key of recipient\n//   let zS\n//   if (senderSecret instanceof Uint8Array) {\n//     zS = x25519.getSharedSecret(senderSecret, recipientPublicKey)\n//   } else {\n//     zS = await senderSecret(recipientPublicKey)\n//   }\n//\n//   const sharedSecret = new Uint8Array(zE.length + zS.length)\n//   sharedSecret.set(zE)\n//   sharedSecret.set(zS, zE.length)\n//\n//   let partyUInfo: Uint8Array = new Uint8Array(0)\n//   let partyVInfo: Uint8Array = new Uint8Array(0)\n//   if (apu) partyUInfo = base64ToBytes(apu)\n//   if (apv) partyVInfo = base64ToBytes(apv)\n//\n//   // Key Encryption Key\n//   const kek = concatKDF(sharedSecret, keyLen, alg, partyUInfo, partyVInfo)\n//   return { epk, kek }\n// }\n"
  },
  {
    "path": "packages/did-comm/src/encryption/p256-ECDH-ES.ts",
    "content": "// // TODO: Implement this\n// // kept the X25519 code for reference\n\n\n\n\n\n\n// import type { ECDH, EphemeralKeyPair, Recipient } from 'did-jwt'\n// import { concatKDF } from 'did-jwt'\n// import { x25519 } from '@noble/curves/ed25519'\n// import { base64ToBytes, bytesToBase64url } from \"@veramo/utils\";\n// import { generateX25519KeyPair, generateX25519KeyPairFromSeed } from \"../utils.js\";\n//\n// export async function computeX25519EcdhEsKek(recipient: Recipient, receiverSecret: Uint8Array | ECDH, alg: string) {\n//   const crv = 'X25519'\n//   const keyLen = 256\n//   const header = recipient.header\n//   if (header.epk?.crv !== crv || typeof header.epk.x == 'undefined') return null\n//   const publicKey = base64ToBytes(header.epk.x)\n//   let sharedSecret\n//   if (receiverSecret instanceof Uint8Array) {\n//     sharedSecret = x25519.getSharedSecret(receiverSecret, publicKey)\n//   } else {\n//     sharedSecret = await receiverSecret(publicKey)\n//   }\n//\n//   // Key Encryption Key\n//   let producerInfo: Uint8Array | undefined = undefined\n//   let consumerInfo: Uint8Array | undefined = undefined\n//   if (recipient.header.apu) producerInfo = base64ToBytes(recipient.header.apu)\n//   if (recipient.header.apv) consumerInfo = base64ToBytes(recipient.header.apv)\n//   return concatKDF(sharedSecret, keyLen, alg, producerInfo, consumerInfo)\n// }\n//\n// export async function createX25519EcdhEsKek(\n//   recipientPublicKey: Uint8Array,\n//   senderSecret: Uint8Array | ECDH | undefined, // unused\n//   alg: string,\n//   apu: string | undefined, // unused\n//   apv: string | undefined,\n//   ephemeralKeyPair: EphemeralKeyPair | undefined\n// ) {\n//   const crv = 'X25519'\n//   const keyLen = 256\n//   const ephemeral = ephemeralKeyPair ? generateX25519KeyPairFromSeed(ephemeralKeyPair.secretKey) : generateX25519KeyPair()\n//   const epk = { kty: 'OKP', crv, x: bytesToBase64url(ephemeral.publicKey) }\n//   const sharedSecret = x25519.getSharedSecret(ephemeral.secretKey, recipientPublicKey)\n//   // Key Encryption Key\n//   const consumerInfo = base64ToBytes(apv ?? '')\n//   const kek = concatKDF(sharedSecret, keyLen, alg, undefined, consumerInfo)\n//   return { epk, kek }\n// }\n"
  },
  {
    "path": "packages/did-comm/src/encryption/xc20pkw-encrypters.ts",
    "content": "import {\n  AuthEncryptParams,\n  computeX25519Ecdh1PUv3Kek,\n  computeX25519EcdhEsKek,\n  createX25519Ecdh1PUv3Kek,\n  createX25519EcdhEsKek,\n  Decrypter,\n  ECDH,\n  Encrypter,\n  Recipient,\n  xc20pDirEncrypter,\n} from 'did-jwt'\nimport { createFullEncrypter } from './createEncrypter.js'\nimport { base64ToBytes } from '@veramo/utils'\nimport { xc20pDecrypter, xc20pKeyUnwrapper, xc20pKeyWrapper } from './xc20pkw.js'\nimport { a256cbcHs512DirDecrypter, a256cbcHs512DirEncrypter } from './a256cbc-hs512-dir.js'\nimport { a256gcmDirDecrypter, a256gcmDirEncrypter } from './a256gcm-dir.js'\nimport { a256KeyWrapper } from './a256kw.js'\n\n////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////\n// A256CBC-HS512\n////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////\n\nexport function a256cbcHs512AnonEncrypterX25519WithXC20PKW(\n  recipientPublicKey: Uint8Array,\n  kid?: string,\n  apv?: string,\n): Encrypter {\n  return createFullEncrypter(\n    recipientPublicKey,\n    undefined,\n    { apv, kid },\n    { createKek: createX25519EcdhEsKek, alg: 'ECDH-ES' },\n    xc20pKeyWrapper,\n    { from: (cek: Uint8Array) => a256cbcHs512DirEncrypter(cek), enc: 'A256CBC-HS512' },\n  )\n}\n\nexport function a256cbcHs512AnonDecrypterX25519WithXC20PKW(receiverSecret: Uint8Array | ECDH): Decrypter {\n  const alg = 'ECDH-ES+XC20PKW'\n  const enc = 'A256CBC-HS512'\n\n  async function decrypt(\n    sealed: Uint8Array,\n    iv: Uint8Array,\n    aad?: Uint8Array,\n    recipient?: Recipient,\n  ): Promise<Uint8Array | null> {\n    recipient = <Recipient>recipient\n    const kek = await computeX25519EcdhEsKek(recipient, receiverSecret, alg)\n    if (kek === null) return null\n    // Content Encryption Key\n    const unwrapper = xc20pKeyUnwrapper(kek)\n    const recipientIV = recipient?.header?.iv ? base64ToBytes(recipient.header.iv) : new Uint8Array(0)\n    const recipientTag = recipient?.header?.tag ? base64ToBytes(recipient.header.tag) : new Uint8Array(0)\n    const cek = await unwrapper.unwrap(base64ToBytes(recipient.encrypted_key), recipientIV, recipientTag)\n    if (cek === null) return null\n\n    return a256cbcHs512DirDecrypter(cek).decrypt(sealed, iv, aad)\n  }\n\n  return { alg, enc, decrypt }\n}\n\nexport function a256cbcHs512AuthEncrypterX25519WithXC20PKW(\n  recipientPublicKey: Uint8Array,\n  senderSecret: Uint8Array | ECDH,\n  options: Partial<AuthEncryptParams> = {},\n): Encrypter {\n  return createFullEncrypter(\n    recipientPublicKey,\n    senderSecret,\n    options,\n    { createKek: createX25519Ecdh1PUv3Kek, alg: 'ECDH-1PU' },\n    xc20pKeyWrapper,\n    { from: (cek: Uint8Array) => a256cbcHs512DirEncrypter(cek), enc: 'A256CBC-HS512' },\n  )\n}\n\nexport function a256cbcHs512AuthDecrypterX25519WithXC20PKW(\n  recipientSecret: Uint8Array | ECDH,\n  senderPublicKey: Uint8Array,\n): Decrypter {\n  const alg = 'ECDH-1PU+XC20PKW'\n  const enc = 'A256CBC-HS512'\n\n  async function decrypt(\n    sealed: Uint8Array,\n    iv: Uint8Array,\n    aad?: Uint8Array,\n    recipient?: Recipient,\n  ): Promise<Uint8Array | null> {\n    recipient = <Recipient>recipient\n    const kek = await computeX25519Ecdh1PUv3Kek(recipient, recipientSecret, senderPublicKey, alg)\n    if (kek === null) return null\n    // Content Encryption Key\n    const unwrapper = xc20pKeyUnwrapper(kek)\n    const recipientIV = recipient?.header?.iv ? base64ToBytes(recipient.header.iv) : new Uint8Array(0)\n    const recipientTag = recipient?.header?.tag ? base64ToBytes(recipient.header.tag) : new Uint8Array(0)\n    const cek = await unwrapper.unwrap(base64ToBytes(recipient.encrypted_key), recipientIV, recipientTag)\n    if (cek === null) return null\n\n    return a256cbcHs512DirDecrypter(cek).decrypt(sealed, iv, aad)\n  }\n\n  return { alg, enc, decrypt }\n}\n\n////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////\n// A256GCM\n////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////\n\nexport function a256gcmAnonEncrypterX25519WithXC20PKW(\n  recipientPublicKey: Uint8Array,\n  kid?: string,\n  apv?: string,\n): Encrypter {\n  return createFullEncrypter(\n    recipientPublicKey,\n    undefined,\n    { apv, kid },\n    { createKek: createX25519EcdhEsKek, alg: 'ECDH-ES' },\n    xc20pKeyWrapper,\n    { from: (cek: Uint8Array) => a256gcmDirEncrypter(cek), enc: 'XC20P' },\n  )\n}\n\nexport function a256gcmAnonDecrypterX25519WithXC20PKW(receiverSecret: Uint8Array | ECDH): Decrypter {\n  const alg = 'ECDH-ES+XC20PKW'\n  const enc = 'A256GCM'\n\n  async function decrypt(\n    sealed: Uint8Array,\n    iv: Uint8Array,\n    aad?: Uint8Array,\n    recipient?: Recipient,\n  ): Promise<Uint8Array | null> {\n    recipient = <Recipient>recipient\n    const kek = await computeX25519EcdhEsKek(recipient, receiverSecret, alg)\n    if (kek === null) return null\n    // Content Encryption Key\n    const unwrapper = xc20pKeyUnwrapper(kek)\n    const recipientIV = recipient?.header?.iv ? base64ToBytes(recipient.header.iv) : new Uint8Array(0)\n    const recipientTag = recipient?.header?.tag ? base64ToBytes(recipient.header.tag) : new Uint8Array(0)\n    const cek = await unwrapper.unwrap(base64ToBytes(recipient.encrypted_key), recipientIV, recipientTag)\n    if (cek === null) return null\n\n    return a256gcmDirDecrypter(cek).decrypt(sealed, iv, aad)\n  }\n\n  return { alg, enc, decrypt }\n}\n\nexport function a256gcmAuthEncrypterEcdh1PuV3x25519WithXC20PKW(\n  recipientPublicKey: Uint8Array,\n  senderSecret: Uint8Array | ECDH,\n  options: Partial<AuthEncryptParams> = {},\n): Encrypter {\n  return createFullEncrypter(\n    recipientPublicKey,\n    senderSecret,\n    options,\n    { createKek: createX25519Ecdh1PUv3Kek, alg: 'ECDH-1PU' },\n    xc20pKeyWrapper,\n    { from: (cek: Uint8Array) => a256gcmDirEncrypter(cek), enc: 'A256GCM' },\n  )\n}\n\nexport function a256gcmAuthDecrypterEcdh1PuV3x25519WithXC20PKW(\n  recipientSecret: Uint8Array | ECDH,\n  senderPublicKey: Uint8Array,\n): Decrypter {\n  const alg = 'ECDH-1PU+XC20PKW'\n  const enc = 'A256GCM'\n\n  async function decrypt(\n    sealed: Uint8Array,\n    iv: Uint8Array,\n    aad?: Uint8Array,\n    recipient?: Recipient,\n  ): Promise<Uint8Array | null> {\n    recipient = <Recipient>recipient\n    const kek = await computeX25519Ecdh1PUv3Kek(recipient, recipientSecret, senderPublicKey, alg)\n    if (!kek) return null\n    // Content Encryption Key\n    const unwrapper = xc20pKeyUnwrapper(kek)\n    const recipientIV = recipient?.header?.iv ? base64ToBytes(recipient.header.iv) : new Uint8Array(0)\n    const recipientTag = recipient?.header?.tag ? base64ToBytes(recipient.header.tag) : new Uint8Array(0)\n    const cek = await unwrapper.unwrap(base64ToBytes(recipient.encrypted_key), recipientIV, recipientTag)\n    if (cek === null) return null\n\n    return a256gcmDirDecrypter(cek).decrypt(sealed, iv, aad)\n  }\n\n  return { alg, enc, decrypt }\n}\n\n////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////\n// XC20P\n////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////\n\nexport function xc20pAnonEncrypterX25519WithXC20PKW(\n  recipientPublicKey: Uint8Array,\n  kid?: string,\n  apv?: string,\n): Encrypter {\n  return createFullEncrypter(\n    recipientPublicKey,\n    undefined,\n    { apv, kid },\n    { createKek: createX25519EcdhEsKek, alg: 'ECDH-ES' },\n    xc20pKeyWrapper,\n    { from: (cek: Uint8Array) => xc20pDirEncrypter(cek), enc: 'XC20P' },\n  )\n}\n\nexport function xc20pAnonDecrypterX25519WithXC20PKW(receiverSecret: Uint8Array | ECDH): Decrypter {\n  const alg = 'ECDH-ES+XC20PKW'\n  const enc = 'XC20P'\n\n  async function decrypt(\n    sealed: Uint8Array,\n    iv: Uint8Array,\n    aad?: Uint8Array,\n    recipient?: Recipient,\n  ): Promise<Uint8Array | null> {\n    recipient = <Recipient>recipient\n    const kek = await computeX25519EcdhEsKek(recipient, receiverSecret, alg)\n    if (kek === null) return null\n    // Content Encryption Key\n    const unwrapper = xc20pKeyUnwrapper(kek)\n    const recipientIV = recipient?.header?.iv ? base64ToBytes(recipient.header.iv) : new Uint8Array(0)\n    const recipientTag = recipient?.header?.tag ? base64ToBytes(recipient.header.tag) : new Uint8Array(0)\n    const cek = await unwrapper.unwrap(base64ToBytes(recipient.encrypted_key), recipientIV, recipientTag)\n    if (cek === null) return null\n\n    return xc20pDecrypter(cek).decrypt(sealed, iv, aad)\n  }\n\n  return { alg, enc, decrypt }\n}\n\nexport function xc20pAuthEncrypterEcdh1PuV3x25519WithXC20PKW(\n  recipientPublicKey: Uint8Array,\n  senderSecret: Uint8Array | ECDH,\n  options: Partial<AuthEncryptParams> = {},\n): Encrypter {\n  return createFullEncrypter(\n    recipientPublicKey,\n    senderSecret,\n    options,\n    { createKek: createX25519Ecdh1PUv3Kek, alg: 'ECDH-1PU' },\n    xc20pKeyWrapper,\n    { from: (cek: Uint8Array) => xc20pDirEncrypter(cek), enc: 'XC20P' },\n  )\n}\n\nexport function xc20pAuthDecrypterEcdh1PuV3x25519WithXC20PKW(\n  recipientSecret: Uint8Array | ECDH,\n  senderPublicKey: Uint8Array,\n): Decrypter {\n  const alg = 'ECDH-1PU+XC20PKW'\n  const enc = 'XC20P'\n\n  async function decrypt(\n    sealed: Uint8Array,\n    iv: Uint8Array,\n    aad?: Uint8Array,\n    recipient?: Recipient,\n  ): Promise<Uint8Array | null> {\n    recipient = <Recipient>recipient\n    const kek = await computeX25519Ecdh1PUv3Kek(recipient, recipientSecret, senderPublicKey, alg)\n    if (!kek) return null\n    // Content Encryption Key\n    const unwrapper = xc20pKeyUnwrapper(kek)\n    const recipientIV = recipient?.header?.iv ? base64ToBytes(recipient.header.iv) : new Uint8Array(0)\n    const recipientTag = recipient?.header?.tag ? base64ToBytes(recipient.header.tag) : new Uint8Array(0)\n    const cek = await unwrapper.unwrap(base64ToBytes(recipient.encrypted_key), recipientIV, recipientTag)\n    if (cek === null) return null\n\n    return xc20pDecrypter(cek).decrypt(sealed, iv, aad)\n  }\n\n  return { alg, enc, decrypt }\n}\n"
  },
  {
    "path": "packages/did-comm/src/encryption/xc20pkw.ts",
    "content": "import type { Decrypter, KeyWrapper, WrappingResult } from 'did-jwt'\nimport { randomBytes } from '@noble/hashes/utils'\nimport { concat } from '@veramo/utils'\nimport { xchacha20poly1305 } from '@noble/ciphers/chacha'\n\nexport const xc20pKeyWrapper: KeyWrapper = {\n  from: (wrappingKey: Uint8Array) => {\n    const wrap = async (cek: Uint8Array): Promise<WrappingResult> => {\n      const iv = randomBytes(xchacha20poly1305.nonceLength)\n      const cipher = xchacha20poly1305(wrappingKey, iv)\n      const sealed = cipher.encrypt(cek)\n      return {\n        ciphertext: sealed.subarray(0, sealed.length - xchacha20poly1305.tagLength),\n        tag: sealed.subarray(sealed.length - xchacha20poly1305.tagLength),\n        iv,\n      }\n    }\n    return { wrap }\n  },\n\n  alg: 'XC20PKW',\n}\n\nexport function xc20pDecrypter(key: Uint8Array): Decrypter {\n\n  async function decrypt(sealed: Uint8Array, iv: Uint8Array, aad?: Uint8Array): Promise<Uint8Array | null> {\n    const cipher = xchacha20poly1305(key, iv, aad)\n    return cipher.decrypt(sealed)\n  }\n\n  return { alg: 'dir', enc: 'XC20P', decrypt }\n}\n\nexport function xc20pKeyUnwrapper(wrappingKey: Uint8Array) {\n  const unwrap = async (\n    wrappedCek: Uint8Array,\n    iv: Uint8Array,\n    tag: Uint8Array,\n  ): Promise<Uint8Array | null> => {\n    try {\n      const sealed = concat([wrappedCek, tag])\n      return xc20pDecrypter(wrappingKey).decrypt(sealed, iv)\n    } catch (e) {\n      return null\n    }\n  }\n  return { unwrap, alg: 'XC20PKW' }\n}\n"
  },
  {
    "path": "packages/did-comm/src/index.ts",
    "content": "/**\n * Provides a {@link @veramo/did-comm#DIDComm | plugin} for the {@link @veramo/core#Agent} that implements\n * {@link @veramo/did-comm#IDIDComm} interface.  Provides a {@link @veramo/did-comm#DIDCommMessageHandler | plugin}\n * for the {@link @veramo/message-handler#MessageHandler} that decrypts messages.\n *\n * @packageDocumentation\n */\n\nexport * from './didcomm.js'\nexport * from './types/message-types.js'\nexport * from './types/utility-types.js'\nexport * from './types/IDIDComm.js'\nexport { DIDCommMessageHandler } from './message-handler.js'\nexport * from './protocols/index.js'\nexport * from './transports/transports.js'\nexport { schema } from './plugin.schema.js'\n"
  },
  {
    "path": "packages/did-comm/src/message-handler.ts",
    "content": "import { IAgentContext, IDIDManager, IKeyManager } from '@veramo/core-types'\nimport { AbstractMessageHandler, Message } from '@veramo/message-handler'\nimport Debug from 'debug'\nimport { IDIDComm } from './types/IDIDComm.js'\nimport { asArray } from '@veramo/utils'\nconst debug = Debug('veramo:did-comm:message-handler')\n\ntype IContext = IAgentContext<IDIDManager & IKeyManager & IDIDComm>\n\n/**\n * A plugin for the {@link @veramo/message-handler#MessageHandler} that decrypts DIDComm messages.\n * @beta This API may change without a BREAKING CHANGE notice.\n */\nexport class DIDCommMessageHandler extends AbstractMessageHandler {\n  constructor() {\n    super()\n  }\n\n  private async handleDIDCommAlpha(message: Message, context: IContext): Promise<Message> {\n    if (message.raw) {\n      try {\n        const parsed = JSON.parse(message.raw)\n        if (parsed.ciphertext && parsed.protected) {\n          const identifiers = await context.agent.didManagerFind()\n          for (const identifier of identifiers) {\n            let decrypted\n            try {\n              const key = identifier.keys.find((k) => k.type === 'Ed25519')\n              if (!key) throw Error('No encryption keys')\n              decrypted = await context.agent.keyManagerDecryptJWE({ kid: key.kid, data: message.raw })\n            } catch (e) {}\n            if (decrypted) {\n              debug('Decrypted for %s', identifier.did)\n              debug('Message:', decrypted)\n\n              try {\n                const json = JSON.parse(decrypted)\n                if (json['type'] === 'jwt') {\n                  message.raw = json.body\n                  message.addMetaData({ type: 'DIDComm' })\n                } else {\n                  if (json['id']) message.id = json['id']\n                  if (json['type']) message.type = json['type']\n                  message.raw = decrypted\n                  message.data = json\n                  message.addMetaData({ type: 'DIDComm' })\n                }\n                return super.handle(message, context)\n              } catch (e: any) {\n                debug(e.message)\n              }\n\n              message.raw = decrypted\n              message.addMetaData({ type: 'DIDComm' })\n\n              return super.handle(message, context)\n            }\n          }\n        } else if (parsed.type === 'jwt') {\n          message.raw = parsed.body\n          if (parsed['id']) message.id = parsed['id']\n          message.addMetaData({ type: 'DIDComm' })\n          return super.handle(message, context)\n        } else {\n          message.data = parsed.body\n          if (parsed['id']) message.id = parsed['id']\n          if (parsed['type']) message.type = parsed['type']\n          message.addMetaData({ type: 'DIDComm' })\n          debug('JSON message with id and type', message)\n          return super.handle(message, context)\n        }\n      } catch (e) {\n        debug('Raw message is not a JSON string')\n      }\n    }\n\n    return super.handle(message, context)\n  }\n\n  /**\n   * Handles a new packed DIDCommV2 Message (also Alpha support but soon deprecated).\n   * - Tests whether raw message is a DIDCommV2 message\n   * - Unpacks raw message (JWM/JWE/JWS, or plain JSON).\n   * -\n   */\n  async handle(message: Message, context: IContext): Promise<Message> {\n    const rawMessage = message.raw\n    if (rawMessage) {\n      // check whether message is DIDCommV2\n      let didCommMessageType = undefined\n      try {\n        didCommMessageType = await context.agent.getDIDCommMessageMediaType({ message: rawMessage })\n      } catch (e) {\n        debug(`Could not parse message as DIDComm v2: ${e}`)\n      }\n      if (didCommMessageType) {\n        try {\n          const unpackedMessage = await context.agent.unpackDIDCommMessage({\n            message: rawMessage,\n          })\n\n          const {\n            type,\n            to,\n            from,\n            id,\n            thid: threadId,\n            created_time: createdAt,\n            expires_time: expiresAt,\n            body: data,\n            attachments,\n            return_route\n          } = unpackedMessage.message\n\n          message.type = type\n          message.to = asArray(to)[0]\n          message.from = from\n          message.id = id\n          message.threadId = threadId\n          message.createdAt = createdAt\n          message.expiresAt = expiresAt\n          message.data = data\n          message.attachments = attachments\n          message.returnRoute = return_route\n\n          message.addMetaData({ type: 'didCommMetaData', value: JSON.stringify(unpackedMessage.metaData) })\n          context.agent.emit('DIDCommV2Message-received', unpackedMessage)\n\n          // DIDCommMessageHandler should attempt to forward message to next handler, but\n          // shouldn't throw an error if other handlers fail\n          let superHandled\n          try {\n            superHandled = await super.handle(message, context)\n          } catch (e) {\n            debug(`Could not handle DIDCommV2Message in downstream handlers: ${e}`)\n          }\n\n          // if downstream message handlers failed, still treat original unpacked DIDCommV2Message as good\n          return superHandled || message\n        } catch (e) {\n          debug(`Could not unpack message as DIDCommV2Message: ${e}`)\n        }\n      }\n    }\n\n    return this.handleDIDCommAlpha(message, context)\n  }\n}\n"
  },
  {
    "path": "packages/did-comm/src/plugin.schema.ts",
    "content": "export const schema = {\n  \"IDIDComm\": {\n    \"components\": {\n      \"schemas\": {\n        \"IPackedDIDCommMessage\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"message\": {\n              \"type\": \"string\"\n            }\n          },\n          \"required\": [\n            \"message\"\n          ],\n          \"description\": \"The result of packing a DIDComm v2 message. The message is always serialized as string.\"\n        },\n        \"DIDCommMessageMediaType\": {\n          \"type\": \"string\",\n          \"enum\": [\n            \"application/didcomm-plain+json\",\n            \"application/didcomm-signed+json\",\n            \"application/didcomm-encrypted+json\"\n          ],\n          \"description\": \"Represents different DIDComm v2 message encapsulation.\"\n        },\n        \"IPackDIDCommMessageArgs\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"resolutionOptions\": {\n              \"type\": \"object\",\n              \"properties\": {\n                \"publicKeyFormat\": {\n                  \"type\": \"string\"\n                },\n                \"accept\": {\n                  \"type\": \"string\"\n                }\n              },\n              \"description\": \"Options to be passed to the DID resolver.\"\n            },\n            \"message\": {\n              \"$ref\": \"#/components/schemas/IDIDCommMessage\"\n            },\n            \"packing\": {\n              \"$ref\": \"#/components/schemas/DIDCommMessagePacking\"\n            },\n            \"keyRef\": {\n              \"type\": \"string\"\n            },\n            \"options\": {\n              \"$ref\": \"#/components/schemas/IDIDCommOptions\"\n            }\n          },\n          \"required\": [\n            \"message\",\n            \"packing\"\n          ],\n          \"description\": \"The input to the  {@link  IDIDComm.packDIDCommMessage }  method. When `packing` is `authcrypt` or `jws`, a `keyRef` MUST be provided.\"\n        },\n        \"IDIDCommMessage\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"id\": {\n              \"type\": \"string\"\n            },\n            \"type\": {\n              \"type\": \"string\"\n            },\n            \"from\": {\n              \"type\": \"string\"\n            },\n            \"to\": {\n              \"type\": \"array\",\n              \"items\": {\n                \"type\": \"string\"\n              }\n            },\n            \"thid\": {\n              \"type\": \"string\"\n            },\n            \"pthid\": {\n              \"type\": \"string\"\n            },\n            \"expires_time\": {\n              \"type\": \"string\"\n            },\n            \"created_time\": {\n              \"type\": \"string\"\n            },\n            \"next\": {\n              \"type\": \"string\"\n            },\n            \"from_prior\": {\n              \"type\": \"string\"\n            },\n            \"body\": {},\n            \"attachments\": {\n              \"type\": \"array\",\n              \"items\": {\n                \"$ref\": \"#/components/schemas/IDIDCommMessageAttachment\"\n              }\n            },\n            \"return_route\": {\n              \"type\": \"string\"\n            }\n          },\n          \"required\": [\n            \"id\",\n            \"type\"\n          ],\n          \"description\": \"The DIDComm message structure. See https://identity.foundation/didcomm-messaging/spec/#plaintext-message-structure\"\n        },\n        \"IDIDCommMessageAttachment\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"id\": {\n              \"type\": \"string\"\n            },\n            \"description\": {\n              \"type\": \"string\"\n            },\n            \"filename\": {\n              \"type\": \"string\"\n            },\n            \"media_type\": {\n              \"type\": \"string\"\n            },\n            \"format\": {\n              \"type\": \"string\"\n            },\n            \"lastmod_time\": {\n              \"type\": \"string\"\n            },\n            \"byte_count\": {\n              \"type\": \"number\"\n            },\n            \"data\": {\n              \"$ref\": \"#/components/schemas/IDIDCommMessageAttachmentData\"\n            }\n          },\n          \"required\": [\n            \"data\"\n          ],\n          \"description\": \"The DIDComm message structure for attachments. See https://identity.foundation/didcomm-messaging/spec/#attachments\"\n        },\n        \"IDIDCommMessageAttachmentData\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"jws\": {},\n            \"hash\": {\n              \"type\": \"string\"\n            },\n            \"links\": {\n              \"type\": \"array\",\n              \"items\": {\n                \"type\": \"string\"\n              }\n            },\n            \"base64\": {\n              \"type\": \"string\"\n            },\n            \"json\": {}\n          },\n          \"description\": \"The DIDComm message structure for data in an attachment. See https://identity.foundation/didcomm-messaging/spec/#attachments\"\n        },\n        \"DIDCommMessagePacking\": {\n          \"type\": \"string\",\n          \"enum\": [\n            \"authcrypt\",\n            \"anoncrypt\",\n            \"jws\",\n            \"none\",\n            \"anoncrypt+authcrypt\",\n            \"anoncrypt+jws\"\n          ],\n          \"description\": \"The possible types of message packing.\\n\\n`authcrypt`, `anoncrypt`, `anoncrypt+authcrypt`, and `anoncrypt+jws` will produce `DIDCommMessageMediaType.ENCRYPTED` messages.\\n\\n`jws` will produce `DIDCommMessageMediaType.SIGNED` messages.\\n\\n`none` will produce `DIDCommMessageMediaType.PLAIN` messages.\"\n        },\n        \"IDIDCommOptions\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"bcc\": {\n              \"type\": \"array\",\n              \"items\": {\n                \"type\": \"string\"\n              },\n              \"description\": \"Add extra recipients for the packed message.\"\n            },\n            \"recipientKids\": {\n              \"type\": \"array\",\n              \"items\": {\n                \"type\": \"string\"\n              },\n              \"description\": \"Restrict to a set of kids for recipient\"\n            },\n            \"enc\": {\n              \"type\": \"string\",\n              \"enum\": [\n                \"XC20P\",\n                \"A256GCM\",\n                \"A256CBC-HS512\"\n              ],\n              \"description\": \"Optional content encryption algorithm to use. Defaults to 'A256GCM'\"\n            },\n            \"alg\": {\n              \"type\": \"string\",\n              \"enum\": [\n                \"ECDH-ES+A256KW\",\n                \"ECDH-1PU+A256KW\",\n                \"ECDH-ES+XC20PKW\",\n                \"ECDH-1PU+XC20PKW\"\n              ],\n              \"description\": \"Optional key wrapping algorithm to use. Defaults to 'ECDH-ES+A256KW'\"\n            }\n          },\n          \"description\": \"Extra options when packing a DIDComm message.\"\n        },\n        \"ISendDIDCommMessageArgs\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"resolutionOptions\": {\n              \"type\": \"object\",\n              \"properties\": {\n                \"publicKeyFormat\": {\n                  \"type\": \"string\"\n                },\n                \"accept\": {\n                  \"type\": \"string\"\n                }\n              },\n              \"description\": \"Options to be passed to the DID resolver.\"\n            },\n            \"packedMessage\": {\n              \"$ref\": \"#/components/schemas/IPackedDIDCommMessage\"\n            },\n            \"messageId\": {\n              \"type\": \"string\"\n            },\n            \"returnTransportId\": {\n              \"type\": \"string\"\n            },\n            \"recipientDidUrl\": {\n              \"type\": \"string\"\n            }\n          },\n          \"required\": [\n            \"packedMessage\",\n            \"messageId\",\n            \"recipientDidUrl\"\n          ],\n          \"description\": \"The input to the  {@link  IDIDComm.sendDIDCommMessage }  method. The provided `messageId` will be used in the emitted event to allow event/message correlation.\"\n        },\n        \"ISendDIDCommMessageResponse\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"transportId\": {\n              \"type\": \"string\"\n            },\n            \"returnMessage\": {\n              \"$ref\": \"#/components/schemas/IMessage\"\n            }\n          },\n          \"required\": [\n            \"transportId\"\n          ],\n          \"description\": \"The response from the  {@link  IDIDComm.sendDIDCommMessage }  method.\"\n        },\n        \"IMessage\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"id\": {\n              \"type\": \"string\",\n              \"description\": \"Unique message ID\"\n            },\n            \"type\": {\n              \"type\": \"string\",\n              \"description\": \"Message type\"\n            },\n            \"createdAt\": {\n              \"type\": \"string\",\n              \"description\": \"Optional. Creation date (ISO 8601)\"\n            },\n            \"expiresAt\": {\n              \"type\": \"string\",\n              \"description\": \"Optional. Expiration date (ISO 8601)\"\n            },\n            \"threadId\": {\n              \"type\": \"string\",\n              \"description\": \"Optional. Thread ID\"\n            },\n            \"raw\": {\n              \"type\": \"string\",\n              \"description\": \"Optional. Original message raw data\"\n            },\n            \"data\": {\n              \"anyOf\": [\n                {\n                  \"type\": \"object\"\n                },\n                {\n                  \"type\": \"null\"\n                }\n              ],\n              \"description\": \"Optional. Parsed data\"\n            },\n            \"replyTo\": {\n              \"type\": \"array\",\n              \"items\": {\n                \"type\": \"string\"\n              },\n              \"description\": \"Optional. List of DIDs to reply to\"\n            },\n            \"replyUrl\": {\n              \"type\": \"string\",\n              \"description\": \"Optional. URL to post a reply message to\"\n            },\n            \"from\": {\n              \"type\": \"string\",\n              \"description\": \"Optional. Sender DID\"\n            },\n            \"to\": {\n              \"type\": \"string\",\n              \"description\": \"Optional. Recipient DID\"\n            },\n            \"metaData\": {\n              \"anyOf\": [\n                {\n                  \"type\": \"array\",\n                  \"items\": {\n                    \"$ref\": \"#/components/schemas/IMetaData\"\n                  }\n                },\n                {\n                  \"type\": \"null\"\n                }\n              ],\n              \"description\": \"Optional. Array of message metadata\"\n            },\n            \"credentials\": {\n              \"type\": \"array\",\n              \"items\": {\n                \"$ref\": \"#/components/schemas/VerifiableCredential\"\n              },\n              \"description\": \"Optional. Array of attached verifiable credentials\"\n            },\n            \"presentations\": {\n              \"type\": \"array\",\n              \"items\": {\n                \"$ref\": \"#/components/schemas/VerifiablePresentation\"\n              },\n              \"description\": \"Optional. Array of attached verifiable presentations\"\n            },\n            \"attachments\": {\n              \"type\": \"array\",\n              \"items\": {\n                \"$ref\": \"#/components/schemas/IMessageAttachment\"\n              },\n              \"description\": \"Optional. Array of generic attachments\"\n            },\n            \"returnRoute\": {\n              \"type\": \"string\",\n              \"description\": \"Optional. Signal how to reuse transport for return messages\"\n            }\n          },\n          \"required\": [\n            \"id\",\n            \"type\"\n          ],\n          \"description\": \"Represents a DIDComm v1 message payload, with optionally decoded credentials and presentations.\"\n        },\n        \"IMetaData\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"type\": {\n              \"type\": \"string\",\n              \"description\": \"Type\"\n            },\n            \"value\": {\n              \"type\": \"string\",\n              \"description\": \"Optional. Value\"\n            }\n          },\n          \"required\": [\n            \"type\"\n          ],\n          \"description\": \"Message meta data\"\n        },\n        \"VerifiableCredential\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"proof\": {\n              \"$ref\": \"#/components/schemas/ProofType\"\n            },\n            \"issuer\": {\n              \"$ref\": \"#/components/schemas/IssuerType\"\n            },\n            \"credentialSubject\": {\n              \"$ref\": \"#/components/schemas/CredentialSubject\"\n            },\n            \"type\": {\n              \"anyOf\": [\n                {\n                  \"type\": \"array\",\n                  \"items\": {\n                    \"type\": \"string\"\n                  }\n                },\n                {\n                  \"type\": \"string\"\n                }\n              ]\n            },\n            \"@context\": {\n              \"$ref\": \"#/components/schemas/ContextType\"\n            },\n            \"issuanceDate\": {\n              \"type\": \"string\"\n            },\n            \"expirationDate\": {\n              \"type\": \"string\"\n            },\n            \"credentialStatus\": {\n              \"$ref\": \"#/components/schemas/CredentialStatusReference\"\n            },\n            \"id\": {\n              \"type\": \"string\"\n            }\n          },\n          \"required\": [\n            \"@context\",\n            \"credentialSubject\",\n            \"issuanceDate\",\n            \"issuer\",\n            \"proof\"\n          ],\n          \"description\": \"Represents a signed Verifiable Credential payload (includes proof), using a JSON representation. See  {@link https://www.w3.org/TR/vc-data-model/#credentials | VC data model }\"\n        },\n        \"ProofType\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"type\": {\n              \"type\": \"string\"\n            },\n            \"proofValue\": {\n              \"type\": \"string\"\n            }\n          },\n          \"description\": \"A proof property of a  {@link  VerifiableCredential }  or  {@link  VerifiablePresentation }\"\n        },\n        \"IssuerType\": {\n          \"anyOf\": [\n            {\n              \"type\": \"object\",\n              \"properties\": {\n                \"id\": {\n                  \"type\": \"string\"\n                }\n              },\n              \"required\": [\n                \"id\"\n              ]\n            },\n            {\n              \"type\": \"string\"\n            }\n          ],\n          \"description\": \"The issuer of a  {@link  VerifiableCredential }  or the holder of a  {@link  VerifiablePresentation } .\\n\\nThe value of the issuer property MUST be either a URI or an object containing an id property. It is RECOMMENDED that the URI in the issuer or its id be one which, if de-referenced, results in a document containing machine-readable information about the issuer that can be used to verify the information expressed in the credential.\\n\\nSee  {@link https://www.w3.org/TR/vc-data-model/#issuer | Issuer data model }\"\n        },\n        \"CredentialSubject\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"id\": {\n              \"type\": \"string\"\n            }\n          },\n          \"description\": \"The value of the credentialSubject property is defined as a set of objects that contain one or more properties that are each related to a subject of the verifiable credential. Each object MAY contain an id.\\n\\nSee  {@link https://www.w3.org/TR/vc-data-model/#credential-subject | Credential Subject }\"\n        },\n        \"ContextType\": {\n          \"anyOf\": [\n            {\n              \"type\": \"string\"\n            },\n            {\n              \"type\": \"object\"\n            },\n            {\n              \"type\": \"array\",\n              \"items\": {\n                \"anyOf\": [\n                  {\n                    \"type\": \"string\"\n                  },\n                  {\n                    \"type\": \"object\"\n                  }\n                ]\n              }\n            }\n          ],\n          \"description\": \"The data type for `@context` properties of credentials, presentations, etc.\"\n        },\n        \"CredentialStatusReference\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"id\": {\n              \"type\": \"string\"\n            },\n            \"type\": {\n              \"type\": \"string\"\n            }\n          },\n          \"required\": [\n            \"id\",\n            \"type\"\n          ],\n          \"description\": \"Used for the discovery of information about the current status of a verifiable credential, such as whether it is suspended or revoked. The precise contents of the credential status information are determined by the specific `credentialStatus` type  definition and vary depending on factors such as whether it is simple to implement or if it is privacy-enhancing.\\n\\nSee  {@link https://www.w3.org/TR/vc-data-model/#status | Credential Status }\"\n        },\n        \"VerifiablePresentation\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"proof\": {\n              \"$ref\": \"#/components/schemas/ProofType\"\n            },\n            \"holder\": {\n              \"type\": \"string\"\n            },\n            \"verifiableCredential\": {\n              \"type\": \"array\",\n              \"items\": {\n                \"$ref\": \"#/components/schemas/W3CVerifiableCredential\"\n              }\n            },\n            \"type\": {\n              \"anyOf\": [\n                {\n                  \"type\": \"array\",\n                  \"items\": {\n                    \"type\": \"string\"\n                  }\n                },\n                {\n                  \"type\": \"string\"\n                }\n              ]\n            },\n            \"@context\": {\n              \"$ref\": \"#/components/schemas/ContextType\"\n            },\n            \"verifier\": {\n              \"type\": \"array\",\n              \"items\": {\n                \"type\": \"string\"\n              }\n            },\n            \"issuanceDate\": {\n              \"type\": \"string\"\n            },\n            \"expirationDate\": {\n              \"type\": \"string\"\n            },\n            \"id\": {\n              \"type\": \"string\"\n            }\n          },\n          \"required\": [\n            \"@context\",\n            \"holder\",\n            \"proof\"\n          ],\n          \"description\": \"Represents a signed Verifiable Presentation (includes proof), using a JSON representation. See  {@link https://www.w3.org/TR/vc-data-model/#presentations | VP data model }\"\n        },\n        \"W3CVerifiableCredential\": {\n          \"anyOf\": [\n            {\n              \"$ref\": \"#/components/schemas/VerifiableCredential\"\n            },\n            {\n              \"$ref\": \"#/components/schemas/CompactJWT\"\n            }\n          ],\n          \"description\": \"Represents a signed Verifiable Credential (includes proof), in either JSON or compact JWT format. See  {@link https://www.w3.org/TR/vc-data-model/#credentials | VC data model }  See  {@link https://www.w3.org/TR/vc-data-model-1.1/#proof-formats | proof formats }\"\n        },\n        \"CompactJWT\": {\n          \"type\": \"string\",\n          \"description\": \"Represents a Json Web Token in compact form. \\\"header.payload.signature\\\"\"\n        },\n        \"IMessageAttachment\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"id\": {\n              \"type\": \"string\"\n            },\n            \"description\": {\n              \"type\": \"string\"\n            },\n            \"filename\": {\n              \"type\": \"string\"\n            },\n            \"media_type\": {\n              \"type\": \"string\"\n            },\n            \"format\": {\n              \"type\": \"string\"\n            },\n            \"lastmod_time\": {\n              \"type\": \"string\"\n            },\n            \"byte_count\": {\n              \"type\": \"number\"\n            },\n            \"data\": {\n              \"$ref\": \"#/components/schemas/IMessageAttachmentData\"\n            }\n          },\n          \"required\": [\n            \"data\"\n          ],\n          \"description\": \"Message attachment\"\n        },\n        \"IMessageAttachmentData\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"jws\": {},\n            \"hash\": {\n              \"type\": \"string\"\n            },\n            \"links\": {\n              \"type\": \"array\",\n              \"items\": {\n                \"type\": \"string\"\n              }\n            },\n            \"base64\": {\n              \"type\": \"string\"\n            },\n            \"json\": {}\n          },\n          \"description\": \"The DIDComm message structure for data in an attachment. See https://identity.foundation/didcomm-messaging/spec/#attachments\"\n        },\n        \"ISendMessageDIDCommAlpha1Args\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"url\": {\n              \"type\": \"string\"\n            },\n            \"save\": {\n              \"type\": \"boolean\"\n            },\n            \"data\": {\n              \"type\": \"object\",\n              \"properties\": {\n                \"id\": {\n                  \"type\": \"string\"\n                },\n                \"from\": {\n                  \"type\": \"string\"\n                },\n                \"to\": {\n                  \"type\": \"string\"\n                },\n                \"type\": {\n                  \"type\": \"string\"\n                },\n                \"body\": {\n                  \"anyOf\": [\n                    {\n                      \"type\": \"object\"\n                    },\n                    {\n                      \"type\": \"string\"\n                    }\n                  ]\n                }\n              },\n              \"required\": [\n                \"from\",\n                \"to\",\n                \"type\",\n                \"body\"\n              ]\n            },\n            \"headers\": {\n              \"type\": \"object\",\n              \"additionalProperties\": {\n                \"type\": \"string\"\n              }\n            }\n          },\n          \"required\": [\n            \"data\"\n          ],\n          \"deprecated\": \"Please use {@link IDIDComm.sendDIDCommMessage } instead. This will be removed in Veramo 4.0.\\nInput arguments for {@link IDIDComm.sendMessageDIDCommAlpha1 }\"\n        },\n        \"IUnpackDIDCommMessageArgs\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"resolutionOptions\": {\n              \"type\": \"object\",\n              \"properties\": {\n                \"publicKeyFormat\": {\n                  \"type\": \"string\"\n                },\n                \"accept\": {\n                  \"type\": \"string\"\n                }\n              },\n              \"description\": \"Options to be passed to the DID resolver.\"\n            },\n            \"message\": {\n              \"type\": \"string\"\n            }\n          },\n          \"required\": [\n            \"message\"\n          ],\n          \"description\": \"The input to the  {@link  IDIDComm.unpackDIDCommMessage }  method.\"\n        },\n        \"IUnpackedDIDCommMessage\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"metaData\": {\n              \"$ref\": \"#/components/schemas/IDIDCommMessageMetaData\"\n            },\n            \"message\": {\n              \"$ref\": \"#/components/schemas/IDIDCommMessage\"\n            }\n          },\n          \"required\": [\n            \"metaData\",\n            \"message\"\n          ],\n          \"description\": \"The result of unpacking a DIDComm v2 message.\"\n        },\n        \"IDIDCommMessageMetaData\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"packing\": {\n              \"$ref\": \"#/components/schemas/DIDCommMessagePacking\"\n            }\n          },\n          \"required\": [\n            \"packing\"\n          ],\n          \"description\": \"Metadata resulting from unpacking a DIDComm v2 message.\"\n        }\n      },\n      \"methods\": {\n        \"getDIDCommMessageMediaType\": {\n          \"description\": \"Partially decodes a possible DIDComm message string to determine the \",\n          \"arguments\": {\n            \"$ref\": \"#/components/schemas/IPackedDIDCommMessage\"\n          },\n          \"returnType\": {\n            \"$ref\": \"#/components/schemas/DIDCommMessageMediaType\"\n          }\n        },\n        \"packDIDCommMessage\": {\n          \"description\": \"Packs a \",\n          \"arguments\": {\n            \"$ref\": \"#/components/schemas/IPackDIDCommMessageArgs\"\n          },\n          \"returnType\": {\n            \"$ref\": \"#/components/schemas/IPackedDIDCommMessage\"\n          }\n        },\n        \"sendDIDCommMessage\": {\n          \"description\": \"Sends the given message to the recipient. If a return-transport is provided it will be checked whether the parent thread allows reusing the route. You cannot reuse the transport if the message was forwarded from a DIDComm mediator.\",\n          \"arguments\": {\n            \"$ref\": \"#/components/schemas/ISendDIDCommMessageArgs\"\n          },\n          \"returnType\": {\n            \"$ref\": \"#/components/schemas/ISendDIDCommMessageResponse\"\n          }\n        },\n        \"sendMessageDIDCommAlpha1\": {\n          \"description\": \"\",\n          \"arguments\": {\n            \"$ref\": \"#/components/schemas/ISendMessageDIDCommAlpha1Args\"\n          },\n          \"returnType\": {\n            \"$ref\": \"#/components/schemas/IMessage\"\n          }\n        },\n        \"unpackDIDCommMessage\": {\n          \"description\": \"Unpacks a possible DIDComm message and returns the \",\n          \"arguments\": {\n            \"$ref\": \"#/components/schemas/IUnpackDIDCommMessageArgs\"\n          },\n          \"returnType\": {\n            \"$ref\": \"#/components/schemas/IUnpackedDIDCommMessage\"\n          }\n        }\n      }\n    }\n  }\n}"
  },
  {
    "path": "packages/did-comm/src/protocols/coordinate-mediation-message-handler.ts",
    "content": "import { IAgentContext, IDIDManager, IKeyManager, IDataStore } from '@veramo/core-types'\nimport { AbstractMessageHandler, Message } from '@veramo/message-handler'\nimport Debug from 'debug'\nimport { v4 } from 'uuid'\nimport { IDIDComm } from '../types/IDIDComm.js'\nimport { IDIDCommMessage, DIDCommMessageMediaType } from '../types/message-types.js'\nimport { asArray } from '@veramo/utils'\n\nconst debug = Debug('veramo:did-comm:coordinate-mediation-message-handler')\n\ntype IContext = IAgentContext<IDIDManager & IKeyManager & IDIDComm & IDataStore>\n\n/**\n * @beta This API may change without a BREAKING CHANGE notice.\n */\nexport const MEDIATE_REQUEST_MESSAGE_TYPE = 'https://didcomm.org/coordinate-mediation/2.0/mediate-request'\n\n/**\n * @beta This API may change without a BREAKING CHANGE notice.\n */\nexport const MEDIATE_GRANT_MESSAGE_TYPE = 'https://didcomm.org/coordinate-mediation/2.0/mediate-grant'\n\n/**\n * @beta This API may change without a BREAKING CHANGE notice.\n */\nexport const MEDIATE_DENY_MESSAGE_TYPE = 'https://didcomm.org/coordinate-mediation/2.0/mediate-deny'\n\n/**\n * @beta This API may change without a BREAKING CHANGE notice.\n */\nexport const STATUS_REQUEST_MESSAGE_TYPE = 'https://didcomm.org/messagepickup/3.0/status-request'\n\n/**\n * @beta This API may change without a BREAKING CHANGE notice.\n */\nexport const DELIVERY_REQUEST_MESSAGE_TYPE = 'https://didcomm.org/messagepickup/3.0/delivery-request'\n\n/**\n * @beta This API may change without a BREAKING CHANGE notice.\n */\nexport function createMediateRequestMessage(\n  recipientDidUrl: string,\n  mediatorDidUrl: string,\n): IDIDCommMessage {\n  return {\n    type: MEDIATE_REQUEST_MESSAGE_TYPE,\n    from: recipientDidUrl,\n    to: [mediatorDidUrl],\n    id: v4(),\n    return_route: 'all',\n    created_time: (new Date()).toISOString(),\n    body: {},\n  }\n}\n\n/**\n * @beta This API may change without a BREAKING CHANGE notice.\n */\nexport function createMediateGrantMessage(\n  recipientDidUrl: string,\n  mediatorDidUrl: string,\n  thid: string,\n): IDIDCommMessage {\n  return {\n    type: MEDIATE_GRANT_MESSAGE_TYPE,\n    from: mediatorDidUrl,\n    to: [recipientDidUrl],\n    id: v4(),\n    thid: thid,\n    created_time: (new Date()).toISOString(),\n    body: {\n      routing_did: [mediatorDidUrl],\n    },\n  }\n}\n\n/**\n * @beta This API may change without a BREAKING CHANGE notice.\n */\nexport function createStatusRequestMessage(\n  recipientDidUrl: string,\n  mediatorDidUrl: string,\n): IDIDCommMessage {\n  return {\n    id: v4(),\n    type: STATUS_REQUEST_MESSAGE_TYPE,\n    to: [mediatorDidUrl],\n    from: recipientDidUrl,\n    return_route: 'all',\n    body: {},\n  }\n}\n\n/**\n * @beta This API may change without a BREAKING CHANGE notice.\n */\nexport function createDeliveryRequestMessage(\n  recipientDidUrl: string,\n  mediatorDidUrl: string,\n): IDIDCommMessage {\n  return {\n    id: v4(),\n    type: DELIVERY_REQUEST_MESSAGE_TYPE,\n    to: [mediatorDidUrl],\n    from: recipientDidUrl,\n    return_route: 'all',\n    body: { limit: 2 },\n  }\n}\n\n/**\n * A plugin for the {@link @veramo/message-handler#MessageHandler} that handles Mediator Coordinator messages for the mediator role.\n * @beta This API may change without a BREAKING CHANGE notice.\n */\nexport class CoordinateMediationMediatorMessageHandler extends AbstractMessageHandler {\n  constructor() {\n    super()\n  }\n\n  /**\n   * Handles a Mediator Coordinator messages for the mediator role\n   * https://didcomm.org/mediator-coordination/2.0/\n   */\n  public async handle(message: Message, context: IContext): Promise<Message> {\n    if (message.type === MEDIATE_REQUEST_MESSAGE_TYPE) {\n      debug('MediateRequest Message Received')\n      try {\n        const { from, to, returnRoute } = message\n        if (!from) {\n          throw new Error('invalid_argument: MediateRequest received without `from` set')\n        }\n        if (!to) {\n          throw new Error('invalid_argument: MediateRequest received without `to` set')\n        }\n        if (returnRoute === 'all') {\n          // Grant requests to all recipients\n          // TODO: Come up with another method for approving and rejecting recipients\n          const response = createMediateGrantMessage(from, to, message.id)\n          const packedResponse = await context.agent.packDIDCommMessage({\n            message: response,\n            packing: 'authcrypt',\n          })\n          const returnResponse = {\n            id: response.id,\n            message: packedResponse.message,\n            contentType: DIDCommMessageMediaType.ENCRYPTED,\n          }\n          message.addMetaData({ type: 'ReturnRouteResponse', value: JSON.stringify(returnResponse) })\n\n          // Save message to track recipients\n          await context.agent.dataStoreSaveMessage({\n            message: {\n              type: response.type,\n              from: response.from,\n              to: asArray(response.to)[0],\n              id: response.id,\n              threadId: response.thid,\n              data: response.body,\n              createdAt: response.created_time\n            },\n          })\n        }\n      } catch (ex) {\n        debug(ex)\n      }\n      return message\n    }\n\n    return super.handle(message, context)\n  }\n}\n\n/**\n * A plugin for the {@link @veramo/message-handler#MessageHandler} that handles Mediator Coordinator messages for the recipient role.\n * @beta This API may change without a BREAKING CHANGE notice.\n */\nexport class CoordinateMediationRecipientMessageHandler extends AbstractMessageHandler {\n  constructor() {\n    super()\n  }\n\n  /**\n   * Handles a Mediator Coordinator messages for the recipient role\n   * https://didcomm.org/mediator-coordination/2.0/\n   */\n  public async handle(message: Message, context: IContext): Promise<Message> {\n    if (message.type === MEDIATE_GRANT_MESSAGE_TYPE) {\n      debug('MediateGrant Message Received')\n      try {\n        const { from, to, data, threadId } = message\n        if (!from) {\n          throw new Error('invalid_argument: MediateGrant received without `from` set')\n        }\n        if (!to) {\n          throw new Error('invalid_argument: MediateGrant received without `to` set')\n        }\n        if (!threadId) {\n          throw new Error('invalid_argument: MediateGrant received without `thid` set')\n        }\n        if (!data.routing_did || data.routing_did.length === 0) {\n          throw new Error('invalid_argument: MediateGrant received with invalid routing_did')\n        }\n        // If mediate request was previously sent, add service to DID document\n        const prevRequestMsg = await context.agent.dataStoreGetMessage({ id: threadId })\n        if (prevRequestMsg.from === to && prevRequestMsg.to === from) {\n          const service = {\n            id: 'didcomm-mediator',\n            type: 'DIDCommMessaging',\n            serviceEndpoint: [\n              {\n                uri: data.routing_did[0],\n              },\n            ],\n          }\n          await context.agent.didManagerAddService({\n            did: to,\n            service: service,\n          })\n          message.addMetaData({ type: 'DIDCommMessagingServiceAdded', value: JSON.stringify(service) })\n        }\n      } catch (ex) {\n        debug(ex)\n      }\n      return message\n    } else if (message.type === MEDIATE_DENY_MESSAGE_TYPE) {\n      debug('MediateDeny Message Received')\n      try {\n        const { from, to } = message\n        if (!from) {\n          throw new Error('invalid_argument: MediateGrant received without `from` set')\n        }\n        if (!to) {\n          throw new Error('invalid_argument: MediateGrant received without `to` set')\n        }\n\n        // Delete service if it exists\n        const did = await context.agent.didManagerGet({\n          did: to,\n        })\n        const existingService = did.services.find(\n          (s) =>\n            s.serviceEndpoint === from ||\n            (Array.isArray(s.serviceEndpoint) && s.serviceEndpoint.includes(from)),\n        )\n        if (existingService) {\n          await context.agent.didManagerRemoveService({ did: to, id: existingService.id })\n        }\n      } catch (ex) {\n        debug(ex)\n      }\n    }\n\n    return super.handle(message, context)\n  }\n}\n"
  },
  {
    "path": "packages/did-comm/src/protocols/coordinate-mediation-v3-message-handler.ts",
    "content": "import { IAgentContext, IDIDManager, IKeyManager } from '@veramo/core-types'\nimport { IMediationManager, MediationResponse, RecipientDid, RequesterDid } from '@veramo/mediation-manager'\n\nimport { AbstractMessageHandler, Message } from '@veramo/message-handler'\nimport Debug from 'debug'\nimport { v4 } from 'uuid'\nimport { IDIDComm } from '../types/IDIDComm.js'\nimport { DIDCommMessageMediaType, IDIDCommMessage } from '../types/message-types.js'\nimport { asArray } from '@veramo/utils'\n\nconst debug = Debug('veramo:did-comm:coordinate-mediation-message-handler')\n\nconst GRANTED = 'GRANTED'\nconst DENIED = 'DENIED'\n\ntype Context = IAgentContext<IDIDManager & IKeyManager & IDIDComm & IMediationManager>\n\n/**\n * @beta This API may change without a BREAKING CHANGE notice.\n *\n * Represents the actions (add or remove) that can be taken on a recipient did\n *\n * @see {@link @veramo/did-comm#CoordinateMediationV3MediatorMessageHandler}\n */\nexport enum UpdateAction {\n  ADD = 'add',\n  REMOVE = 'remove',\n}\n\n/**\n * @beta This API may change without a BREAKING CHANGE notice.\n *\n * Represents the result of an update action\n *\n * @see {@link @veramo/did-comm#CoordinateMediationV3MediatorMessageHandler}\n */\nexport enum RecipientUpdateResult {\n  SUCCESS = 'success',\n  NO_CHANGE = 'no_change',\n  CLIENT_ERROR = 'client_error',\n  SERVER_ERROR = 'server_error',\n}\n\n/**\n * @beta This API may change without a BREAKING CHANGE notice.\n *\n * Parameter options for the CoordinateMediationV3MediatorMessageHandler\n *   {@link @veramo/did-comm#CoordinateMediationV3MediatorMessageHandler}\n */\nexport interface CoordinateMediationV3MediatorMessageHandlerOptions {\n  isMediateDefaultGrantAll: boolean\n}\n\n/**\n * @beta This API may change without a BREAKING CHANGE notice.\n *\n * Represents the structure of a specific update on RECIPIENT_UPDATE\n */\nexport interface Update {\n  recipient_did: RecipientDid\n  action: UpdateAction\n}\n\n/**\n * @beta This API may change without a BREAKING CHANGE notice.\n *\n * Represents an update response on RECIPIENT_UPDATE_RESPONSE\n */\nexport interface UpdateResult extends Update {\n  result: RecipientUpdateResult\n}\n\ninterface Query {\n  limit: number\n  offset: number\n}\n\ninterface MediateRequestMessage extends Message {\n  to: string\n  from: RequesterDid\n  type: CoordinateMediation.MEDIATE_REQUEST\n}\n\ninterface RecipientUpdateMessage extends Message {\n  to: string\n  from: RequesterDid\n  type: CoordinateMediation.RECIPIENT_UPDATE\n  body: { updates: Update[] }\n  return_route: 'all'\n}\n\ninterface RecipientQueryMessage extends Message {\n  to: string\n  from: RequesterDid\n  type: CoordinateMediation.RECIPIENT_QUERY\n  body: { paginate?: Query }\n}\n\n/**\n * @beta This API may change without a BREAKING CHANGE notice.\n *\n * Represents the types of messages that can be sent and received by the Mediator Coordinator protocol\n *\n * @see {@link @veramo/did-comm#CoordinateMediationV3MediatorMessageHandler}\n * @see {@link @veramo/did-comm#CoordinateMediationRecipientMessageHandler}\n */\nexport enum CoordinateMediation {\n  MEDIATE_REQUEST = 'https://didcomm.org/coordinate-mediation/3.0/mediate-request',\n  MEDIATE_GRANT = 'https://didcomm.org/coordinate-mediation/3.0/mediate-grant',\n  MEDIATE_DENY = 'https://didcomm.org/coordinate-mediation/3.0/mediate-deny',\n  RECIPIENT_UPDATE = 'https://didcomm.org/coordinate-mediation/3.0/recipient-update',\n  RECIPIENT_UPDATE_RESPONSE = 'https://didcomm.org/coordinate-mediation/3.0/recipient-update-response',\n  RECIPIENT_QUERY = 'https://didcomm.org/coordinate-mediation/3.0/recipient-query',\n  RECIPIENT_QUERY_RESPONSE = 'https://didcomm.org/coordinate-mediation/3.0/recipient',\n}\n\n/**\n * @beta This API may change without a BREAKING CHANGE notice.\n */\nexport enum MessagePickup {\n  STATUS_REQUEST_MESSAGE_TYPE = 'https://didcomm.org/messagepickup/3.0/status-request',\n  DELIVERY_REQUEST_MESSAGE_TYPE = 'https://didcomm.org/messagepickup/3.0/delivery-request',\n}\n\n/**\n * @beta This API may change without a BREAKING CHANGE notice.\n */\nexport function createV3MediateGrantMessage(\n  recipientDidUrl: string,\n  mediatorDidUrl: string,\n  thid: string,\n): IDIDCommMessage {\n  return {\n    type: CoordinateMediation.MEDIATE_GRANT,\n    from: mediatorDidUrl,\n    to: [recipientDidUrl],\n    id: v4(),\n    thid: thid,\n    body: { routing_did: [mediatorDidUrl] },\n    created_time: new Date().toISOString(),\n  }\n}\n\n/**\n * @beta This API may change without a BREAKING CHANGE notice.\n */\nexport const createV3MediateDenyMessage = (\n  recipientDidUrl: string,\n  mediatorDidUrl: string,\n  thid: string,\n): IDIDCommMessage => {\n  return {\n    type: CoordinateMediation.MEDIATE_DENY,\n    from: mediatorDidUrl,\n    to: [recipientDidUrl],\n    id: v4(),\n    thid: thid,\n    created_time: new Date().toISOString(),\n    body: null,\n  }\n}\n\n/**\n * @beta This API may change without a BREAKING CHANGE notice.\n * @see {@link @veramo/did-comm#CoordinateMediationV3MediatorMessageHandler}\n */\nexport function createV3RecipientUpdateResponseMessage(\n  recipientDidUrl: string,\n  mediatorDidUrl: string,\n  thid: string,\n  updates: UpdateResult[],\n): IDIDCommMessage {\n  return {\n    type: CoordinateMediation.RECIPIENT_UPDATE_RESPONSE,\n    from: mediatorDidUrl,\n    to: [recipientDidUrl],\n    id: v4(),\n    thid: thid,\n    body: { updates },\n    created_time: new Date().toISOString(),\n  }\n}\n\n/**\n * @beta This API may change without a BREAKING CHANGE notice.\n * @see {@link @veramo/did-comm#CoordinateMediationV3MediatorMessageHandler}\n */\nexport const createV3RecipientQueryResponseMessage = (\n  recipientDidUrl: string,\n  mediatorDidUrl: string,\n  thid: string,\n  dids: Record<'recipient_did', RecipientDid>[],\n): IDIDCommMessage => {\n  return {\n    type: CoordinateMediation.RECIPIENT_QUERY_RESPONSE,\n    from: mediatorDidUrl,\n    to: [recipientDidUrl],\n    id: v4(),\n    thid: thid,\n    body: { dids },\n    created_time: new Date().toISOString(),\n  }\n}\n\n/**\n * @beta This API may change without a BREAKING CHANGE notice.\n *\n * @returns a structured message for the Mediator Coordinator protocol\n * @see {@link @veramo/did-comm#CoordinateMediationV3MediatorMessageHandler}\n */\nexport function createV3MediateRequestMessage(\n  recipientDidUrl: string,\n  mediatorDidUrl: string,\n): IDIDCommMessage {\n  return {\n    type: CoordinateMediation.MEDIATE_REQUEST,\n    from: recipientDidUrl,\n    to: [mediatorDidUrl],\n    id: v4(),\n    created_time: new Date().toISOString(),\n    body: {},\n  }\n}\n\n/**\n * @beta This API may change without a BREAKING CHANGE notice.\n */\nexport const createV3StatusRequestMessage = (\n  recipientDidUrl: string,\n  mediatorDidUrl: string,\n): IDIDCommMessage => {\n  return {\n    id: v4(),\n    type: MessagePickup.STATUS_REQUEST_MESSAGE_TYPE,\n    to: [mediatorDidUrl],\n    from: recipientDidUrl,\n    return_route: 'all',\n    body: {},\n  }\n}\n\n/**\n * @beta This API may change without a BREAKING CHANGE notice.\n *\n * @returns a structured upate message for the Mediator Coordinator protocol\n * @see {@link @veramo/did-comm#CoordinateMediationV3MediatorMessageHandler}\n */\nexport const createV3RecipientUpdateMessage = (\n  recipientDidUrl: string,\n  mediatorDidUrl: string,\n  updates: Update[],\n): IDIDCommMessage => {\n  return {\n    type: CoordinateMediation.RECIPIENT_UPDATE,\n    from: recipientDidUrl,\n    to: [mediatorDidUrl],\n    id: v4(),\n    created_time: new Date().toISOString(),\n    body: { updates },\n    return_route: 'all',\n  }\n}\n\n/**\n * @beta This API may change without a BREAKING CHANGE notice.\n *\n * @returns a structured query message for the Mediator Coordinator protocol\n * @see {@link @veramo/did-comm#CoordinateMediationV3MediatorMessageHandler}\n */\nexport const createV3RecipientQueryMessage = (\n  recipientDidUrl: string,\n  mediatorDidUrl: string,\n): IDIDCommMessage => {\n  return {\n    type: CoordinateMediation.RECIPIENT_QUERY,\n    from: recipientDidUrl,\n    to: [mediatorDidUrl],\n    id: v4(),\n    created_time: new Date().toISOString(),\n    body: {},\n  }\n}\n\n/**\n * @beta This API may change without a BREAKING CHANGE notice.\n */\nexport const createV3DeliveryRequestMessage = (\n  recipientDidUrl: string,\n  mediatorDidUrl: string,\n): IDIDCommMessage => {\n  return {\n    id: v4(),\n    type: MessagePickup.DELIVERY_REQUEST_MESSAGE_TYPE,\n    to: [mediatorDidUrl],\n    from: recipientDidUrl,\n    return_route: 'all',\n    body: { limit: 2 },\n  }\n}\n\n/**\n * Handler Type Guards\n */\n\nconst isMediateRequest = (message: Message): message is MediateRequestMessage => {\n  if (message.type !== CoordinateMediation.MEDIATE_REQUEST) return false\n  if (!message.from) throw new Error('invalid_argument: MediateRequest received without `from` set')\n  if (!message.to) throw new Error('invalid_argument: MediateRequest received without `to` set')\n  return true\n}\n\nconst isRecipientUpdate = (message: Message): message is RecipientUpdateMessage => {\n  if (message.type !== CoordinateMediation.RECIPIENT_UPDATE) return false\n  if (!message.from) throw new Error('invalid_argument: RecipientUpdate received without `from` set')\n  if (!message.to) throw new Error('invalid_argument: RecipientUpdate received without `to` set')\n  if (!('data' in message)) throw new Error('invalid_argument: RecipientUpdate received without `body` set')\n  if (!message.data || !message.data.updates) {\n    throw new Error('invalid_argument: RecipientUpdate received without `updates` set')\n  }\n  return true\n}\n\nconst isRecipientQuery = (message: Message): message is RecipientQueryMessage => {\n  if (message.type !== CoordinateMediation.RECIPIENT_QUERY) return false\n  if (!message.from) throw new Error('invalid_argument: RecipientQuery received without `from` set')\n  if (!message.to) throw new Error('invalid_argument: RecipientQuery received without `to` set')\n  return true\n}\n\n/**\n * A plugin for the {@link @veramo/message-handler#MessageHandler} that handles Mediator Coordinator messages for the\n * mediator role.\n * @beta This API may change without a BREAKING CHANGE notice.\n */\nexport class CoordinateMediationV3MediatorMessageHandler extends AbstractMessageHandler {\n  constructor() {\n    super()\n  }\n\n  private async grantOrDenyMediation(\n    { from: requesterDid }: Message,\n    context: Context,\n  ): Promise<MediationResponse> {\n    if (!requesterDid) return DENIED\n    const policy = await context.agent.mediationManagerGetMediationPolicy({ requesterDid })\n    if (await context.agent.isMediateDefaultGrantAll()) {\n      return policy === 'DENY' ? DENIED : GRANTED\n    } else {\n      return policy === 'ALLOW' ? GRANTED : DENIED\n    }\n  }\n\n  private async handleMediateRequest(message: MediateRequestMessage, context: Context): Promise<Message> {\n    try {\n      debug('MediateRequest Message Received')\n      const requesterDid = message.from\n      const status = await this.grantOrDenyMediation(message, context)\n      await context.agent.mediationManagerSaveMediation({ status, requesterDid })\n      const getResponse = status === GRANTED ? createV3MediateGrantMessage : createV3MediateDenyMessage\n      const response = getResponse(message.from, message.to, message.id)\n      const packedResponse = await context.agent.packDIDCommMessage({\n        message: response,\n        packing: 'authcrypt',\n      })\n      const returnResponse = {\n        id: response.id,\n        message: packedResponse.message,\n        contentType: DIDCommMessageMediaType.ENCRYPTED,\n      }\n      message.addMetaData({ type: 'ReturnRouteResponse', value: JSON.stringify(returnResponse) })\n\n      // Save message to track recipients\n      await context.agent.dataStoreSaveMessage({\n        message: {\n          type: response.type,\n          from: response.from,\n          to: asArray(response.to)[0],\n          id: response.id,\n          threadId: response.thid,\n          data: response.body,\n          createdAt: response.created_time,\n        },\n      })\n    } catch (error) {\n      debug(error)\n    }\n    return message\n  }\n\n  /**\n   * Used to notify the mediator of DIDs in use by the recipient\n   **/\n  private async handleRecipientUpdate(message: RecipientUpdateMessage, context: Context): Promise<Message> {\n    try {\n      debug('MediateRecipientUpdate Message Received')\n      const updates: Update[] = message.data.updates\n\n      const applyUpdate = async (requesterDid: RequesterDid, update: Update) => {\n        const { recipient_did: recipientDid } = update\n        try {\n          if (update.action === UpdateAction.ADD) {\n            await context.agent.mediationManagerAddRecipientDid({ requesterDid, recipientDid })\n            return { ...update, result: RecipientUpdateResult.SUCCESS }\n          } else if (update.action === UpdateAction.REMOVE) {\n            const result = await context.agent.mediationManagerRemoveRecipientDid({ recipientDid })\n            if (result) return { ...update, result: RecipientUpdateResult.SUCCESS }\n            return { ...update, result: RecipientUpdateResult.NO_CHANGE }\n          }\n          return { ...update, result: RecipientUpdateResult.CLIENT_ERROR }\n        } catch (ex) {\n          debug(ex)\n          return { ...update, result: RecipientUpdateResult.SERVER_ERROR }\n        }\n      }\n\n      const updated = await Promise.all(updates.map(async (u) => await applyUpdate(message.from, u)))\n      const response = createV3RecipientUpdateResponseMessage(message.from, message.to, message.id, updated)\n      const packedResponse = await context.agent.packDIDCommMessage({\n        message: response,\n        packing: 'authcrypt',\n      })\n      const returnResponse = {\n        id: response.id,\n        message: packedResponse.message,\n        contentType: DIDCommMessageMediaType.ENCRYPTED,\n      }\n      message.addMetaData({ type: 'ReturnRouteResponse', value: JSON.stringify(returnResponse) })\n\n      await context.agent.dataStoreSaveMessage({\n        message: {\n          type: response.type,\n          from: response.from,\n          to: asArray(response.to)[0],\n          id: response.id,\n          threadId: response.thid,\n          data: response.body,\n          createdAt: response.created_time,\n        },\n      })\n    } catch (error) {\n      debug(error)\n    }\n    return message\n  }\n\n  /**\n   * Query mediator for a list of DIDs registered for this connection\n   **/\n  private async handleRecipientQuery(message: RecipientQueryMessage, context: Context): Promise<Message> {\n    try {\n      const dids = await context.agent.mediationManagerListRecipientDids({ requesterDid: message.from })\n      const response = createV3RecipientQueryResponseMessage(\n        message.from,\n        message.to,\n        message.id,\n        dids.map((did) => ({ recipient_did: did })),\n      )\n      const packedResponse = await context.agent.packDIDCommMessage({\n        message: response,\n        packing: 'authcrypt',\n      })\n      const returnResponse = {\n        id: response.id,\n        message: packedResponse.message,\n        contentType: DIDCommMessageMediaType.ENCRYPTED,\n      }\n      message.addMetaData({ type: 'ReturnRouteResponse', value: JSON.stringify(returnResponse) })\n\n      await context.agent.dataStoreSaveMessage({\n        message: {\n          type: response.type,\n          from: response.from,\n          to: asArray(response.to)[0],\n          id: response.id,\n          threadId: response.thid,\n          data: response.body,\n          createdAt: response.created_time,\n        },\n      })\n    } catch (error) {\n      debug(error)\n    }\n    return message\n  }\n\n  /**\n   * Handles a Mediator Coordinator messages for the mediator role\n   * https://didcomm.org/mediator-coordination/3.0/\n   */\n  public async handle(message: Message, context: Context): Promise<Message> {\n    if (isMediateRequest(message)) return this.handleMediateRequest(message, context)\n    if (isRecipientUpdate(message)) return this.handleRecipientUpdate(message, context)\n    if (isRecipientQuery(message)) return this.handleRecipientQuery(message, context)\n    return super.handle(message, context)\n  }\n}\n\n/**\n * A plugin for the {@link @veramo/message-handler#MessageHandler} that handles Mediator Coordinator messages for the\n * recipient role.\n * @beta This API may change without a BREAKING CHANGE notice.\n */\nexport class CoordinateMediationV3RecipientMessageHandler extends AbstractMessageHandler {\n  constructor() {\n    super()\n  }\n\n  /**\n   * Handles a Mediator Coordinator messages for the recipient role\n   * https://didcomm.org/mediator-coordination/2.0/\n   */\n  public async handle(message: Message, context: Context): Promise<Message> {\n    if (message.type === CoordinateMediation.MEDIATE_GRANT) {\n      debug('MediateGrant Message Received')\n      try {\n        const { from, to, data, threadId } = message\n        if (!from) {\n          throw new Error('invalid_argument: MediateGrant received without `from` set')\n        }\n        if (!to) {\n          throw new Error('invalid_argument: MediateGrant received without `to` set')\n        }\n        if (!threadId) {\n          throw new Error('invalid_argument: MediateGrant received without `thid` set')\n        }\n        if (!data.routing_did || data.routing_did.length === 0) {\n          throw new Error('invalid_argument: MediateGrant received with invalid routing_did')\n        }\n        // If mediate request was previously sent, add service to DID document\n        const prevRequestMsg = await context.agent.dataStoreGetMessage({ id: threadId })\n        if (prevRequestMsg.from === to && prevRequestMsg.to === from) {\n          const service = {\n            id: 'didcomm-mediator',\n            type: 'DIDCommMessaging',\n            serviceEndpoint: [\n              {\n                uri: data.routing_did[0],\n              },\n            ],\n          }\n          await context.agent.didManagerAddService({\n            did: to,\n            service: service,\n          })\n          message.addMetaData({ type: 'DIDCommMessagingServiceAdded', value: JSON.stringify(service) })\n        }\n      } catch (ex) {\n        debug(ex)\n      }\n      return message\n    } else if (message.type === CoordinateMediation.MEDIATE_DENY) {\n      debug('MediateDeny Message Received')\n      try {\n        const { from, to } = message\n        if (!from) {\n          throw new Error('invalid_argument: MediateGrant received without `from` set')\n        }\n        if (!to) {\n          throw new Error('invalid_argument: MediateGrant received without `to` set')\n        }\n\n        // Delete service if it exists\n        const did = await context.agent.didManagerGet({\n          did: to,\n        })\n        const existingService = did.services.find(\n          (s) =>\n            s.serviceEndpoint === from ||\n            (Array.isArray(s.serviceEndpoint) && s.serviceEndpoint.includes(from)),\n        )\n        if (existingService) {\n          await context.agent.didManagerRemoveService({ did: to, id: existingService.id })\n        }\n      } catch (ex) {\n        debug(ex)\n      }\n    }\n\n    return super.handle(message, context)\n  }\n}\n"
  },
  {
    "path": "packages/did-comm/src/protocols/index.ts",
    "content": "export { TrustPingMessageHandler } from './trust-ping-message-handler.js'\nexport * from './coordinate-mediation-message-handler.js'\nexport * from './coordinate-mediation-v3-message-handler.js'\nexport { RoutingMessageHandler } from './routing-message-handler.js'\nexport {\n  PickupMediatorMessageHandler,\n  PickupRecipientMessageHandler,\n} from './messagepickup-message-handler.js'\n\n"
  },
  {
    "path": "packages/did-comm/src/protocols/messagepickup-message-handler.ts",
    "content": "import {\n  IAgentContext,\n  IDIDManager,\n  IKeyManager,\n  IDataStore,\n  IDataStoreORM,\n  IMessageHandler,\n  Where,\n  TMessageColumns,\n} from '@veramo/core-types'\nimport { AbstractMessageHandler, Message } from '@veramo/message-handler'\nimport Debug from 'debug'\nimport { v4 } from 'uuid'\nimport { IDIDComm } from '../types/IDIDComm.js'\nimport { QUEUE_MESSAGE_TYPE } from './routing-message-handler.js'\nimport { IDIDCommMessage, DIDCommMessageMediaType, IDIDCommMessageAttachment } from '../types/message-types.js'\nconst debug = Debug('veramo:did-comm:messagepickup-message-handler')\n\ntype IContext = IAgentContext<\n  IDIDManager & IKeyManager & IDIDComm & IDataStore & IDataStoreORM & IMessageHandler\n>\n\nexport const STATUS_REQUEST_MESSAGE_TYPE = 'https://didcomm.org/messagepickup/3.0/status-request'\nexport const STATUS_MESSAGE_TYPE = 'https://didcomm.org/messagepickup/3.0/status'\nexport const DELIVERY_REQUEST_MESSAGE_TYPE = 'https://didcomm.org/messagepickup/3.0/delivery-request'\nexport const DELIVERY_MESSAGE_TYPE = 'https://didcomm.org/messagepickup/3.0/delivery'\nexport const MESSAGES_RECEIVED_MESSAGE_TYPE = 'https://didcomm.org/messagepickup/3.0/messages-received'\n\nfunction generateGetMessagesWhereQuery(from: string, recipientKey?: string): Where<TMessageColumns>[] {\n  return [\n    {\n      column: 'type',\n      value: [QUEUE_MESSAGE_TYPE],\n      op: 'In',\n    },\n    recipientKey\n      ? {\n          column: 'to',\n          value: [recipientKey],\n          op: 'In',\n        }\n      : {\n          column: 'to',\n          value: [`${from}%`],\n          op: 'Like',\n        },\n  ]\n}\n\n/**\n * A plugin for the {@link @veramo/message-handler#MessageHandler} that handles Pickup messages for the mediator role.\n * @beta This API may change without a BREAKING CHANGE notice.\n */\nexport class PickupMediatorMessageHandler extends AbstractMessageHandler {\n  constructor() {\n    super()\n  }\n\n  /**\n   * Handles messages for Pickup protocol and mediator role\n   * https://didcomm.org/pickup/3.0/\n   */\n  public async handle(message: Message, context: IContext): Promise<Message> {\n    if (message.type === STATUS_REQUEST_MESSAGE_TYPE) {\n      debug('Status Request Message Received')\n      try {\n        await this.replyWithStatusMessage(message, context)\n      } catch (ex) {\n        debug(ex)\n      }\n      return message\n    } else if (message.type === DELIVERY_REQUEST_MESSAGE_TYPE) {\n      debug('Delivery Request Message Received')\n      try {\n        const { returnRoute, data, from, to } = message\n\n        if (!to) {\n          throw new Error('invalid_argument: DeliveryRequest received without `to` set')\n        }\n        if (!from) {\n          throw new Error('invalid_argument: DeliveryRequest received without `from` set')\n        }\n        if (!data.limit || Number.isNaN(data.limit)) {\n          throw new Error('invalid_argument: DeliveryRequest received without `body.limit` set')\n        }\n\n        if (returnRoute === 'all') {\n          const queuedMessages = await context.agent.dataStoreORMGetMessages({\n            where: generateGetMessagesWhereQuery(from, data.recipient_key),\n            take: data.limit,\n          })\n\n          if (queuedMessages.length == 0) {\n            await this.replyWithStatusMessage(message, context)\n            return message\n          }\n\n          const attachments: IDIDCommMessageAttachment[] = queuedMessages.map((message) => {\n            return {\n              id: message.id,\n              media_type: DIDCommMessageMediaType.ENCRYPTED,\n              data: {\n                json: JSON.parse(message.raw!),\n              },\n            }\n          })\n          const replyRecipientKey = data.recipient_key ? { recipient_key: data.recipient_key } : {}\n          const replyMessage: IDIDCommMessage = {\n            type: DELIVERY_MESSAGE_TYPE,\n            from: to,\n            to: [from],\n            id: v4(),\n            thid: message.threadId ?? message.id,\n            created_time: new Date().toISOString(),\n            body: {\n              ...replyRecipientKey,\n            },\n            attachments,\n          }\n          const packedResponse = await context.agent.packDIDCommMessage({\n            message: replyMessage,\n            packing: 'authcrypt',\n          })\n          const returnResponse = {\n            id: replyMessage.id,\n            message: packedResponse.message,\n            contentType: DIDCommMessageMediaType.ENCRYPTED,\n          }\n          message.addMetaData({ type: 'ReturnRouteResponse', value: JSON.stringify(returnResponse) })\n        } else {\n          throw new Error('No return_route found for DeliveryRequest')\n        }\n      } catch (ex) {\n        debug(ex)\n      }\n      return message\n    } else if (message.type === MESSAGES_RECEIVED_MESSAGE_TYPE) {\n      debug('MessagesReceived Message Received')\n      try {\n        const { data, from } = message\n\n        if (!from) {\n          throw new Error('invalid_argument: MessagesReceived received without `from` set')\n        }\n        if (!data.message_id_list || !Array.isArray(data.message_id_list)) {\n          throw new Error('invalid_argument: MessagesReceived received without `body.message_id_list` set')\n        }\n\n        await Promise.all(\n          data.message_id_list.map(async (messageId: string) => {\n            const message = await context.agent.dataStoreGetMessage({ id: messageId })\n\n            // Delete message if meant for recipient\n            if (message.to?.startsWith(`${from}#`)) {\n              await context.agent.dataStoreDeleteMessage({ id: messageId })\n              context.agent.emit('DIDCommV2Message-forwardMessageDequeued', messageId)\n            }\n          }),\n        )\n\n        await this.replyWithStatusMessage(message, context)\n      } catch (ex) {\n        debug(ex)\n      }\n    }\n\n    return super.handle(message, context)\n  }\n\n  private async replyWithStatusMessage(message: Message, context: IContext) {\n    const { returnRoute, data, from, to } = message\n\n    if (!to) {\n      throw new Error('invalid_argument: StatusRequest received without `to` set')\n    }\n    if (!from) {\n      throw new Error('invalid_argument: StatusRequest received without `from` set')\n    }\n\n    if (returnRoute === 'all') {\n      const queuedMessageCount = await context.agent.dataStoreORMGetMessagesCount({\n        where: generateGetMessagesWhereQuery(from, data.recipient_key),\n      })\n\n      const replyRecipientKey = data.recipient_key ? { recipient_key: data.recipient_key } : {}\n      const replyMessage: IDIDCommMessage = {\n        type: STATUS_MESSAGE_TYPE,\n        from: to,\n        to: [from],\n        id: v4(),\n        thid: message.threadId ?? message.id,\n        created_time: new Date().toISOString(),\n        body: {\n          message_count: queuedMessageCount,\n          live_delivery: false,\n          ...replyRecipientKey,\n        },\n      }\n      const packedResponse = await context.agent.packDIDCommMessage({\n        message: replyMessage,\n        packing: 'authcrypt',\n      })\n      const returnResponse = {\n        id: replyMessage.id,\n        message: packedResponse.message,\n        contentType: DIDCommMessageMediaType.ENCRYPTED,\n      }\n      message.addMetaData({ type: 'ReturnRouteResponse', value: JSON.stringify(returnResponse) })\n    } else {\n      throw new Error('No return_route found for StatusRequest')\n    }\n  }\n}\n\n/**\n * A plugin for the {@link @veramo/message-handler#MessageHandler} that handles Pickup messages for the mediator role.\n * @beta This API may change without a BREAKING CHANGE notice.\n */\nexport class PickupRecipientMessageHandler extends AbstractMessageHandler {\n  constructor() {\n    super()\n  }\n\n  /**\n   * Handles messages for Pickup protocol and recipient role\n   * https://didcomm.org/pickup/3.0/\n   */\n  public async handle(message: Message, context: IContext): Promise<Message> {\n    if (message.type === DELIVERY_MESSAGE_TYPE) {\n      debug('Message Delivery batch Received')\n      try {\n        const { attachments, to, from } = message\n\n        if (!to) {\n          throw new Error('invalid_argument: StatusRequest received without `to` set')\n        }\n        if (!from) {\n          throw new Error('invalid_argument: StatusRequest received without `from` set')\n        }\n\n        if (!attachments) {\n          throw new Error('invalid_argument: MessagesDelivery received without `attachments` set')\n        }\n\n        // 1. Handle batch of messages\n        const messageIds = await Promise.all(\n          attachments.map(async (attachment) => {\n            await context.agent.handleMessage({\n              raw: JSON.stringify(attachment.data.json),\n              metaData: [{ type: 'didCommMsgFromMediator', value: attachment.id }],\n            })\n            return attachment.id\n          }),\n        )\n\n        // 2. Reply with messages-received\n        const replyMessage: IDIDCommMessage = {\n          type: MESSAGES_RECEIVED_MESSAGE_TYPE,\n          from: to,\n          to: [from],\n          id: v4(),\n          thid: message.threadId ?? message.id,\n          created_time: new Date().toISOString(),\n          return_route: 'all',\n          body: {\n            message_id_list: messageIds,\n          },\n        }\n        const packedResponse = await context.agent.packDIDCommMessage({\n          message: replyMessage,\n          packing: 'authcrypt',\n        })\n        await context.agent.sendDIDCommMessage({\n          packedMessage: packedResponse,\n          messageId: replyMessage.id,\n          recipientDidUrl: from,\n        })\n      } catch (ex) {\n        debug(ex)\n      }\n      return message\n    }\n\n    return super.handle(message, context)\n  }\n}\n"
  },
  {
    "path": "packages/did-comm/src/protocols/routing-message-handler.ts",
    "content": "import { IAgentContext, IDIDManager, IKeyManager, IDataStore, IDataStoreORM } from '@veramo/core-types'\nimport { IMediationManager, RecipientDid } from '@veramo/mediation-manager'\nimport { AbstractMessageHandler, Message } from '@veramo/message-handler'\nimport Debug from 'debug'\nimport { v4 } from 'uuid'\nimport { IDIDComm } from '../types/IDIDComm.js'\nimport {\n  MEDIATE_DENY_MESSAGE_TYPE,\n  MEDIATE_GRANT_MESSAGE_TYPE,\n} from './coordinate-mediation-message-handler.js'\n\nconst debug = Debug('veramo:did-comm:routing-message-handler')\n\ntype IContext = IAgentContext<\n  IDIDManager & IKeyManager & IDIDComm & IDataStore & IDataStoreORM & IMediationManager\n>\n\nexport const FORWARD_MESSAGE_TYPE = 'https://didcomm.org/routing/2.0/forward'\nexport const QUEUE_MESSAGE_TYPE = 'https://didcomm.org/routing/2.0/forward/queue-message'\n\n/**\n * A plugin for the {@link @veramo/message-handler#MessageHandler} that handles forward messages for the Routing\n * protocol.\n * @beta This API may change without a BREAKING CHANGE notice.\n */\nexport class RoutingMessageHandler extends AbstractMessageHandler {\n  constructor() {\n    super()\n  }\n\n  private isV2MediationGranted = async (message: Message, context: IContext): Promise<boolean> => {\n    // Check if receiver has been granted mediation\n    const mediationResponses = await context.agent.dataStoreORMGetMessages({\n      where: [\n        {\n          column: 'type',\n          value: [MEDIATE_GRANT_MESSAGE_TYPE, MEDIATE_DENY_MESSAGE_TYPE],\n          op: 'In',\n        },\n        {\n          column: 'to',\n          value: [message.data.next],\n          op: 'In',\n        },\n      ],\n      order: [{ column: 'createdAt', direction: 'DESC' }],\n    })\n    return mediationResponses.length > 0 && mediationResponses[0].type === MEDIATE_GRANT_MESSAGE_TYPE\n  }\n\n  private isV3MediationGranted = async (recipientDid: RecipientDid, context: IContext): Promise<boolean> => {\n    /**\n     * NOTE: the below check is used to determine if the agent is using the v3 mediation manager\n     **/\n    if (typeof context.agent.mediationManagerIsMediationGranted === 'function') {\n      return await context.agent.mediationManagerIsMediationGranted({ recipientDid })\n    }\n    return false\n  }\n\n  /**\n   * Handles forward messages for Routing protocol\n   * https://didcomm.org/routing/2.0/\n   */\n  public async handle(message: Message, context: IContext): Promise<Message> {\n    if (message.type === FORWARD_MESSAGE_TYPE) {\n      debug('Forward Message Received')\n      try {\n        const { attachments, data: { next: recipientDid = '' } = {} } = message\n        if (!attachments) throw new Error('invalid_argument: Forward received without `attachments` set')\n        if (!recipientDid) throw new Error('invalid_argument: Forward received without `body.next` set')\n\n        if (attachments.length) {\n          const isMediationGranted =\n            (await this.isV3MediationGranted(recipientDid, context)) ||\n            (await this.isV2MediationGranted(message, context))\n\n          if (isMediationGranted) {\n            const recipients = attachments[0].data.json.recipients\n            for (let i = 0; i < recipients.length; i++) {\n              const recipient = recipients[i].header.kid\n\n              // Save message for queue\n              const messageToQueue = new Message({ raw: JSON.stringify(attachments[0].data.json) })\n              messageToQueue.id = v4()\n              messageToQueue.type = QUEUE_MESSAGE_TYPE\n              messageToQueue.to = recipient\n              messageToQueue.createdAt = new Date().toISOString()\n              messageToQueue.addMetaData({ type: 'didCommForwardMsgId', value: message.id })\n\n              await context.agent.dataStoreSaveMessage({ message: messageToQueue })\n              context.agent.emit('DIDCommV2Message-forwardMessageQueued', messageToQueue)\n            }\n          } else {\n            debug('Forward received for DID without granting mediation')\n          }\n        }\n      } catch (ex) {\n        debug(ex)\n      }\n      return message\n    }\n\n    return super.handle(message, context)\n  }\n}\n"
  },
  {
    "path": "packages/did-comm/src/protocols/trust-ping-message-handler.ts",
    "content": "import { IAgentContext, IDIDManager, IKeyManager } from '@veramo/core-types'\nimport { AbstractMessageHandler, Message } from '@veramo/message-handler'\nimport Debug from 'debug'\nimport { v4 } from 'uuid'\nimport { IDIDComm } from '../types/IDIDComm.js'\nimport { DIDCommMessageMediaType, IDIDCommMessage } from '../types/message-types.js'\n\nconst debug = Debug('veramo:did-comm:trust-ping-message-handler')\n\ntype IContext = IAgentContext<IDIDManager & IKeyManager & IDIDComm>\n\nconst TRUST_PING_MESSAGE_TYPE = 'https://didcomm.org/trust-ping/2.0/ping'\nconst TRUST_PING_RESPONSE_MESSAGE_TYPE = 'https://didcomm.org/trust-ping/2.0/ping-response'\n\nexport function createTrustPingMessage(senderDidUrl: string, recipientDidUrl: string): IDIDCommMessage {\n  return {\n    type: TRUST_PING_MESSAGE_TYPE,\n    from: senderDidUrl,\n    to: [recipientDidUrl],\n    id: v4(),\n    body: {\n      responseRequested: true,\n    },\n  }\n}\n\nexport function createTrustPingResponse(\n  senderDidUrl: string,\n  recipientDidUrl: string,\n  pingId: string,\n): IDIDCommMessage {\n  return {\n    type: TRUST_PING_RESPONSE_MESSAGE_TYPE,\n    from: senderDidUrl,\n    to: [recipientDidUrl],\n    id: `${pingId}-response`,\n    thid: pingId,\n    body: {},\n  }\n}\n\n/**\n * A plugin for the {@link @veramo/message-handler#MessageHandler} that handles Trust Ping messages.\n * @beta This API may change without a BREAKING CHANGE notice.\n */\nexport class TrustPingMessageHandler extends AbstractMessageHandler {\n  constructor() {\n    super()\n  }\n\n  /**\n   * Handles a Trust Ping Message\n   * https://identity.foundation/didcomm-messaging/spec/#trust-ping-protocol-10\n   */\n  public async handle(message: Message, context: IContext): Promise<Message> {\n    if (message.type === TRUST_PING_MESSAGE_TYPE) {\n      debug('TrustPing Message Received')\n      try {\n        const { from, to, id } = message\n        if (!from) {\n          throw new Error('invalid_argument: Trust Ping Message received without `from` set')\n        }\n        if (!to) {\n          throw new Error('invalid_argument: Trust Ping Message received without `to` set')\n        }\n        const response = createTrustPingResponse(to!, from!, id)\n        const packedResponse = await context.agent.packDIDCommMessage({\n          message: response,\n          packing: 'authcrypt',\n        })\n        try {\n          const sent = await context.agent.sendDIDCommMessage({\n            messageId: response.id,\n            packedMessage: packedResponse,\n            recipientDidUrl: from!,\n          })\n          message.addMetaData({ type: 'TrustPingResponseSent', value: JSON.stringify(sent) })\n        } catch (e: any) {\n          debug(e)\n        }\n        if (message.returnRoute === 'all') {\n          const returnResponse = {\n            id: response.id,\n            message: packedResponse.message,\n            contentType: DIDCommMessageMediaType.ENCRYPTED,\n          }\n          message.addMetaData({ type: 'ReturnRouteResponse', value: JSON.stringify(returnResponse) })\n        }\n      } catch (ex) {\n        debug(ex)\n      }\n      return message\n    } else if (message.type === TRUST_PING_RESPONSE_MESSAGE_TYPE) {\n      debug('TrustPingResponse Message Received')\n      message.addMetaData({ type: 'TrustPingResponseReceived', value: 'true' })\n      return message\n    }\n\n    return super.handle(message, context)\n  }\n}\n"
  },
  {
    "path": "packages/did-comm/src/transports/transports.ts",
    "content": "import { v4 as uuidv4 } from 'uuid'\nimport { fetch } from 'cross-fetch'\nimport { decodeBase64url } from '@veramo/utils'\nimport Debug from 'debug'\nconst debug = Debug('veramo:did-comm:http-transport')\n/**\n * Result interface for sending DIDComm messages through\n * {@link IDIDCommTransport.send}.\n *\n * @beta This API may change without a BREAKING CHANGE notice.\n */\nexport interface IDIDCommTransportResult {\n  result?: string\n  error?: string\n  returnMessage?: string\n}\n\n/**\n * Common interface for transports that can be used in the\n * {@link DIDComm} module.\n *\n * @beta This API may change without a BREAKING CHANGE notice.\n */\nexport interface IDIDCommTransport {\n  /**\n   * Identifier of this transport that can be used in case the\n   * message thread supports reusing the transport connection.\n   */\n  id: string\n\n  /**\n   * Returns `true` if this transport is suitable for the provided\n   * DID Document service section, otherwise `false`.\n   * @param service - The DID Document service section\n   *\n   * @beta This API may change without a BREAKING CHANGE notice.\n   */\n  isServiceSupported(service: any): boolean\n\n  /**\n   * Sends the provided raw message (without further processing) to\n   * the service endpoint defined in the provided DID Document service\n   * section.\n   *\n   * @param service - The DID Document service section that contains\n   * a `serviceEndpoint` entry.\n   * @param message - The message to be sent.\n   *\n   * @beta This API may change without a BREAKING CHANGE notice.\n   */\n  send(service: any, message: string): Promise<IDIDCommTransportResult>\n}\n\n/**\n * Abstract implementation of {@link IDIDCommTransport}.\n *\n * @beta This API may change without a BREAKING CHANGE notice.\n */\nexport abstract class AbstractDIDCommTransport implements IDIDCommTransport {\n  id: string\n\n  /**\n   * Shared constructor that takes an optional identifier (for reusing) for\n   * this {@link IDIDCommTransport}.\n   *\n   * @param id - An optional identifier for this {@link IDIDCommTransport}.\n   *\n   * @beta This API may change without a BREAKING CHANGE notice.\n   */\n  constructor(id?: string) {\n    this.id = id || uuidv4()\n  }\n\n  /** {@inheritdoc IDIDCommTransport.isServiceSupported} */\n  abstract isServiceSupported(service: any): boolean\n\n  /** {@inheritdoc IDIDCommTransport.send} */\n  abstract send(service: any, message: string): Promise<IDIDCommTransportResult>\n}\n\n/**\n * Implementation of {@link IDIDCommTransport} to provide a simple\n * transport based on HTTP(S) requests.\n *\n * @beta This API may change without a BREAKING CHANGE notice.\n */\nexport class DIDCommHttpTransport extends AbstractDIDCommTransport {\n  /**\n   * Defines the default HTTP method to use if not specified\n   * in the DID Document service entry of the recipient.\n   */\n  httpMethod: 'post' | 'get'\n\n  /**\n   * Creates a new {@link DIDCommHttpTransport}.\n   * @param httpMethod - Default HTTP method if not specified in the service\n   * section.\n   */\n  constructor(httpMethod?: 'post' | 'get') {\n    super()\n    this.httpMethod = httpMethod || 'post'\n  }\n\n  /** {@inheritdoc AbstractDIDCommTransport.isServiceSupported} */\n  isServiceSupported(service: any) {\n    // serviceEndpoint can be a string, a ServiceEndpoint object, or an array of strings or ServiceEndpoint objects\n    return (\n      (typeof service.serviceEndpoint === 'string' &&\n        (service.serviceEndpoint.startsWith('http://') || service.serviceEndpoint.startsWith('https://'))) ||\n      (service.serviceEndpoint.uri &&\n        typeof service.serviceEndpoint.uri === 'string' &&\n        (service.serviceEndpoint.uri.startsWith('http://') ||\n          service.serviceEndpoint.uri.startsWith('https://'))) ||\n      (service.serviceEndpoint.length > 0 &&\n        typeof service.serviceEndpoint[0] === 'string' &&\n        (service.serviceEndpoint[0].startsWith('http://') ||\n          service.serviceEndpoint[0].startsWith('https://'))) ||\n      (service.serviceEndpoint.length > 0 &&\n        typeof service.serviceEndpoint[0].uri === 'string' &&\n        (service.serviceEndpoint[0].uri.startsWith('http://') ||\n          service.serviceEndpoint[0].uri.startsWith('https://')))\n    )\n  }\n\n  /** {@inheritdoc AbstractDIDCommTransport.send} */\n  async send(service: any, message: string): Promise<IDIDCommTransportResult> {\n    let serviceEndpointUrl = ''\n    if (typeof service.serviceEndpoint === 'string') {\n      serviceEndpointUrl = service.serviceEndpoint\n    } else if (service.serviceEndpoint.uri) {\n      serviceEndpointUrl = service.serviceEndpoint.uri\n    } else if (service.serviceEndpoint.length > 0) {\n      if (typeof service.serviceEndpoint[0] === 'string') {\n        serviceEndpointUrl = service.serviceEndpoint[0]\n      } else if (service.serviceEndpoint[0].uri) {\n        serviceEndpointUrl = service.serviceEndpoint[0].uri\n      }\n    }\n\n    try {\n      const contentType = this.inferContentType(message)\n      debug(`Sending message to ${serviceEndpointUrl}`)\n      const response = await fetch(serviceEndpointUrl, {\n        method: this.httpMethod,\n        body: message,\n        headers: {\n          'content-type': contentType,\n        },\n      })\n\n      let result\n\n      debug(`Response: ${JSON.stringify(response)}`)\n\n      if (response.ok) {\n        let returnMessage\n\n        // Check if response is a DIDComm message\n        if (response.headers.get('Content-Type')?.startsWith('application/didcomm')) {\n          returnMessage = await response.json()\n        }\n        result = {\n          result: 'successfully sent message: ' + response.statusText,\n          returnMessage: returnMessage,\n        }\n      } else {\n        result = {\n          error: 'failed to send message: ' + response.statusText,\n        }\n      }\n      return result\n    } catch (e) {\n      return {\n        error: 'failed to send message: ' + e,\n      }\n    }\n  }\n\n  private inferContentType(message: string) {\n    try {\n      const parsedMessage = JSON.parse(message)\n      const contentType =\n        parsedMessage?.typ ??\n        JSON.parse(decodeBase64url(parsedMessage.protected ?? '{}'))?.typ ??\n        'application/json'\n      return contentType\n    } catch (e) {\n      return 'application/json'\n    }\n  }\n}\n"
  },
  {
    "path": "packages/did-comm/src/types/IDIDComm.ts",
    "content": "import {\n  IAgentContext,\n  IDIDManager,\n  IKeyManager,\n  IMessage,\n  IMessageHandler,\n  IPluginMethodMap,\n  IResolver,\n  UsingResolutionOptions,\n} from '@veramo/core-types'\nimport { ISendMessageDIDCommAlpha1Args } from '../didcomm.js'\nimport {\n  DIDCommMessageMediaType,\n  DIDCommMessagePacking,\n  IDIDCommMessage,\n  IDIDCommOptions,\n  IPackedDIDCommMessage,\n  IUnpackedDIDCommMessage,\n} from './message-types.js'\n\n/**\n * The input to the {@link IDIDComm.unpackDIDCommMessage} method.\n *\n * @beta This API may change without a BREAKING CHANGE notice.\n */\nexport type IUnpackDIDCommMessageArgs = IPackedDIDCommMessage & UsingResolutionOptions\n\n/**\n * The input to the {@link IDIDComm.packDIDCommMessage} method.\n * When `packing` is `authcrypt` or `jws`, a `keyRef` MUST be provided.\n *\n * @beta This API may change without a BREAKING CHANGE notice.\n */\nexport interface IPackDIDCommMessageArgs extends UsingResolutionOptions {\n  message: IDIDCommMessage\n  packing: DIDCommMessagePacking\n  keyRef?: string\n  options?: IDIDCommOptions\n}\n\n/**\n * The input to the {@link IDIDComm.sendDIDCommMessage} method.\n * The provided `messageId` will be used in the emitted\n * event to allow event/message correlation.\n *\n * @beta This API may change without a BREAKING CHANGE notice.\n */\nexport interface ISendDIDCommMessageArgs extends UsingResolutionOptions {\n  packedMessage: IPackedDIDCommMessage\n  messageId: string\n  returnTransportId?: string\n  recipientDidUrl: string\n}\n\n/**\n * The response from the {@link IDIDComm.sendDIDCommMessage} method.\n *\n * @beta This API may change without a BREAKING CHANGE notice.\n * `return_message` is only present if the `return_route: 'all'` was used\n * in the packedMessage.\n */\nexport interface ISendDIDCommMessageResponse {\n  transportId: string\n  returnMessage?: IMessage\n}\n\n/**\n * DID Comm plugin interface for {@link @veramo/core#Agent}\n *\n * @beta This API may change without a BREAKING CHANGE notice.\n */\nexport interface IDIDComm extends IPluginMethodMap {\n  /**\n   * Partially decodes a possible DIDComm message string to determine the {@link DIDCommMessageMediaType}\n   *\n   * @param args - the message to be interpreted\n   * @returns - the {@link DIDCommMessageMediaType} if it was successfully parsed\n   * @throws if the message cannot be parsed as DIDComm v2\n   *\n   * @beta This API may change without a BREAKING CHANGE notice.\n   */\n  getDIDCommMessageMediaType(args: IPackedDIDCommMessage): Promise<DIDCommMessageMediaType>\n\n  /**\n   * Packs a {@link IDIDCommMessage} using one of the {@link DIDCommMessagePacking} options.\n   *\n   * @param args - an {@link IPackDIDCommMessageArgs} object.\n   *   * args.message - {@link IDIDCommMessage} - the message to be packed\n   *   * args.packing - {@link DIDCommMessagePacking} - the packing method\n   *   * args.keyRef - Optional - string - either an `id` of a {@link did-resolver#VerificationMethod}\n   *     `kid` of a {@link @veramo/core-types#IKey} that will be used when `packing` is `jws` or `authcrypt`.\n   *   * args.options - {@link IDIDCommOptions} - optional options\n   *\n   * @param context - This method requires an agent that also has {@link @veramo/core-types#IDIDManager},\n   *   {@link @veramo/core-types#IKeyManager} and {@link @veramo/core-types#IResolver} plugins in use.\n   *   When calling this method, the `context` is supplied automatically by the framework.\n   *\n   * @returns - a Promise that resolves to a {@link IPackedDIDCommMessage} object containing the serialized packed\n   *   `message` string\n   *\n   * @beta This API may change without a BREAKING CHANGE notice.\n   */\n  packDIDCommMessage(\n    args: IPackDIDCommMessageArgs,\n    context: IAgentContext<IDIDManager & IKeyManager & IResolver>,\n  ): Promise<IPackedDIDCommMessage>\n\n  /**\n   * Unpacks a possible DIDComm message and returns the {@link IDIDCommMessage} and\n   * {@link DIDCommMessagePacking} used to pack it.\n   *\n   * @param args - an object containing the serialized message to be unpacked\n   * @param context - This method requires an agent that also has {@link @veramo/core-types#IDIDManager},\n   *   {@link @veramo/core-types#IKeyManager} and {@link @veramo/core-types#IResolver} plugins in use.\n   *   When calling this method, the `context` is supplied automatically by the framework.\n   *\n   * @returns - a Promise that resolves to an object containing\n   *   the {@link IDIDCommMessage} and {@link DIDCommMessagePacking} used.\n   *\n   * @beta This API may change without a BREAKING CHANGE notice.\n   */\n  unpackDIDCommMessage(\n    args: IUnpackDIDCommMessageArgs,\n    context: IAgentContext<IDIDManager & IKeyManager & IResolver>,\n  ): Promise<IUnpackedDIDCommMessage>\n\n  /**\n   * Sends the given message to the recipient. If a return-transport is provided\n   * it will be checked whether the parent thread allows reusing the route. You cannot\n   * reuse the transport if the message was forwarded from a DIDComm mediator.\n   *\n   * Emits an eventType 'DIDCommV2Message-sent' that contains the message id of\n   * packed DIDComm message {@link IPackedDIDCommMessage} after the message was sent.\n   *\n   * @param args - An object containing the message, recipient information and optional\n   * information about the transport that should be used.\n   * @param context - This method requires an agent that also has {@link @veramo/core-types#IResolver},\n   *   {@link @veramo/core-types#IKeyManager}, {@link @veramo/core-types#IDIDManager}, and\n   *   {@link @veramo/core-types#IMessageHandler} plugins in use. When calling this method, the `context` is supplied\n   *   automatically by the framework.\n   *\n   * @returns - a {@link ISendDIDCommMessageResponse} containing the transport id that was used to send the message and\n   *   a return message, if one is available. It throws an error in case something went wrong.\n   *\n   * @beta This API may change without a BREAKING CHANGE notice.\n   */\n  sendDIDCommMessage(\n    args: ISendDIDCommMessageArgs,\n    context: IAgentContext<IDIDManager & IKeyManager & IResolver & IMessageHandler>,\n  ): Promise<ISendDIDCommMessageResponse>\n\n  /**\n   *\n   * @deprecated Please use {@link IDIDComm.sendDIDCommMessage} instead. This will be removed in Veramo 4.0\n   *\n   * This is used to create a message according to the initial\n   *   {@link https://github.com/decentralized-identifier/DIDComm-js | DIDComm-js} implementation.\n   *\n   * @remarks Be advised that this spec is still not final and that this protocol may need to change.\n   *\n   * @param args - Arguments necessary for sending a DIDComm message\n   * @param context - This reserved param is automatically added and handled by the framework, *do not override*\n   *\n   * @beta This API may change without a BREAKING CHANGE notice.\n   */\n  sendMessageDIDCommAlpha1(\n    args: ISendMessageDIDCommAlpha1Args,\n    context: IAgentContext<IDIDManager & IKeyManager & IResolver & IMessageHandler>,\n  ): Promise<IMessage>\n}\n"
  },
  {
    "path": "packages/did-comm/src/types/message-types.ts",
    "content": "/**\n * The DIDComm message structure.\n * See https://identity.foundation/didcomm-messaging/spec/#plaintext-message-structure\n *\n * @beta This API may change without a BREAKING CHANGE notice.\n */\nexport interface IDIDCommMessage {\n  id: string\n  type: string\n  from?: string\n  to?: string[]\n  thid?: string\n  pthid?: string\n  expires_time?: string\n  created_time?: string\n  next?: string\n  from_prior?: string\n  body?: any\n  attachments?: IDIDCommMessageAttachment[]\n  return_route?: string\n}\n\n/**\n * Extra options when packing a DIDComm message.\n *\n * @beta - This API may change without a BREAKING CHANGE notice.\n */\nexport interface IDIDCommOptions {\n  /**\n   * Add extra recipients for the packed message.\n   */\n  bcc?: string[]\n\n  /**\n   * Restrict to a set of kids for recipient\n   */\n  recipientKids?: string[]\n\n  /**\n   * Optional content encryption algorithm to use. Defaults to 'A256GCM'\n   */\n  enc?: 'XC20P' | 'A256GCM' | 'A256CBC-HS512'\n\n  /**\n   * Optional key wrapping algorithm to use. Defaults to 'ECDH-ES+A256KW'\n   */\n  alg?: 'ECDH-ES+A256KW' | 'ECDH-1PU+A256KW' | 'ECDH-ES+XC20PKW' | 'ECDH-1PU+XC20PKW'\n}\n\n/**\n * Represents different DIDComm v2 message encapsulation.\n *\n * @beta This API may change without a BREAKING CHANGE notice.\n */\nexport enum DIDCommMessageMediaType {\n  /**\n   * A plain JSON DIDComm message\n   */\n  PLAIN = 'application/didcomm-plain+json',\n\n  /**\n   * A JWS signed DIDComm message\n   */\n  SIGNED = 'application/didcomm-signed+json',\n\n  /**\n   * A JWE encrypted DIDComm message\n   */\n  ENCRYPTED = 'application/didcomm-encrypted+json',\n}\n\n/**\n * The possible types of message packing.\n *\n * `authcrypt`, `anoncrypt`, `anoncrypt+authcrypt`, and `anoncrypt+jws` will produce\n * `DIDCommMessageMediaType.ENCRYPTED` messages.\n *\n * `jws` will produce `DIDCommMessageMediaType.SIGNED` messages.\n *\n * `none` will produce `DIDCommMessageMediaType.PLAIN` messages.\n *\n *\n * @beta This API may change without a BREAKING CHANGE notice.\n */\nexport type DIDCommMessagePacking =\n  | 'authcrypt'\n  | 'anoncrypt'\n  | 'jws'\n  | 'none'\n  | 'anoncrypt+authcrypt'\n  | 'anoncrypt+jws'\n\n/**\n * Metadata resulting from unpacking a DIDComm v2 message.\n *\n * @beta This API may change without a BREAKING CHANGE notice.\n */\nexport interface IDIDCommMessageMetaData {\n  packing: DIDCommMessagePacking\n  // from_prior, reuse transport etc.\n}\n\n/**\n * The result of unpacking a DIDComm v2 message.\n *\n * @beta This API may change without a BREAKING CHANGE notice.\n */\nexport interface IUnpackedDIDCommMessage {\n  metaData: IDIDCommMessageMetaData\n  message: IDIDCommMessage\n}\n\n/**\n * The result of packing a DIDComm v2 message.\n * The message is always serialized as string.\n *\n * @beta This API may change without a BREAKING CHANGE notice.\n */\nexport interface IPackedDIDCommMessage {\n  message: string\n}\n\n/**\n * The DIDComm message structure for attachments.\n * See https://identity.foundation/didcomm-messaging/spec/#attachments\n *\n * @beta This API may change without a BREAKING CHANGE notice.\n */\nexport interface IDIDCommMessageAttachment {\n  id?: string\n  description?: string\n  filename?: string\n  media_type?: string\n  format?: string\n  lastmod_time?: string\n  byte_count?: number\n  data: IDIDCommMessageAttachmentData\n}\n\n/**\n * The DIDComm message structure for data in an attachment.\n * See https://identity.foundation/didcomm-messaging/spec/#attachments\n *\n * @beta This API may change without a BREAKING CHANGE notice.\n */\nexport interface IDIDCommMessageAttachmentData {\n  jws?: any\n  hash?: string\n  links?: string[]\n  base64?: string\n  json?: any\n}\n"
  },
  {
    "path": "packages/did-comm/src/types/utility-types.ts",
    "content": "import { JWE } from 'did-jwt'\nimport { DIDCommMessageMediaType, IDIDCommMessage } from './message-types.js'\n\n/**\n * Represents a plaintext DIDComm v2 message object.\n * @internal\n */\nexport type _DIDCommPlainMessage = IDIDCommMessage & { typ: DIDCommMessageMediaType.PLAIN }\n\n/**\n * Represents an encrypted DIDComm v2 message object\n * @internal\n */\nexport type _DIDCommEncryptedMessage = JWE\n\n/**\n * Type definition of a JSON serialized JWS in flattened form (only one signer)\n * @internal\n */\nexport type _FlattenedJWS = {\n  payload: string\n  protected?: string\n  header?: Record<string, any>\n  signature: string\n}\n\n/**\n * Type definition of a JSON serialized JWS in generic form\n * @internal\n */\nexport type _GenericJWS = {\n  payload: string\n  signatures: [{ protected?: string; header?: Record<string, any>; signature: string }]\n}\n\n/**\n * Composite type representing the 2 accepted forms of JWS DIDComm v2 message\n * @internal\n */\nexport type _DIDCommSignedMessage = _FlattenedJWS | _GenericJWS\n"
  },
  {
    "path": "packages/did-comm/src/utils.ts",
    "content": "import { IAgentContext, IDIDManager, IIdentifier, IKeyManager, IResolver, TKeyType } from '@veramo/core-types'\nimport { ECDH, JWE } from 'did-jwt'\nimport { DIDResolutionOptions, parse as parseDidUrl } from 'did-resolver'\n\nimport Debug from 'debug'\nimport {\n  _ExtendedVerificationMethod,\n  bytesToHex,\n  decodeJoseBlob,\n  extractPublicKeyHex,\n  hexToBytes,\n  isDefined,\n  mapIdentifierKeysToDoc,\n  resolveDidOrThrow,\n} from '@veramo/utils'\nimport { x25519 } from '@noble/curves/ed25519'\n\nconst debug = Debug('veramo:did-comm:action-handler')\n\nexport function createEcdhWrapper(secretKeyRef: string, context: IAgentContext<IKeyManager>): ECDH {\n  return async (theirPublicKey: Uint8Array): Promise<Uint8Array> => {\n    if (theirPublicKey.length !== 32) {\n      throw new Error('invalid_argument: incorrect publicKey key length for X25519')\n    }\n    const publicKey = { type: <TKeyType>'X25519', publicKeyHex: bytesToHex(theirPublicKey) }\n    const shared = await context.agent.keyManagerSharedSecret({ secretKeyRef, publicKey })\n    return hexToBytes(shared)\n  }\n}\n\nexport async function extractSenderEncryptionKey(\n  jwe: JWE,\n  context: IAgentContext<IResolver>,\n  resolutionOptions?: DIDResolutionOptions,\n): Promise<Uint8Array | null> {\n  let senderKey: Uint8Array | null = null\n  const protectedHeader = decodeJoseBlob(jwe.protected)\n  if (typeof protectedHeader.skid === 'string') {\n    const senderDoc = await resolveDidOrThrow(protectedHeader.skid, context, resolutionOptions)\n    const sKey = (await context.agent.getDIDComponentById({\n      didDocument: senderDoc,\n      didUrl: protectedHeader.skid,\n      section: 'keyAgreement',\n    })) as _ExtendedVerificationMethod\n    let { publicKeyHex, keyType } = extractPublicKeyHex(sKey, true)\n    if (keyType !== 'X25519') {\n      throw new Error(`not_supported: sender key of type ${sKey.type} is not supported`)\n    }\n    senderKey = hexToBytes(publicKeyHex)\n  }\n  return senderKey\n}\n\nexport async function extractManagedRecipients(\n  jwe: JWE,\n  context: IAgentContext<IDIDManager>,\n): Promise<{ recipient: any; kid: string; identifier: IIdentifier }[]> {\n  const parsedDIDs = (jwe.recipients || [])\n    .map((recipient) => {\n      const kid = recipient?.header?.kid\n      const did = parseDidUrl(kid || '')?.did as string\n      if (kid && did) {\n        return { recipient, kid, did }\n      } else {\n        return null\n      }\n    })\n    .filter(isDefined)\n\n  let managedRecipients = (\n    await Promise.all(\n      parsedDIDs.map(async ({ recipient, kid, did }) => {\n        try {\n          const identifier = await context.agent.didManagerGet({ did })\n          return { recipient, kid, identifier }\n        } catch (e) {\n          // identifier not found, skip it\n          return null\n        }\n      }),\n    )\n  ).filter(isDefined)\n  return managedRecipients\n}\n\nexport async function mapRecipientsToLocalKeys(\n  managedKeys: { recipient: any; kid: string; identifier: IIdentifier }[],\n  context: IAgentContext<IResolver>,\n  resolutionOptions?: DIDResolutionOptions,\n): Promise<{ localKeyRef: string; recipient: any }[]> {\n  const potentialKeys = await Promise.all(\n    managedKeys.map(async ({ recipient, kid, identifier }) => {\n      // TODO: use caching, since all recipients are supposed to belong to the same identifier\n      const identifierKeys = await mapIdentifierKeysToDoc(\n        identifier,\n        'keyAgreement',\n        context,\n        resolutionOptions,\n      )\n      const localKey = identifierKeys.find((key) => key.meta.verificationMethod.id === kid)\n      if (localKey) {\n        return { localKeyRef: localKey.kid, recipient }\n      } else {\n        return null\n      }\n    }),\n  )\n  const localKeys = potentialKeys.filter(isDefined)\n  return localKeys\n}\n\n/**\n * Generate private-public x25519 key pair\n */\nexport function generateX25519KeyPair(): { secretKey: Uint8Array; publicKey: Uint8Array } {\n  const secretKey = x25519.utils.randomPrivateKey()\n  return generateX25519KeyPairFromSeed(secretKey)\n}\n\n/**\n * Generate private-public x25519 key pair from a 32 byte secret.\n */\nexport function generateX25519KeyPairFromSeed(seed: Uint8Array): {\n  secretKey: Uint8Array\n  publicKey: Uint8Array\n} {\n  if (seed.length !== 32) {\n    throw new Error(`x25519: seed must be 32 bytes`)\n  }\n  return {\n    publicKey: x25519.getPublicKey(seed),\n    secretKey: seed,\n  }\n}\n"
  },
  {
    "path": "packages/did-comm/tsconfig.json",
    "content": "{\n  \"extends\": \"../tsconfig.settings.json\",\n  \"compilerOptions\": {\n    \"rootDir\": \"src\",\n    \"outDir\": \"build\",\n    \"declarationDir\": \"build\",\n    \"lib\": [\"dom\", \"esnext\"],\n    \"skipLibCheck\": true\n  },\n  \"references\": [\n    {\n      \"path\": \"../core-types\"\n    },\n    {\n      \"path\": \"../message-handler\"\n    },\n    {\n      \"path\": \"../utils\"\n    }\n  ],\n  \"include\": [\"./**/*.ts\"]\n}\n"
  },
  {
    "path": "packages/did-discovery/CHANGELOG.md",
    "content": "# Change Log\n\nAll notable changes to this project will be documented in this file.\nSee [Conventional Commits](https://conventionalcommits.org) for commit guidelines.\n\n# [7.0.0](https://github.com/decentralized-identity/veramo/compare/v6.0.2...v7.0.0) (2026-02-11)\n\n\n### Bug Fixes\n\n* **deps:** update devdeps and bump typeorm to 0.3.20 ([#1272](https://github.com/decentralized-identity/veramo/issues/1272)) ([7d17f37](https://github.com/decentralized-identity/veramo/commit/7d17f37ea7cc4e73a8cdae028681ae1be5c4d11c))\n\n\n\n\n\n## [6.0.2](https://github.com/decentralized-identity/veramo/compare/v6.0.1...v6.0.2) (2026-01-16)\n\n**Note:** Version bump only for package @veramo/did-discovery\n\n\n\n\n\n## [6.0.1](https://github.com/decentralized-identity/veramo/compare/v6.0.0...v6.0.1) (2026-01-16)\n\n**Note:** Version bump only for package @veramo/did-discovery\n\n\n\n\n\n# [6.0.0](https://github.com/decentralized-identity/veramo/compare/v5.6.0...v6.0.0) (2024-04-02)\n\n\n### Bug Fixes\n\n* **did-provider-key:** align did:key resolver to spec ([#1332](https://github.com/decentralized-identity/veramo/issues/1332)) ([8e3b94c](https://github.com/decentralized-identity/veramo/commit/8e3b94cf997619d7adcb5cb8827e0f55ff88cdb5)), closes [#1330](https://github.com/decentralized-identity/veramo/issues/1330)\n* export const plugin schemas instead of defaults ([#1327](https://github.com/decentralized-identity/veramo/issues/1327)) ([7896cea](https://github.com/decentralized-identity/veramo/commit/7896ceaf2c79993eee44e46950814bea74bfe647)), closes [#1318](https://github.com/decentralized-identity/veramo/issues/1318) [#1317](https://github.com/decentralized-identity/veramo/issues/1317) [#1315](https://github.com/decentralized-identity/veramo/issues/1315)\n\n\n### Code Refactoring\n\n* generate plugin schemas as TS instead of JSON ([#1315](https://github.com/decentralized-identity/veramo/issues/1315)) ([65c2d4b](https://github.com/decentralized-identity/veramo/commit/65c2d4bc814daa9a3a89f4f7b8e8c6973b8ce2f0)), closes [#1254](https://github.com/decentralized-identity/veramo/issues/1254)\n\n\n### BREAKING CHANGES\n\n* The `plugin.schema.json` files are now generated as `plugin.schema.ts`.\n\n\n\n\n\n# [5.6.0](https://github.com/decentralized-identity/veramo/compare/v5.5.3...v5.6.0) (2024-01-16)\n\n**Note:** Version bump only for package @veramo/did-discovery\n\n\n\n\n\n## [5.5.3](https://github.com/decentralized-identity/veramo/compare/v5.5.2...v5.5.3) (2023-10-09)\n\n\n### Bug Fixes\n\n* use DIF URLs in packages ([#1271](https://github.com/decentralized-identity/veramo/issues/1271)) ([3dfc601](https://github.com/decentralized-identity/veramo/commit/3dfc6014cdee7902c59d8db76b4c8507b870f227))\n\n\n\n\n\n# [5.5.0](https://github.com/uport-project/veramo/compare/v5.4.1...v5.5.0) (2023-09-19)\n\n\n### Bug Fixes\n\n* **did-provider-key:** use compressed keys for creating Secp256k1 did:key ([#1217](https://github.com/uport-project/veramo/issues/1217)) ([ba8f6f5](https://github.com/uport-project/veramo/commit/ba8f6f5b9b701e57af86491504ecd209ca0c1c1d)), closes [#1213](https://github.com/uport-project/veramo/issues/1213)\n\n\n\n\n\n## [5.4.1](https://github.com/uport-project/veramo/compare/v5.4.0...v5.4.1) (2023-08-04)\n\n\n### Bug Fixes\n\n* **ci:** benign change meant to tag all packages for another patch release ([#1211](https://github.com/uport-project/veramo/issues/1211)) ([41b5c90](https://github.com/uport-project/veramo/commit/41b5c90277171b7b38c5cf49ca01db5cf75b6300))\n\n\n\n\n\n# [5.4.0](https://github.com/uport-project/veramo/compare/v5.3.0...v5.4.0) (2023-08-01)\n\n**Note:** Version bump only for package @veramo/did-discovery\n\n\n\n\n\n# [5.3.0](https://github.com/uport-project/veramo/compare/v5.2.0...v5.3.0) (2023-07-27)\n\n**Note:** Version bump only for package @veramo/did-discovery\n\n\n\n\n\n## [5.1.2](https://github.com/uport-project/veramo/compare/v5.1.1...v5.1.2) (2023-02-25)\n\n**Note:** Version bump only for package @veramo/did-discovery\n\n\n\n\n\n# [5.1.0](https://github.com/uport-project/veramo/compare/v5.0.0...v5.1.0) (2023-02-24)\n\n**Note:** Version bump only for package @veramo/did-discovery\n\n\n\n\n\n# [5.0.0](https://github.com/uport-project/veramo/compare/v4.3.0...v5.0.0) (2023-02-09)\n\n\n### Build System\n\n* convert veramo modules to ESM instead of CommonJS ([#1103](https://github.com/uport-project/veramo/issues/1103)) ([b5cea3c](https://github.com/uport-project/veramo/commit/b5cea3c0d80d900a47bd1d9eea68f84b70a35e7b)), closes [#1099](https://github.com/uport-project/veramo/issues/1099)\n\n\n### Features\n\n* isolate `core-types` package from `core` ([#1116](https://github.com/uport-project/veramo/issues/1116)) ([ba7a303](https://github.com/uport-project/veramo/commit/ba7a303de91cf4cc568a3af1ddf8ca98ed022e9f))\n\n\n### BREAKING CHANGES\n\n* this is a breaking change as modules will have to be imported differently: \n* https://www.typescriptlang.org/docs/handbook/esm-node.html\n* https://nodejs.org/api/esm.html\n* https://caniuse.com/?search=modules\n\ntest(did-provider-ion): skip a couple of tests that fail with unreasonable errors\nchore: use ubuntu-latest on CI\nfix: temporarily remove puppeteer tests\nfix: use craco for test-react-app to enable babel config\ntest: fix unit and integration tests (browser tests still broken)\nfix: fix some build issues that prevented tests from working\nfix: missing deps flagged by pnpm\n\n\n\n\n\n# [4.3.0](https://github.com/uport-project/veramo/compare/v4.2.0...v4.3.0) (2023-01-27)\n\n**Note:** Version bump only for package @veramo/did-discovery\n\n\n\n\n\n# [4.2.0](https://github.com/uport-project/veramo/compare/v4.1.2...v4.2.0) (2022-12-05)\n\n\n### Bug Fixes\n\n* **deps:** bump dependencies ([701b8ed](https://github.com/uport-project/veramo/commit/701b8edf981ea11c7ddb6a81d2817dbbdbb022f3))\n\n\n\n\n\n## [4.1.1](https://github.com/uport-project/veramo/compare/v4.1.0...v4.1.1) (2022-11-01)\n\n**Note:** Version bump only for package @veramo/did-discovery\n\n\n\n\n\n# [4.1.0](https://github.com/uport-project/veramo/compare/v4.0.2...v4.1.0) (2022-10-31)\n\n**Note:** Version bump only for package @veramo/did-discovery\n\n\n\n\n\n# [4.0.0](https://github.com/uport-project/veramo/compare/v3.1.5...v4.0.0) (2022-09-22)\n\n\n### Bug Fixes\n\n* **did-resolver:** use interface `Resolvable` instead of the `Resolver` class ([9c2e59f](https://github.com/uport-project/veramo/commit/9c2e59f3f23f808511c6c0e8e440b4d53ba5cb00))\n* update and fix inline documentation of all exported types ([#921](https://github.com/uport-project/veramo/issues/921)) ([63e64e0](https://github.com/uport-project/veramo/commit/63e64e0e2693808c4704dca8cc511dc0bab3f3b1))\n\n\n\n\n\n## [3.1.3](https://github.com/uport-project/veramo/compare/v3.1.2...v3.1.3) (2022-06-01)\n\n**Note:** Version bump only for package @veramo/did-discovery\n\n\n\n\n\n# [3.1.0](https://github.com/uport-project/veramo/compare/v3.0.0...v3.1.0) (2021-11-12)\n\n**Note:** Version bump only for package @veramo/did-discovery\n\n\n\n\n\n# [3.0.0](https://github.com/uport-project/veramo/compare/v2.1.3...v3.0.0) (2021-09-20)\n\n**Note:** Version bump only for package @veramo/did-discovery\n\n\n\n\n\n# [2.1.0](https://github.com/uport-project/veramo/compare/v2.0.1...v2.1.0) (2021-08-11)\n\n**Note:** Version bump only for package @veramo/did-discovery\n\n\n\n\n\n# [2.0.0](https://github.com/uport-project/veramo/compare/v1.2.2...v2.0.0) (2021-07-14)\n\n\n### Features\n\n* **did-discovery:** implement a DID discovery plugin with simple providers ([#597](https://github.com/uport-project/veramo/issues/597)) ([6f01df3](https://github.com/uport-project/veramo/commit/6f01df38a732ba314d1e60728d65f511d26bfdcb))\n"
  },
  {
    "path": "packages/did-discovery/LICENSE",
    "content": "                                 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 2021 Consensys AG\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"
  },
  {
    "path": "packages/did-discovery/README.md",
    "content": "# Veramo DID discovery plugin\n\nThis package provides a Veramo plugin for discovering DIDs\n"
  },
  {
    "path": "packages/did-discovery/api-extractor.json",
    "content": "{\n  \"$schema\": \"https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json\",\n  \"apiReport\": {\n    \"enabled\": true,\n    \"reportFolder\": \"./api\",\n    \"reportTempFolder\": \"./api\"\n  },\n\n  \"docModel\": {\n    \"enabled\": true,\n    \"apiJsonFilePath\": \"./api/<unscopedPackageName>.api.json\"\n  },\n\n  \"dtsRollup\": {\n    \"enabled\": false\n  },\n  \"mainEntryPointFilePath\": \"<projectFolder>/build/index.d.ts\"\n}\n"
  },
  {
    "path": "packages/did-discovery/package.json",
    "content": "{\n  \"name\": \"@veramo/did-discovery\",\n  \"description\": \"Veramo DID discovery plugin\",\n  \"version\": \"7.0.0\",\n  \"main\": \"build/index.js\",\n  \"exports\": {\n    \".\": \"./build/index.js\"\n  },\n  \"types\": \"build/index.d.ts\",\n  \"scripts\": {\n    \"build\": \"tsc\",\n    \"generate-plugin-schema\": \"node ../cli/bin/veramo.js dev generate-plugin-schema\"\n  },\n  \"veramo\": {\n    \"pluginInterfaces\": {\n      \"IDIDDiscovery\": \"./src/types.ts\"\n    }\n  },\n  \"dependencies\": {\n    \"@veramo/core-types\": \"workspace:^\",\n    \"debug\": \"^4.3.3\"\n  },\n  \"devDependencies\": {\n    \"@types/debug\": \"4.1.8\",\n    \"typescript\": \"5.7.3\"\n  },\n  \"files\": [\n    \"build/**/*\",\n    \"src/**/*\",\n    \"README.md\",\n    \"LICENSE\"\n  ],\n  \"publishConfig\": {\n    \"access\": \"public\"\n  },\n  \"repository\": {\n    \"type\": \"git\",\n    \"url\": \"https://github.com/decentralized-identity/veramo.git\",\n    \"directory\": \"packages/did-discovery\"\n  },\n  \"author\": \"Consensys Mesh R&D <hello@veramo.io>\",\n  \"contributors\": [\n    \"Simonas Karuzas <simonas.karuzas@mesh.xyz>\",\n    \"Mircea Nistor <mircea.nistor@mesh.xyz>\",\n    \"Oliver Terbu\"\n  ],\n  \"keywords\": [\n    \"Veramo\",\n    \"DID\",\n    \"Verifiable Credential\",\n    \"veramo-plugin\"\n  ],\n  \"license\": \"Apache-2.0\",\n  \"type\": \"module\"\n}\n"
  },
  {
    "path": "packages/did-discovery/src/abstract-did-discovery-provider.ts",
    "content": "import type { IAgentContext } from '@veramo/core-types'\nimport type { IDIDDiscoveryDiscoverDidArgs, IDIDDiscoveryProviderResult } from './types.js'\n\n/**\n * An abstract class for the {@link @veramo/did-discovery#DIDDiscovery} providers\n * @public\n */\nexport abstract class AbstractDidDiscoveryProvider {\n  abstract name: string\n  abstract discoverDid(\n    args: IDIDDiscoveryDiscoverDidArgs,\n    context: IAgentContext<any>,\n  ): Promise<IDIDDiscoveryProviderResult>\n}\n"
  },
  {
    "path": "packages/did-discovery/src/action-handler.ts",
    "content": "import { IAgentContext, IAgentPlugin } from '@veramo/core-types'\n\nimport {\n  IDIDDiscovery,\n  IDIDDiscoveryDiscoverDidArgs,\n  IDIDDiscoveryProviderResult,\n  IDIDDiscoveryDiscoverDidResult,\n} from './types.js'\nimport { AbstractDidDiscoveryProvider } from './abstract-did-discovery-provider.js'\nimport { schema } from './plugin.schema.js'\nimport Debug from 'debug'\n\nconst debug = Debug('veramo:did-discovery')\n\n/**\n * This class adds support for discovering DIDs.\n *\n * @beta This API may change without a BREAKING CHANGE notice.\n */\nexport class DIDDiscovery implements IAgentPlugin {\n  readonly methods: IDIDDiscovery\n  readonly schema = schema.IDIDDiscovery\n  readonly providers: Array<AbstractDidDiscoveryProvider>\n\n  constructor(options: { providers: Array<AbstractDidDiscoveryProvider> }) {\n    this.providers = options.providers\n    this.methods = {\n      discoverDid: this.discoverDid.bind(this),\n    }\n  }\n\n  /**\n   * Queries data providers and returns DIDs with metadata\n   *\n   * @param args - The param object with the properties necessary to discover DID\n   * @param context - *RESERVED* This is filled by the framework when the method is called.\n   *\n   */\n  async discoverDid(\n    args: IDIDDiscoveryDiscoverDidArgs,\n    context: IAgentContext<any>,\n  ): Promise<IDIDDiscoveryDiscoverDidResult> {\n    const results: IDIDDiscoveryProviderResult[] = []\n    const errors: Record<string, string> = {}\n\n    for (const provider of this.providers) {\n      try {\n        const providerResult = await provider.discoverDid(args, context)\n        if (providerResult.matches.length > 0) {\n          results.push(providerResult)\n        }\n      } catch (e: any) {\n        errors[provider.name] = e?.message\n        debug(`Error ${provider}: ${e?.message}`)\n      }\n    }\n\n    const result: IDIDDiscoveryDiscoverDidResult = {\n      ...args,\n      results,\n    }\n\n    if (errors) {\n      result['errors'] = errors\n    }\n\n    return result\n  }\n}\n"
  },
  {
    "path": "packages/did-discovery/src/index.ts",
    "content": "/**\n * Provides a {@link @veramo/did-discovery#IDIDDiscovery | plugin} for the {@link @veramo/core#Agent}\n *\n * @packageDocumentation\n */\nexport { DIDDiscovery } from './action-handler.js'\nexport { AbstractDidDiscoveryProvider } from './abstract-did-discovery-provider.js'\nexport * from './types.js'\nexport { schema } from './plugin.schema.js'\n"
  },
  {
    "path": "packages/did-discovery/src/plugin.schema.ts",
    "content": "export const schema = {\n  \"IDIDDiscovery\": {\n    \"components\": {\n      \"schemas\": {\n        \"IDIDDiscoveryDiscoverDidArgs\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"query\": {\n              \"type\": \"string\",\n              \"description\": \"Search string\"\n            },\n            \"options\": {\n              \"type\": \"object\",\n              \"description\": \"Provider specific options\"\n            }\n          },\n          \"required\": [\n            \"query\"\n          ],\n          \"description\": \"Contains the parameters of a DID Discovery Request.\"\n        },\n        \"IDIDDiscoveryDiscoverDidResult\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"query\": {\n              \"type\": \"string\",\n              \"description\": \"Search string\"\n            },\n            \"options\": {\n              \"type\": \"object\",\n              \"description\": \"Provider specific options\"\n            },\n            \"results\": {\n              \"type\": \"array\",\n              \"items\": {\n                \"$ref\": \"#/components/schemas/IDIDDiscoveryProviderResult\"\n              },\n              \"description\": \"List of discovery results from different providers\"\n            },\n            \"errors\": {\n              \"type\": \"object\",\n              \"additionalProperties\": {\n                \"type\": \"string\"\n              },\n              \"description\": \"A record of encountered errors\"\n            }\n          },\n          \"required\": [\n            \"results\"\n          ],\n          \"description\": \"DID Discovery results.\"\n        },\n        \"IDIDDiscoveryProviderResult\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"provider\": {\n              \"type\": \"string\",\n              \"description\": \"Provider name\"\n            },\n            \"matches\": {\n              \"type\": \"array\",\n              \"items\": {\n                \"$ref\": \"#/components/schemas/IDIDDiscoverMatch\"\n              },\n              \"description\": \"List of discovery matches\"\n            }\n          },\n          \"required\": [\n            \"provider\",\n            \"matches\"\n          ],\n          \"description\": \"Discovery results from one provider.\"\n        },\n        \"IDIDDiscoverMatch\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"did\": {\n              \"type\": \"string\",\n              \"description\": \"DID\"\n            },\n            \"metaData\": {\n              \"type\": \"object\",\n              \"description\": \"Provider specific related metadata about the match\"\n            }\n          },\n          \"required\": [\n            \"did\",\n            \"metaData\"\n          ],\n          \"description\": \"A single discovery match.\"\n        }\n      },\n      \"methods\": {\n        \"discoverDid\": {\n          \"description\": \"\",\n          \"arguments\": {\n            \"$ref\": \"#/components/schemas/IDIDDiscoveryDiscoverDidArgs\"\n          },\n          \"returnType\": {\n            \"$ref\": \"#/components/schemas/IDIDDiscoveryDiscoverDidResult\"\n          }\n        }\n      }\n    }\n  }\n}"
  },
  {
    "path": "packages/did-discovery/src/types.ts",
    "content": "import { IAgentContext, IPluginMethodMap } from '@veramo/core-types'\n\n/**\n * Contains the parameters of a DID Discovery Request.\n *\n * @beta This API may change without a BREAKING CHANGE notice.\n */\nexport interface IDIDDiscoveryDiscoverDidArgs {\n  /**\n   * Search string\n   */\n  query: string\n\n  /**\n   * Provider specific options\n   */\n  options?: Record<string, any>\n}\n\n/**\n * A single discovery match.\n *\n * @beta This API may change without a BREAKING CHANGE notice.\n */\nexport interface IDIDDiscoverMatch {\n  /**\n   * DID\n   */\n  did: string\n\n  /**\n   * Provider specific related metadata about the match\n   */\n  metaData: Record<string, any>\n}\n\n/**\n * Discovery results from one provider.\n *\n * @beta This API may change without a BREAKING CHANGE notice.\n */\nexport interface IDIDDiscoveryProviderResult {\n  /**\n   * Provider name\n   */\n  provider: string\n\n  /**\n   * List of discovery matches\n   */\n  matches: IDIDDiscoverMatch[]\n}\n\n/**\n * DID Discovery results.\n *\n * @beta This API may change without a BREAKING CHANGE notice.\n */\nexport interface IDIDDiscoveryDiscoverDidResult extends Partial<IDIDDiscoveryDiscoverDidArgs> {\n  /**\n   * List of discovery results from different providers\n   */\n  results: IDIDDiscoveryProviderResult[]\n\n  /**\n   * A record of encountered errors\n   */\n  errors?: Record<string, string>\n}\n\n/**\n * Describes the interface of DID discovery plugin.\n *\n * @beta This API may change without a BREAKING CHANGE notice.\n */\nexport interface IDIDDiscovery extends IPluginMethodMap {\n  discoverDid(\n    args: IDIDDiscoveryDiscoverDidArgs,\n    context: IAgentContext<any>,\n  ): Promise<IDIDDiscoveryDiscoverDidResult>\n}\n"
  },
  {
    "path": "packages/did-discovery/tsconfig.json",
    "content": "{\n  \"extends\": \"../tsconfig.settings.json\",\n  \"compilerOptions\": {\n    \"rootDir\": \"src\",\n    \"outDir\": \"build\",\n    \"declarationDir\": \"build\"\n  },\n  \"references\": [{ \"path\": \"../core-types\" }],\n  \"include\": [\"./**/*.ts\"]\n}\n"
  },
  {
    "path": "packages/did-jwt/CHANGELOG.md",
    "content": "# Change Log\n\nAll notable changes to this project will be documented in this file.\nSee [Conventional Commits](https://conventionalcommits.org) for commit guidelines.\n\n# [7.0.0](https://github.com/decentralized-identity/veramo/compare/v6.0.2...v7.0.0) (2026-02-11)\n\n\n### Bug Fixes\n\n* **deps:** update devdeps and bump typeorm to 0.3.20 ([#1272](https://github.com/decentralized-identity/veramo/issues/1272)) ([7d17f37](https://github.com/decentralized-identity/veramo/commit/7d17f37ea7cc4e73a8cdae028681ae1be5c4d11c))\n\n\n\n\n\n## [6.0.2](https://github.com/decentralized-identity/veramo/compare/v6.0.1...v6.0.2) (2026-01-16)\n\n**Note:** Version bump only for package @veramo/did-jwt\n\n\n\n\n\n## [6.0.1](https://github.com/decentralized-identity/veramo/compare/v6.0.0...v6.0.1) (2026-01-16)\n\n**Note:** Version bump only for package @veramo/did-jwt\n\n\n\n\n\n# [6.0.0](https://github.com/decentralized-identity/veramo/compare/v5.6.0...v6.0.0) (2024-04-02)\n\n\n### Features\n\n* add Multikey support ([#1316](https://github.com/decentralized-identity/veramo/issues/1316)) ([165de35](https://github.com/decentralized-identity/veramo/commit/165de3549ccfd3d7c84514608ac3ea9e56a7b807))\n\n\n\n\n\n# [5.6.0](https://github.com/decentralized-identity/veramo/compare/v5.5.3...v5.6.0) (2024-01-16)\n\n\n### Features\n\n* **remote-client:** allow dynamic headers param for AgentRestClient constructor ([#1314](https://github.com/decentralized-identity/veramo/issues/1314)) ([1b8a0a2](https://github.com/decentralized-identity/veramo/commit/1b8a0a2718dd63492ad3a312a6ebe5f6e7849935)), closes [#1313](https://github.com/decentralized-identity/veramo/issues/1313)\n\n\n\n\n\n## [5.5.3](https://github.com/decentralized-identity/veramo/compare/v5.5.2...v5.5.3) (2023-10-09)\n\n\n### Bug Fixes\n\n* use DIF URLs in packages ([#1271](https://github.com/decentralized-identity/veramo/issues/1271)) ([3dfc601](https://github.com/decentralized-identity/veramo/commit/3dfc6014cdee7902c59d8db76b4c8507b870f227))\n\n\n\n\n\n# [5.5.0](https://github.com/uport-project/veramo/compare/v5.4.1...v5.5.0) (2023-09-19)\n\n\n### Bug Fixes\n\n* **did-provider-key:** use compressed keys for creating Secp256k1 did:key ([#1217](https://github.com/uport-project/veramo/issues/1217)) ([ba8f6f5](https://github.com/uport-project/veramo/commit/ba8f6f5b9b701e57af86491504ecd209ca0c1c1d)), closes [#1213](https://github.com/uport-project/veramo/issues/1213)\n\n\n\n\n\n## [5.4.1](https://github.com/uport-project/veramo/compare/v5.4.0...v5.4.1) (2023-08-04)\n\n\n### Bug Fixes\n\n* **ci:** benign change meant to tag all packages for another patch release ([#1211](https://github.com/uport-project/veramo/issues/1211)) ([41b5c90](https://github.com/uport-project/veramo/commit/41b5c90277171b7b38c5cf49ca01db5cf75b6300))\n\n\n\n\n\n# [5.4.0](https://github.com/uport-project/veramo/compare/v5.3.0...v5.4.0) (2023-08-01)\n\n\n### Features\n\n* **did-comm:** add support for the AES based content and key encryption algorithms ([#1180](https://github.com/uport-project/veramo/issues/1180)) ([5294a81](https://github.com/uport-project/veramo/commit/5294a812ee578c0712b54f216416c3ef78c848da))\n\n\n\n\n\n# [5.3.0](https://github.com/uport-project/veramo/compare/v5.2.0...v5.3.0) (2023-07-27)\n\n**Note:** Version bump only for package @veramo/did-jwt\n\n\n\n\n\n# [5.2.0](https://github.com/uport-project/veramo/compare/v5.1.4...v5.2.0) (2023-05-02)\n\n\n### Bug Fixes\n\n* **credential-ld:** fix Ed25519Signature2020 verification ([#1166](https://github.com/uport-project/veramo/issues/1166)) ([c965fd5](https://github.com/uport-project/veramo/commit/c965fd502f652c9929ae4753c56ebbe351447733))\n\n\n\n\n\n## [5.1.2](https://github.com/uport-project/veramo/compare/v5.1.1...v5.1.2) (2023-02-25)\n\n**Note:** Version bump only for package @veramo/did-jwt\n\n\n\n\n\n# [5.1.0](https://github.com/uport-project/veramo/compare/v5.0.0...v5.1.0) (2023-02-24)\n\n**Note:** Version bump only for package @veramo/did-jwt\n\n\n\n\n\n# [5.0.0](https://github.com/uport-project/veramo/compare/v4.3.0...v5.0.0) (2023-02-09)\n\n\n### Build System\n\n* convert veramo modules to ESM instead of CommonJS ([#1103](https://github.com/uport-project/veramo/issues/1103)) ([b5cea3c](https://github.com/uport-project/veramo/commit/b5cea3c0d80d900a47bd1d9eea68f84b70a35e7b)), closes [#1099](https://github.com/uport-project/veramo/issues/1099)\n\n\n### Features\n\n* isolate `core-types` package from `core` ([#1116](https://github.com/uport-project/veramo/issues/1116)) ([ba7a303](https://github.com/uport-project/veramo/commit/ba7a303de91cf4cc568a3af1ddf8ca98ed022e9f))\n\n\n### BREAKING CHANGES\n\n* this is a breaking change as modules will have to be imported differently: \n* https://www.typescriptlang.org/docs/handbook/esm-node.html\n* https://nodejs.org/api/esm.html\n* https://caniuse.com/?search=modules\n\ntest(did-provider-ion): skip a couple of tests that fail with unreasonable errors\nchore: use ubuntu-latest on CI\nfix: temporarily remove puppeteer tests\nfix: use craco for test-react-app to enable babel config\ntest: fix unit and integration tests (browser tests still broken)\nfix: fix some build issues that prevented tests from working\nfix: missing deps flagged by pnpm\n\n\n\n\n\n# [4.3.0](https://github.com/uport-project/veramo/compare/v4.2.0...v4.3.0) (2023-01-27)\n\n**Note:** Version bump only for package @veramo/did-jwt\n\n\n\n\n\n# [4.2.0](https://github.com/uport-project/veramo/compare/v4.1.2...v4.2.0) (2022-12-05)\n\n\n### Bug Fixes\n\n* **deps:** bump dependencies ([701b8ed](https://github.com/uport-project/veramo/commit/701b8edf981ea11c7ddb6a81d2817dbbdbb022f3))\n\n\n\n\n\n## [4.1.1](https://github.com/uport-project/veramo/compare/v4.1.0...v4.1.1) (2022-11-01)\n\n**Note:** Version bump only for package @veramo/did-jwt\n\n\n\n\n\n# [4.1.0](https://github.com/uport-project/veramo/compare/v4.0.2...v4.1.0) (2022-10-31)\n\n\n### Bug Fixes\n\n* **deps:** Update dependency ethr-did-resolver to v7 ([#1038](https://github.com/uport-project/veramo/issues/1038)) ([d421c0f](https://github.com/uport-project/veramo/commit/d421c0f9f5934829df2930e58e98bcfce813ce84))\n\n\n\n\n\n# [4.0.0](https://github.com/uport-project/veramo/compare/v3.1.5...v4.0.0) (2022-09-22)\n\n\n### Bug Fixes\n\n* **deps:** Bump `did-jwt`, `did-jwt-vc` as direct package deps ([#955](https://github.com/uport-project/veramo/issues/955)) ([e57edb3](https://github.com/uport-project/veramo/commit/e57edb34cfbaee6bba1d944497d688104f32c698))\n* **deps:** update dependency did-jwt to v5.12.0 ([5b414d7](https://github.com/uport-project/veramo/commit/5b414d7d720e7c59cf3f56c35da5fe247e21bf26))\n* **deps:** update did-libraries ([219cde2](https://github.com/uport-project/veramo/commit/219cde250e8d4f06d7978afcc38a04471342fd21))\n* **deps:** use did-jwt v6 and ethr-did-resolver v6 ([#925](https://github.com/uport-project/veramo/issues/925)) ([0c77d03](https://github.com/uport-project/veramo/commit/0c77d03ec5ec9e2091de3f74f67ab86a22cde197)), closes [#923](https://github.com/uport-project/veramo/issues/923) [#848](https://github.com/uport-project/veramo/issues/848)\n* **did-resolver:** use interface `Resolvable` instead of the `Resolver` class ([9c2e59f](https://github.com/uport-project/veramo/commit/9c2e59f3f23f808511c6c0e8e440b4d53ba5cb00))\n\n\n### Features\n\n* add support for serviceEndpoint property as defined in latest DID Spec ([#988](https://github.com/uport-project/veramo/issues/988)) ([9bed70b](https://github.com/uport-project/veramo/commit/9bed70ba658aed34a97944e0dee27bca6c81d700))\n* **credential-ld:** add support for browser environments ([#916](https://github.com/uport-project/veramo/issues/916)) ([435e4d2](https://github.com/uport-project/veramo/commit/435e4d260b1774f96b182c1a75ab2f1c993f2291))\n* **credential-w3c:** align verification API between formats ([#996](https://github.com/uport-project/veramo/issues/996)) ([b987fc0](https://github.com/uport-project/veramo/commit/b987fc0903a31d3bbffb43fef872be4d6c62c2ad)), closes [#935](https://github.com/uport-project/veramo/issues/935) [#954](https://github.com/uport-project/veramo/issues/954) [#375](https://github.com/uport-project/veramo/issues/375) [#989](https://github.com/uport-project/veramo/issues/989)\n\n\n### BREAKING CHANGES\n\n* the `did-resolver` and connected libraries change the data-type for `ServiceEndpoint` to `Service` and the previous semantic has changed. Services can have multiple endpoints, not just a single string.\n\n\n\n\n\n## [3.1.3](https://github.com/uport-project/veramo/compare/v3.1.2...v3.1.3) (2022-06-01)\n\n**Note:** Version bump only for package @veramo/did-jwt\n\n\n\n\n\n# [3.1.0](https://github.com/uport-project/veramo/compare/v3.0.0...v3.1.0) (2021-11-12)\n\n\n### Bug Fixes\n\n* **deps:** update dependency did-jwt to v5.10.0 ([8424291](https://github.com/uport-project/veramo/commit/842429176b7e3a2433dcb0341cdadb5e5fcd71f0))\n* **deps:** update dependency did-jwt to v5.9.0 ([b9af0af](https://github.com/uport-project/veramo/commit/b9af0af9034297316313ac8f5d41f08e06c5a1ab))\n* **deps:** update did-libraries ([0ea73fc](https://github.com/uport-project/veramo/commit/0ea73fc1dba02c3d4c4df5befef265f7f573b2d1))\n* **deps:** update did-libraries ([417dc5d](https://github.com/uport-project/veramo/commit/417dc5dd157ee259b6f89f4987f1ecca444fb1d4))\n\n\n### Features\n\n* **did-comm:** didcomm messaging using did:ethr ([#744](https://github.com/uport-project/veramo/issues/744)) ([1be5e04](https://github.com/uport-project/veramo/commit/1be5e04e09112c0823d776fe2d55117d71a7b448)), closes [#743](https://github.com/uport-project/veramo/issues/743)\n\n\n\n\n\n# [3.0.0](https://github.com/uport-project/veramo/compare/v2.1.3...v3.0.0) (2021-09-20)\n\n\n### Bug Fixes\n\n* **deps:** update all non-major dependencies ([8fc5312](https://github.com/uport-project/veramo/commit/8fc53120498ce2982e8ec640e00bbb03f6f4204e))\n\n\n\n\n\n# [2.1.0](https://github.com/uport-project/veramo/compare/v2.0.1...v2.1.0) (2021-08-11)\n\n**Note:** Version bump only for package @veramo/did-jwt\n\n\n\n\n\n# [2.0.0](https://github.com/uport-project/veramo/compare/v1.2.2...v2.0.0) (2021-07-14)\n\n\n### Bug Fixes\n\n* **deps:** bump did-jwt to 5.4.0 ([#528](https://github.com/uport-project/veramo/issues/528)) ([65f22cf](https://github.com/uport-project/veramo/commit/65f22cf6dcca48b5bb35331894536a2a567a1189))\n* **deps:** update all non-major dependencies ([9f40f7d](https://github.com/uport-project/veramo/commit/9f40f7d8b2a67e112b7ef2322ba887ee9033646c))\n* **deps:** update dependency did-jwt to v5.5.2 ([ae0661f](https://github.com/uport-project/veramo/commit/ae0661fc5b225f80ebb102db60d55822b4786bce))\n\n\n### Features\n\n* implement didcomm v2 packing/unpacking ([#575](https://github.com/uport-project/veramo/issues/575)) ([249b07e](https://github.com/uport-project/veramo/commit/249b07eca8d2de9eb5252d71683d5f1fba319d60)), closes [#559](https://github.com/uport-project/veramo/issues/559) [#558](https://github.com/uport-project/veramo/issues/558)\n\n\n\n\n\n# [1.2.0](https://github.com/uport-project/veramo/compare/v1.1.2...v1.2.0) (2021-04-27)\n\n\n### Features\n\n* adapt to did core spec ([#430](https://github.com/uport-project/veramo/issues/430)) ([9712db0](https://github.com/uport-project/veramo/commit/9712db0eea1a3f48cf0665d66ae715ea0c23cd4a)), closes [#418](https://github.com/uport-project/veramo/issues/418) [#428](https://github.com/uport-project/veramo/issues/428) [#417](https://github.com/uport-project/veramo/issues/417) [#416](https://github.com/uport-project/veramo/issues/416) [#412](https://github.com/uport-project/veramo/issues/412) [#397](https://github.com/uport-project/veramo/issues/397) [#384](https://github.com/uport-project/veramo/issues/384) [#394](https://github.com/uport-project/veramo/issues/394)\n\n\n\n\n\n# [1.1.0](https://github.com/uport-project/veramo/compare/v1.0.1...v1.1.0) (2021-01-26)\n\n**Note:** Version bump only for package @veramo/did-jwt\n\n\n\n\n\n## 1.0.1 (2020-12-18)\n\n**Note:** Version bump only for package @veramo/did-jwt\n"
  },
  {
    "path": "packages/did-jwt/LICENSE",
    "content": "                                 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 2019 Consensys AG\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"
  },
  {
    "path": "packages/did-jwt/README.md",
    "content": "# Veramo did-jwt message validator\n\nVeramo message validator plugin for decoding and verifying JWT payloads."
  },
  {
    "path": "packages/did-jwt/api-extractor.json",
    "content": "{\n  \"$schema\": \"https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json\",\n  \"apiReport\": {\n    \"enabled\": true,\n    \"reportFolder\": \"./api\",\n    \"reportTempFolder\": \"./api\"\n  },\n\n  \"docModel\": {\n    \"enabled\": true,\n    \"apiJsonFilePath\": \"./api/<unscopedPackageName>.api.json\"\n  },\n\n  \"dtsRollup\": {\n    \"enabled\": false\n  },\n  \"mainEntryPointFilePath\": \"<projectFolder>/build/index.d.ts\"\n}\n"
  },
  {
    "path": "packages/did-jwt/package.json",
    "content": "{\n  \"name\": \"@veramo/did-jwt\",\n  \"description\": \"Veramo message validator plugin for decoding and verifying JWT payloads.\",\n  \"version\": \"7.0.0\",\n  \"main\": \"build/index.js\",\n  \"exports\": \"./build/index.js\",\n  \"types\": \"build/index.d.ts\",\n  \"scripts\": {\n    \"build\": \"tsc\",\n    \"extract-api\": \"node ../cli/bin/veramo.js dev extract-api\"\n  },\n  \"dependencies\": {\n    \"@veramo/core-types\": \"workspace:^\",\n    \"@veramo/message-handler\": \"workspace:^\",\n    \"debug\": \"^4.3.3\",\n    \"did-jwt\": \"^8.0.0\",\n    \"did-resolver\": \"^4.1.0\"\n  },\n  \"devDependencies\": {\n    \"@types/debug\": \"4.1.8\",\n    \"typescript\": \"5.7.3\"\n  },\n  \"files\": [\n    \"build/**/*\",\n    \"src/**/*\",\n    \"README.md\",\n    \"LICENSE\"\n  ],\n  \"publishConfig\": {\n    \"access\": \"public\"\n  },\n  \"repository\": {\n    \"type\": \"git\",\n    \"url\": \"https://github.com/decentralized-identity/veramo.git\",\n    \"directory\": \"packages/did-jwt\"\n  },\n  \"author\": \"Consensys Mesh R&D <hello@veramo.io>\",\n  \"contributors\": [\n    \"Simonas Karuzas <simonas.karuzas@mesh.xyz>\",\n    \"Mircea Nistor <mircea.nistor@mesh.xyz>\"\n  ],\n  \"keywords\": [\n    \"Veramo\",\n    \"DID\",\n    \"Verifiable Credential\",\n    \"veramo-plugin\",\n    \"vc-jwt\",\n    \"JWT\",\n    \"DID-JWT\"\n  ],\n  \"license\": \"Apache-2.0\",\n  \"type\": \"module\",\n  \"moduleDirectories\": [\n    \"node_modules\",\n    \"src\"\n  ]\n}\n"
  },
  {
    "path": "packages/did-jwt/src/__tests__/didkey.test.ts",
    "content": "import { DIDResolutionResult, IAgentContext, IResolver } from '../../../core-types/src'\nimport { Message } from '../../../message-handler/src'\nimport { JwtMessageHandler, IContext } from '../message-handler.js'\nimport { jest } from '@jest/globals'\n\ndescribe('@veramo/did-jwt', () => {\n  const vcJwt =\n    'eyJhbGciOiJFZERTQSIsInR5cCI6IkpXVCJ9.eyJ2YyI6eyJAY29udGV4dCI6WyJodHRwczovL3d3dy53My5vcmcvMjAxOC9jcmVkZW50aWFscy92MSIsImh0dHBzOi8vZXhhbXBsZS5jb20vMS8yLzMiXSwidHlwZSI6WyJWZXJpZmlhYmxlQ3JlZGVudGlhbCIsIkN1c3RvbSJdLCJjcmVkZW50aWFsU3ViamVjdCI6eyJ5b3UiOiJSb2NrIn19LCJzdWIiOiJkaWQ6d2ViOmV4YW1wbGUuY29tIiwibmJmIjoxNjA3MTEyNTA4LCJpc3MiOiJkaWQ6a2V5Ono2TWtpRkpBcU1HUE5tSnFLS0NkVW11REhSdUo3QWp3ZXFIQ200Q2NLd2tkelJINSJ9.KBRelZUm3bTURJ_biZaU51MqT22IN96FFS0cj1zuGijBg5cu1dXOMahnYK_E4Rz2iYpk9esVG9YEdLNjKGVfCA'\n\n  const context: IContext = {\n    // @ts-ignore\n    agent: {\n      getSchema: jest.fn(),\n      execute: jest.fn(),\n      availableMethods: jest.fn(),\n      emit: jest.fn(),\n      resolveDid: async (args?): Promise<DIDResolutionResult> => {\n        if (!args?.didUrl) throw Error('DID required')\n\n        return {\n          didDocumentMetadata: {},\n          didResolutionMetadata: {},\n          didDocument: {\n            '@context': ['https://www.w3.org/ns/did/v1'],\n            id: 'did:key:z6MkiFJAqMGPNmJqKKCdUmuDHRuJ7AjweqHCm4CcKwkdzRH5',\n            verificationMethod: [\n              {\n                id: 'did:key:z6MkiFJAqMGPNmJqKKCdUmuDHRuJ7AjweqHCm4CcKwkdzRH5#z6MkiFJAqMGPNmJqKKCdUmuDHRuJ7AjweqHCm4CcKwkdzRH5',\n                type: 'Ed25519VerificationKey2018',\n                controller: 'did:key:z6MkiFJAqMGPNmJqKKCdUmuDHRuJ7AjweqHCm4CcKwkdzRH5',\n                publicKeyJwk: {\n                  kty: 'OKP',\n                  crv: 'Ed25519',\n                  x: 'OF4uPFtnTUcrZESegfsnJ0K8v5mDnv7wRtoBFpwClYw',\n                },\n              },\n            ],\n            authentication: [\n              'did:key:z6MkiFJAqMGPNmJqKKCdUmuDHRuJ7AjweqHCm4CcKwkdzRH5#z6MkiFJAqMGPNmJqKKCdUmuDHRuJ7AjweqHCm4CcKwkdzRH5',\n            ],\n            assertionMethod: [\n              'did:key:z6MkiFJAqMGPNmJqKKCdUmuDHRuJ7AjweqHCm4CcKwkdzRH5#z6MkiFJAqMGPNmJqKKCdUmuDHRuJ7AjweqHCm4CcKwkdzRH5',\n            ],\n          },\n        }\n      },\n      getDIDComponentById: jest.fn(),\n    },\n  } as IAgentContext<IResolver>\n\n  it('should handle EdDsa jwt', async () => {\n    const mockNextHandler = {\n      setNext: jest.fn(),\n      // @ts-ignore\n      handle: jest.fn().mockResolvedValue(true),\n    }\n    const handler = new JwtMessageHandler()\n    // @ts-ignore\n    handler.setNext(mockNextHandler)\n\n    const message = new Message({ raw: vcJwt, metaData: [{ type: 'test' }] })\n    await handler.handle(message, context)\n    expect(mockNextHandler.handle).toHaveBeenCalledWith(\n      expect.objectContaining({\n        raw: vcJwt,\n        data: {\n          iss: 'did:key:z6MkiFJAqMGPNmJqKKCdUmuDHRuJ7AjweqHCm4CcKwkdzRH5',\n          nbf: 1607112508,\n          sub: 'did:web:example.com',\n          vc: {\n            '@context': ['https://www.w3.org/2018/credentials/v1', 'https://example.com/1/2/3'],\n            credentialSubject: { you: 'Rock' },\n            type: ['VerifiableCredential', 'Custom'],\n          },\n        },\n        metaData: [{ type: 'test' }, { type: 'JWT', value: 'EdDSA' }],\n      }),\n      context,\n    )\n  })\n})\n"
  },
  {
    "path": "packages/did-jwt/src/__tests__/message-handler.test.ts",
    "content": "import { DIDResolutionResult, IAgentContext, IResolver } from '../../../core-types/src'\nimport { Message } from '../../../message-handler/src'\nimport { JwtMessageHandler, IContext } from '../message-handler.js'\nimport { jest } from '@jest/globals'\n\ndescribe('@veramo/did-jwt', () => {\n  const vcJwt =\n    'eyJ0eXAiOiJKV1QiLCJhbGciOiJFUzI1NkstUiJ9.eyJpYXQiOjE1ODI2MTk2NzYsInN1YiI6ImRpZDpldGhyOnJpbmtlYnk6MHgzYzM1N2JhNDU4OTMzYTE5YzFkZjFjN2Y2YjQ3M2IzMzAyYmJiZTYxIiwidmMiOnsiQGNvbnRleHQiOlsiaHR0cHM6Ly93d3cudzMub3JnLzIwMTgvY3JlZGVudGlhbHMvdjEiXSwidHlwZSI6WyJWZXJpZmlhYmxlQ3JlZGVudGlhbCJdLCJjcmVkZW50aWFsU3ViamVjdCI6eyJuYW1lIjoiQWxpY2UifX0sImlzcyI6ImRpZDpldGhyOnJpbmtlYnk6MHgzYzM1N2JhNDU4OTMzYTE5YzFkZjFjN2Y2YjQ3M2IzMzAyYmJiZTYxIn0.IGF1LFOc4_PcGVeq7Yw7OGz4Gj7xXZK6p8bP9CSEIXz7mNFPM0v0nuevTZ47a0I8XgLfCFNkUrIIscjH8MFx_wE'\n\n  const vcPayload = {\n    iat: 1582619676,\n    sub: 'did:ethr:rinkeby:0x3c357ba458933a19c1df1c7f6b473b3302bbbe61',\n    vc: {\n      '@context': ['https://www.w3.org/2018/credentials/v1'],\n      type: ['VerifiableCredential'],\n      credentialSubject: {\n        name: 'Alice',\n      },\n    },\n    iss: 'did:ethr:rinkeby:0x3c357ba458933a19c1df1c7f6b473b3302bbbe61',\n  }\n\n  const vpJwt =\n    'eyJ0eXAiOiJKV1QiLCJhbGciOiJFUzI1NkstUiJ9.eyJpYXQiOjE1ODI2MTk4NzUsImF1ZCI6ImRpZDpldGhyOnJpbmtlYnk6MHgzYzM1N2JhNDU4OTMzYTE5YzFkZjFjN2Y2YjQ3M2IzMzAyYmJiZTYxIiwidGFnIjoieHl6LTEyMyIsInZwIjp7IkBjb250ZXh0IjpbImh0dHBzOi8vd3d3LnczLm9yZy8yMDE4L2NyZWRlbnRpYWxzL3YxIl0sInR5cGUiOlsiVmVyaWZpYWJsZVByZXNlbnRhdGlvbiJdLCJ2ZXJpZmlhYmxlQ3JlZGVudGlhbCI6WyJleUowZVhBaU9pSktWMVFpTENKaGJHY2lPaUpGVXpJMU5rc3RVaUo5LmV5SnBZWFFpT2pFMU9ESTJNVGsyTnpZc0luTjFZaUk2SW1ScFpEcGxkR2h5T25KcGJtdGxZbms2TUhnell6TTFOMkpoTkRVNE9UTXpZVEU1WXpGa1pqRmpOMlkyWWpRM00ySXpNekF5WW1KaVpUWXhJaXdpZG1NaU9uc2lRR052Ym5SbGVIUWlPbHNpYUhSMGNITTZMeTkzZDNjdWR6TXViM0puTHpJd01UZ3ZZM0psWkdWdWRHbGhiSE12ZGpFaVhTd2lkSGx3WlNJNld5SldaWEpwWm1saFlteGxRM0psWkdWdWRHbGhiQ0pkTENKamNtVmtaVzUwYVdGc1UzVmlhbVZqZENJNmV5SnVZVzFsSWpvaVFXeHBZMlVpZlgwc0ltbHpjeUk2SW1ScFpEcGxkR2h5T25KcGJtdGxZbms2TUhnell6TTFOMkpoTkRVNE9UTXpZVEU1WXpGa1pqRmpOMlkyWWpRM00ySXpNekF5WW1KaVpUWXhJbjAuSUdGMUxGT2M0X1BjR1ZlcTdZdzdPR3o0R2o3eFhaSzZwOGJQOUNTRUlYejdtTkZQTTB2MG51ZXZUWjQ3YTBJOFhnTGZDRk5rVXJJSXNjakg4TUZ4X3dFIl19LCJpc3MiOiJkaWQ6ZXRocjpyaW5rZWJ5OjB4M2MzNTdiYTQ1ODkzM2ExOWMxZGYxYzdmNmI0NzNiMzMwMmJiYmU2MSJ9.7gIGq437moBKMwF3PUrycjCP4Op6dL6IJV6GygSq1KGV7QU0II16YzETsr412AlHl_kaYgUJjRav7unJdyJL0wA'\n\n  const vpPayload = {\n    iat: 1582619875,\n    aud: 'did:ethr:rinkeby:0x3c357ba458933a19c1df1c7f6b473b3302bbbe61',\n    tag: 'xyz-123',\n    vp: {\n      '@context': ['https://www.w3.org/2018/credentials/v1'],\n      type: ['VerifiablePresentation'],\n      verifiableCredential: [\n        'eyJ0eXAiOiJKV1QiLCJhbGciOiJFUzI1NkstUiJ9.eyJpYXQiOjE1ODI2MTk2NzYsInN1YiI6ImRpZDpldGhyOnJpbmtlYnk6MHgzYzM1N2JhNDU4OTMzYTE5YzFkZjFjN2Y2YjQ3M2IzMzAyYmJiZTYxIiwidmMiOnsiQGNvbnRleHQiOlsiaHR0cHM6Ly93d3cudzMub3JnLzIwMTgvY3JlZGVudGlhbHMvdjEiXSwidHlwZSI6WyJWZXJpZmlhYmxlQ3JlZGVudGlhbCJdLCJjcmVkZW50aWFsU3ViamVjdCI6eyJuYW1lIjoiQWxpY2UifX0sImlzcyI6ImRpZDpldGhyOnJpbmtlYnk6MHgzYzM1N2JhNDU4OTMzYTE5YzFkZjFjN2Y2YjQ3M2IzMzAyYmJiZTYxIn0.IGF1LFOc4_PcGVeq7Yw7OGz4Gj7xXZK6p8bP9CSEIXz7mNFPM0v0nuevTZ47a0I8XgLfCFNkUrIIscjH8MFx_wE',\n      ],\n    },\n    iss: 'did:ethr:rinkeby:0x3c357ba458933a19c1df1c7f6b473b3302bbbe61',\n  }\n\n  const vpMultiAudJwt =\n    'eyJ0eXAiOiJKV1QiLCJhbGciOiJFUzI1NkstUiJ9.eyJpYXQiOjE1ODg2NzY3MzksInZwIjp7IkBjb250ZXh0IjpbImh0dHBzOi8vd3d3LnczLm9yZy8yMDE4L2NyZWRlbnRpYWxzL3YxIl0sInR5cGUiOlsiVmVyaWZpYWJsZVByZXNlbnRhdGlvbiJdLCJ2ZXJpZmlhYmxlQ3JlZGVudGlhbCI6WyJleUowZVhBaU9pSktWMVFpTENKaGJHY2lPaUpGVXpJMU5rc3RVaUo5LmV5SnBZWFFpT2pFMU9ESTJNVGsyTnpZc0luTjFZaUk2SW1ScFpEcGxkR2h5T25KcGJtdGxZbms2TUhnell6TTFOMkpoTkRVNE9UTXpZVEU1WXpGa1pqRmpOMlkyWWpRM00ySXpNekF5WW1KaVpUWXhJaXdpZG1NaU9uc2lRR052Ym5SbGVIUWlPbHNpYUhSMGNITTZMeTkzZDNjdWR6TXViM0puTHpJd01UZ3ZZM0psWkdWdWRHbGhiSE12ZGpFaVhTd2lkSGx3WlNJNld5SldaWEpwWm1saFlteGxRM0psWkdWdWRHbGhiQ0pkTENKamNtVmtaVzUwYVdGc1UzVmlhbVZqZENJNmV5SnVZVzFsSWpvaVFXeHBZMlVpZlgwc0ltbHpjeUk2SW1ScFpEcGxkR2h5T25KcGJtdGxZbms2TUhnell6TTFOMkpoTkRVNE9UTXpZVEU1WXpGa1pqRmpOMlkyWWpRM00ySXpNekF5WW1KaVpUWXhJbjAuSUdGMUxGT2M0X1BjR1ZlcTdZdzdPR3o0R2o3eFhaSzZwOGJQOUNTRUlYejdtTkZQTTB2MG51ZXZUWjQ3YTBJOFhnTGZDRk5rVXJJSXNjakg4TUZ4X3dFIl19LCJ0YWciOiJ0YWcxMjMiLCJhdWQiOlsiZGlkOmV4YW1wbGU6MzQ1NiIsImRpZDp3ZWI6dXBvcnQubWUiXSwiaXNzIjoiZGlkOmV0aHI6cmlua2VieToweGIwOWI2NjAyNmJhNTkwOWE3Y2ZlOTliNzY4NzU0MzFkMmI4ZDUxOTAifQ.4SWpp8siCBHP47KrOT_28IJIQPZLCWO9VS0Ir-VVYOGUAVj7vHtXLxl3Y6lLAxYeNqWrRPCAVkDArBFCNRjYUgA'\n\n  const vpMultiAudPayload = {\n    iat: 1588676739,\n    vp: {\n      '@context': ['https://www.w3.org/2018/credentials/v1'],\n      type: ['VerifiablePresentation'],\n      verifiableCredential: [\n        'eyJ0eXAiOiJKV1QiLCJhbGciOiJFUzI1NkstUiJ9.eyJpYXQiOjE1ODI2MTk2NzYsInN1YiI6ImRpZDpldGhyOnJpbmtlYnk6MHgzYzM1N2JhNDU4OTMzYTE5YzFkZjFjN2Y2YjQ3M2IzMzAyYmJiZTYxIiwidmMiOnsiQGNvbnRleHQiOlsiaHR0cHM6Ly93d3cudzMub3JnLzIwMTgvY3JlZGVudGlhbHMvdjEiXSwidHlwZSI6WyJWZXJpZmlhYmxlQ3JlZGVudGlhbCJdLCJjcmVkZW50aWFsU3ViamVjdCI6eyJuYW1lIjoiQWxpY2UifX0sImlzcyI6ImRpZDpldGhyOnJpbmtlYnk6MHgzYzM1N2JhNDU4OTMzYTE5YzFkZjFjN2Y2YjQ3M2IzMzAyYmJiZTYxIn0.IGF1LFOc4_PcGVeq7Yw7OGz4Gj7xXZK6p8bP9CSEIXz7mNFPM0v0nuevTZ47a0I8XgLfCFNkUrIIscjH8MFx_wE',\n      ],\n    },\n    tag: 'tag123',\n    aud: ['did:example:3456', 'did:web:uport.me'],\n    iss: 'did:ethr:rinkeby:0xb09b66026ba5909a7cfe99b76875431d2b8d5190',\n  }\n\n  const context: IContext = {\n    // @ts-ignore\n    agent: {\n      getSchema: jest.fn(),\n      execute: jest.fn(),\n      availableMethods: jest.fn(),\n      emit: jest.fn(),\n      resolveDid: async (args?): Promise<DIDResolutionResult> => {\n        if (!args?.didUrl) throw Error('DID required')\n\n        return {\n          didResolutionMetadata: {},\n          didDocumentMetadata: {},\n          didDocument: {\n            '@context': 'https://www.w3.org/ns/did/v1',\n            id: args?.didUrl,\n            verificationMethod: [\n              {\n                id: `${args?.didUrl}#owner`,\n                type: 'EcdsaSecp256k1RecoveryMethod2020',\n                controller: args?.didUrl,\n                blockchainAccountId: `${args?.didUrl.slice(-42)}@eip155:1`,\n              },\n            ],\n            authentication: [`${args?.didUrl}#owner`],\n          },\n        }\n      },\n      getDIDComponentById: jest.fn(),\n    },\n  } as IAgentContext<IResolver>\n\n  it('should reject unknown message type', async () => {\n    const mockNextHandler = {\n      setNext: jest.fn(),\n      handle: jest.fn().mockRejectedValue(new Error('Unsupported message type') as never),\n    }\n    const handler = new JwtMessageHandler()\n    // @ts-ignore\n    handler.setNext(mockNextHandler)\n    const message = new Message({ raw: 'test', metaData: [{ type: 'test' }] })\n    await expect(handler.handle(message, context)).rejects.toThrow('Unsupported message type')\n  })\n\n  it('should set data field for VC jwt', async () => {\n    const mockNextHandler = {\n      setNext: jest.fn(),\n      // @ts-ignore\n      handle: jest.fn().mockResolvedValue(true),\n    }\n    const handler = new JwtMessageHandler()\n    // @ts-ignore\n    handler.setNext(mockNextHandler)\n\n    const message = new Message({ raw: vcJwt, metaData: [{ type: 'test' }] })\n    await handler.handle(message, context)\n    expect(mockNextHandler.handle).toHaveBeenCalledWith(\n      expect.objectContaining({\n        raw: vcJwt,\n        data: vcPayload,\n        metaData: [{ type: 'test' }, { type: 'JWT', value: 'ES256K-R' }],\n      }),\n      context,\n    )\n  })\n\n  it('should set data field for VP jwt', async () => {\n    const mockNextHandler = {\n      setNext: jest.fn(),\n      // @ts-ignore\n      handle: jest.fn().mockResolvedValue(true),\n    }\n    const handler = new JwtMessageHandler()\n    // @ts-ignore\n    handler.setNext(mockNextHandler)\n\n    const message = new Message({ raw: vpJwt, metaData: [{ type: 'test' }] })\n    await handler.handle(message, context)\n    expect(mockNextHandler.handle).toHaveBeenCalledWith(\n      expect.objectContaining({\n        raw: vpJwt,\n        data: vpPayload,\n        metaData: [{ type: 'test' }, { type: 'JWT', value: 'ES256K-R' }],\n      }),\n      context,\n    )\n  })\n\n  it('should set data field for multi audience VP jwt', async () => {\n    const mockNextHandler = {\n      setNext: jest.fn(),\n      handle: jest.fn(),\n    }\n    const handler = new JwtMessageHandler()\n    // @ts-ignore\n    handler.setNext(mockNextHandler)\n\n    const message = new Message({ raw: vpMultiAudJwt, metaData: [{ type: 'test' }] })\n    await handler.handle(message, context)\n    expect(mockNextHandler.handle).toHaveBeenCalledWith(\n      expect.objectContaining({\n        raw: vpMultiAudJwt,\n        data: vpMultiAudPayload,\n        metaData: [{ type: 'test' }, { type: 'JWT', value: 'ES256K-R' }],\n      }),\n      context,\n    )\n  })\n})\n"
  },
  {
    "path": "packages/did-jwt/src/index.ts",
    "content": "/**\n * Provides a {@link @veramo/did-jwt#JwtMessageHandler | plugin } for the\n * {@link @veramo/message-handler#MessageHandler} that finds and verifies a JWT in a message.\n *\n * @packageDocumentation\n */\nexport { JwtMessageHandler } from './message-handler.js'\n"
  },
  {
    "path": "packages/did-jwt/src/message-handler.ts",
    "content": "import { IAgentContext, IResolver } from '@veramo/core-types'\nimport { AbstractMessageHandler, Message } from '@veramo/message-handler'\nimport { verifyJWT, decodeJWT } from 'did-jwt'\nimport Debug from 'debug'\nimport { Resolvable } from 'did-resolver'\n\nconst debug = Debug('veramo:did-jwt:message-handler')\n\nexport type IContext = IAgentContext<IResolver>\n\n/**\n * A plugin for {@link @veramo/message-handler#MessageHandler} that finds and verifies a JWT in a message.\n * @public\n */\nexport class JwtMessageHandler extends AbstractMessageHandler {\n  async handle(message: Message, context: IContext): Promise<Message> {\n    if (message.raw) {\n      try {\n        const decoded = decodeJWT(message.raw)\n        const audience = Array.isArray(decoded.payload.aud) ? decoded.payload.aud[0] : decoded.payload.aud\n        const resolver = { resolve: (didUrl: string) => context.agent.resolveDid({ didUrl }) } as Resolvable\n        const result = await verifyJWT(message.raw, { resolver, audience })\n        if (result.verified) {\n          debug('Message.raw is a valid JWT')\n          message.addMetaData({ type: decoded.header.typ || 'JWT', value: decoded.header.alg })\n          message.data = result.payload\n        } else {\n          debug(result)\n        }\n      } catch (e: any) {\n        debug(e.message)\n      }\n    }\n\n    return super.handle(message, context)\n  }\n}\n"
  },
  {
    "path": "packages/did-jwt/tsconfig.json",
    "content": "{\n  \"extends\": \"../tsconfig.settings.json\",\n  \"compilerOptions\": {\n    \"rootDir\": \"src\",\n    \"outDir\": \"build\",\n    \"declarationDir\": \"build\",\n    \"skipLibCheck\": true\n  },\n  \"references\": [{ \"path\": \"../core-types\" }, { \"path\": \"../message-handler\" }]\n}\n"
  },
  {
    "path": "packages/did-manager/CHANGELOG.md",
    "content": "# Change Log\n\nAll notable changes to this project will be documented in this file.\nSee [Conventional Commits](https://conventionalcommits.org) for commit guidelines.\n\n# [7.0.0](https://github.com/decentralized-identity/veramo/compare/v6.0.2...v7.0.0) (2026-02-11)\n\n\n### Bug Fixes\n\n* **deps:** update devdeps and bump typeorm to 0.3.20 ([#1272](https://github.com/decentralized-identity/veramo/issues/1272)) ([7d17f37](https://github.com/decentralized-identity/veramo/commit/7d17f37ea7cc4e73a8cdae028681ae1be5c4d11c))\n\n\n### Features\n\n* **did-manager:** add 'isLocal' in 'options' to only modify DIDStore ([#1452](https://github.com/decentralized-identity/veramo/issues/1452)) ([94da414](https://github.com/decentralized-identity/veramo/commit/94da414f0b1a9fe7b837faf01749191176826af1))\n\n\n\n\n\n## [6.0.2](https://github.com/decentralized-identity/veramo/compare/v6.0.1...v6.0.2) (2026-01-16)\n\n**Note:** Version bump only for package @veramo/did-manager\n\n\n\n\n\n## [6.0.1](https://github.com/decentralized-identity/veramo/compare/v6.0.0...v6.0.1) (2026-01-16)\n\n**Note:** Version bump only for package @veramo/did-manager\n\n\n\n\n\n# [6.0.0](https://github.com/decentralized-identity/veramo/compare/v5.6.0...v6.0.0) (2024-04-02)\n\n\n### Bug Fixes\n\n* export const plugin schemas instead of defaults ([#1327](https://github.com/decentralized-identity/veramo/issues/1327)) ([7896cea](https://github.com/decentralized-identity/veramo/commit/7896ceaf2c79993eee44e46950814bea74bfe647)), closes [#1318](https://github.com/decentralized-identity/veramo/issues/1318) [#1317](https://github.com/decentralized-identity/veramo/issues/1317) [#1315](https://github.com/decentralized-identity/veramo/issues/1315)\n\n\n### Code Refactoring\n\n* generate plugin schemas as TS instead of JSON ([#1315](https://github.com/decentralized-identity/veramo/issues/1315)) ([65c2d4b](https://github.com/decentralized-identity/veramo/commit/65c2d4bc814daa9a3a89f4f7b8e8c6973b8ce2f0)), closes [#1254](https://github.com/decentralized-identity/veramo/issues/1254)\n\n\n### BREAKING CHANGES\n\n* The `plugin.schema.json` files are now generated as `plugin.schema.ts`.\n\n\n\n\n\n# [5.6.0](https://github.com/decentralized-identity/veramo/compare/v5.5.3...v5.6.0) (2024-01-16)\n\n\n### Features\n\n* **remote-client:** allow dynamic headers param for AgentRestClient constructor ([#1314](https://github.com/decentralized-identity/veramo/issues/1314)) ([1b8a0a2](https://github.com/decentralized-identity/veramo/commit/1b8a0a2718dd63492ad3a312a6ebe5f6e7849935)), closes [#1313](https://github.com/decentralized-identity/veramo/issues/1313)\n\n\n\n\n\n## [5.5.3](https://github.com/decentralized-identity/veramo/compare/v5.5.2...v5.5.3) (2023-10-09)\n\n\n### Bug Fixes\n\n* use DIF URLs in packages ([#1271](https://github.com/decentralized-identity/veramo/issues/1271)) ([3dfc601](https://github.com/decentralized-identity/veramo/commit/3dfc6014cdee7902c59d8db76b4c8507b870f227))\n\n\n\n\n\n# [5.5.0](https://github.com/uport-project/veramo/compare/v5.4.1...v5.5.0) (2023-09-19)\n\n\n### Bug Fixes\n\n* **did-provider-key:** use compressed keys for creating Secp256k1 did:key ([#1217](https://github.com/uport-project/veramo/issues/1217)) ([ba8f6f5](https://github.com/uport-project/veramo/commit/ba8f6f5b9b701e57af86491504ecd209ca0c1c1d)), closes [#1213](https://github.com/uport-project/veramo/issues/1213)\n\n\n\n\n\n## [5.4.1](https://github.com/uport-project/veramo/compare/v5.4.0...v5.4.1) (2023-08-04)\n\n\n### Bug Fixes\n\n* **ci:** benign change meant to tag all packages for another patch release ([#1211](https://github.com/uport-project/veramo/issues/1211)) ([41b5c90](https://github.com/uport-project/veramo/commit/41b5c90277171b7b38c5cf49ca01db5cf75b6300))\n\n\n\n\n\n# [5.4.0](https://github.com/uport-project/veramo/compare/v5.3.0...v5.4.0) (2023-08-01)\n\n**Note:** Version bump only for package @veramo/did-manager\n\n\n\n\n\n# [5.3.0](https://github.com/uport-project/veramo/compare/v5.2.0...v5.3.0) (2023-07-27)\n\n**Note:** Version bump only for package @veramo/did-manager\n\n\n\n\n\n## [5.1.2](https://github.com/uport-project/veramo/compare/v5.1.1...v5.1.2) (2023-02-25)\n\n**Note:** Version bump only for package @veramo/did-manager\n\n\n\n\n\n# [5.1.0](https://github.com/uport-project/veramo/compare/v5.0.0...v5.1.0) (2023-02-24)\n\n**Note:** Version bump only for package @veramo/did-manager\n\n\n\n\n\n# [5.0.0](https://github.com/uport-project/veramo/compare/v4.3.0...v5.0.0) (2023-02-09)\n\n\n### Bug Fixes\n\n* **did-manager:** rename AbstractDIDStore methods for SES compatibility ([0287340](https://github.com/uport-project/veramo/commit/02873401508a8a7d8c999bc12dc1d107a4a5202f)), closes [#1090](https://github.com/uport-project/veramo/issues/1090)\n\n\n### Build System\n\n* convert veramo modules to ESM instead of CommonJS ([#1103](https://github.com/uport-project/veramo/issues/1103)) ([b5cea3c](https://github.com/uport-project/veramo/commit/b5cea3c0d80d900a47bd1d9eea68f84b70a35e7b)), closes [#1099](https://github.com/uport-project/veramo/issues/1099)\n\n\n### Features\n\n* isolate `core-types` package from `core` ([#1116](https://github.com/uport-project/veramo/issues/1116)) ([ba7a303](https://github.com/uport-project/veramo/commit/ba7a303de91cf4cc568a3af1ddf8ca98ed022e9f))\n\n\n### BREAKING CHANGES\n\n* **did-manager:** implementations of AbstractDIDStore need to rename their methods to conform to the new API. Functionality remains the same.\n* this is a breaking change as modules will have to be imported differently: \n* https://www.typescriptlang.org/docs/handbook/esm-node.html\n* https://nodejs.org/api/esm.html\n* https://caniuse.com/?search=modules\n\ntest(did-provider-ion): skip a couple of tests that fail with unreasonable errors\nchore: use ubuntu-latest on CI\nfix: temporarily remove puppeteer tests\nfix: use craco for test-react-app to enable babel config\ntest: fix unit and integration tests (browser tests still broken)\nfix: fix some build issues that prevented tests from working\nfix: missing deps flagged by pnpm\n\n\n\n\n\n# [4.3.0](https://github.com/uport-project/veramo/compare/v4.2.0...v4.3.0) (2023-01-27)\n\n**Note:** Version bump only for package @veramo/did-manager\n\n\n\n\n\n# [4.2.0](https://github.com/uport-project/veramo/compare/v4.1.2...v4.2.0) (2022-12-05)\n\n\n### Bug Fixes\n\n* **deps:** bump dependencies ([701b8ed](https://github.com/uport-project/veramo/commit/701b8edf981ea11c7ddb6a81d2817dbbdbb022f3))\n\n\n\n\n\n## [4.1.1](https://github.com/uport-project/veramo/compare/v4.1.0...v4.1.1) (2022-11-01)\n\n**Note:** Version bump only for package @veramo/did-manager\n\n\n\n\n\n# [4.1.0](https://github.com/uport-project/veramo/compare/v4.0.2...v4.1.0) (2022-10-31)\n\n**Note:** Version bump only for package @veramo/did-manager\n\n\n\n\n\n# [4.0.0](https://github.com/uport-project/veramo/compare/v3.1.5...v4.0.0) (2022-09-22)\n\n\n### Bug Fixes\n\n* **did-resolver:** use interface `Resolvable` instead of the `Resolver` class ([9c2e59f](https://github.com/uport-project/veramo/commit/9c2e59f3f23f808511c6c0e8e440b4d53ba5cb00))\n* update and fix inline documentation of all exported types ([#921](https://github.com/uport-project/veramo/issues/921)) ([63e64e0](https://github.com/uport-project/veramo/commit/63e64e0e2693808c4704dca8cc511dc0bab3f3b1))\n\n\n### Features\n\n* **credential-status:** rename plugin interfaces and methods ([a5adaba](https://github.com/uport-project/veramo/commit/a5adaba21a97f525bf69d156df991afc234896ab)), closes [#981](https://github.com/uport-project/veramo/issues/981)\n* **did-manager:** add`didManagerUpdate` method for full DID document updates ([#974](https://github.com/uport-project/veramo/issues/974)) ([5682b25](https://github.com/uport-project/veramo/commit/5682b2566b7c4f8f9bfda10e8d06a8d2624c2a1b)), closes [#971](https://github.com/uport-project/veramo/issues/971) [#960](https://github.com/uport-project/veramo/issues/960) [#948](https://github.com/uport-project/veramo/issues/948)\n* **did-provider-ethr:** use multiple networks per EthrDIDProvider ([#969](https://github.com/uport-project/veramo/issues/969)) ([0a88058](https://github.com/uport-project/veramo/commit/0a88058a5efddfe09f9f35510cc1bbc21149bf18)), closes [#968](https://github.com/uport-project/veramo/issues/968) [#893](https://github.com/uport-project/veramo/issues/893)\n\n\n\n\n\n## [3.1.3](https://github.com/uport-project/veramo/compare/v3.1.2...v3.1.3) (2022-06-01)\n\n**Note:** Version bump only for package @veramo/did-manager\n\n\n\n\n\n# [3.1.0](https://github.com/uport-project/veramo/compare/v3.0.0...v3.1.0) (2021-11-12)\n\n**Note:** Version bump only for package @veramo/did-manager\n\n\n\n\n\n# [3.0.0](https://github.com/uport-project/veramo/compare/v2.1.3...v3.0.0) (2021-09-20)\n\n\n### Features\n\n* **data-store:** initialize DB using migrations ([#679](https://github.com/uport-project/veramo/issues/679)) ([41f6240](https://github.com/uport-project/veramo/commit/41f6240d68a79338772230cbfff768189ab031ed)), closes [#676](https://github.com/uport-project/veramo/issues/676)\n* **key-manager:** move private key storage to kms-local ([#661](https://github.com/uport-project/veramo/issues/661)) ([6b1d135](https://github.com/uport-project/veramo/commit/6b1d135eedb1c58b715be8941d34312da39facb2)), closes [#539](https://github.com/uport-project/veramo/issues/539) [#540](https://github.com/uport-project/veramo/issues/540) [#680](https://github.com/uport-project/veramo/issues/680)\n\n\n### BREAKING CHANGES\n\n* **key-manager:** `keyManagetGet` no longer returns private key data\n* **key-manager:** `KeyStore` no longer requires a `SecretBox`\n* **key-manager:** `KeyManagementSystem` needs a `PrivateKeyStore`\n* **key-manager:** @veramo/cli configuration version update to 3.0\n\nIf you're already working with Veramo and wish to upgrade existing agents to veramo 3.0, you'll have to make some changes to your configuration, depending on how you're using the framework.\n\nIt boils down to these 3 steps:\n\n1. Update your database connection to use migrations\n2. Remove the `SecretBox` parameter from `KeyManager`\n3. Add a `PrivateKeyStore` parameter to `KeyManagementSystem` with a `SecretBox` that you were using before with `KeyManager` (and keep the same encryption key)\n\n* feat(key-manager): move private key storage to kms-local\n* **data-store:** database needs migrations for initialization. See #679 #676\nThe `@veramo/data-store` package relies on `typeorm` as a database abstraction.\nTypeorm has a connection flag `synchonize` which bootstraps the database along with schema and relations based on a set of `Entities` (annotated typescript classes).\nThis is very handy for fast development iterations but it is **not recommended for production** use because there is too much ambiguity possible when the `Entities` change, and there is a risk of data loss.\nThe recommended way to do things is to use the `migrations` mechanism. It allows you to migrate to new database schemas when necessary, and even customize the database to your own needs.\n\n**Going forward, this is the mechanism we will be recommending for connections.**\n\n\n\n\n\n# [2.1.0](https://github.com/uport-project/veramo/compare/v2.0.1...v2.1.0) (2021-08-11)\n\n**Note:** Version bump only for package @veramo/did-manager\n\n\n\n\n\n# [2.0.0](https://github.com/uport-project/veramo/compare/v1.2.2...v2.0.0) (2021-07-14)\n\n\n### Features\n\n* **did-discovery:** implement a DID discovery plugin with simple providers ([#597](https://github.com/uport-project/veramo/issues/597)) ([6f01df3](https://github.com/uport-project/veramo/commit/6f01df38a732ba314d1e60728d65f511d26bfdcb))\n\n\n\n\n\n# [1.2.0](https://github.com/uport-project/veramo/compare/v1.1.2...v1.2.0) (2021-04-27)\n\n\n### Features\n\n* add MemoryDIDStore and MemoryKeyStore ([#447](https://github.com/uport-project/veramo/issues/447)) ([5ab1792](https://github.com/uport-project/veramo/commit/5ab1792f080cc319a9899e39dc9b634a05aa4f7c))\n\n\n\n\n\n# [1.1.0](https://github.com/uport-project/veramo/compare/v1.0.1...v1.1.0) (2021-01-26)\n\n**Note:** Version bump only for package @veramo/did-manager\n\n\n\n\n\n## 1.0.1 (2020-12-18)\n\n**Note:** Version bump only for package @veramo/did-manager\n"
  },
  {
    "path": "packages/did-manager/LICENSE",
    "content": "                                 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 2019 Consensys AG\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"
  },
  {
    "path": "packages/did-manager/README.md",
    "content": "# Veramo DID Manager\n\nThe DID controller abstraction plugin for Veramo.\n\nThis plugin combines multiple DID method controllers and provides the abstracted functionality to other plugins.\n"
  },
  {
    "path": "packages/did-manager/api-extractor.json",
    "content": "{\n  \"$schema\": \"https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json\",\n  \"apiReport\": {\n    \"enabled\": true,\n    \"reportFolder\": \"./api\",\n    \"reportTempFolder\": \"./api\"\n  },\n\n  \"docModel\": {\n    \"enabled\": true,\n    \"apiJsonFilePath\": \"./api/<unscopedPackageName>.api.json\"\n  },\n\n  \"dtsRollup\": {\n    \"enabled\": false\n  },\n  \"mainEntryPointFilePath\": \"<projectFolder>/build/index.d.ts\"\n}\n"
  },
  {
    "path": "packages/did-manager/package.json",
    "content": "{\n  \"name\": \"@veramo/did-manager\",\n  \"description\": \"Veramo DID manager plugin\",\n  \"version\": \"7.0.0\",\n  \"main\": \"build/index.js\",\n  \"exports\": \"./build/index.js\",\n  \"types\": \"build/index.d.ts\",\n  \"scripts\": {\n    \"build\": \"tsc\",\n    \"extract-api\": \"node ../cli/bin/veramo.js dev extract-api\"\n  },\n  \"dependencies\": {\n    \"@veramo/core-types\": \"workspace:^\",\n    \"@veramo/did-discovery\": \"workspace:^\"\n  },\n  \"devDependencies\": {\n    \"typescript\": \"5.7.3\"\n  },\n  \"files\": [\n    \"build/**/*\",\n    \"src/**/*\",\n    \"README.md\",\n    \"LICENSE\"\n  ],\n  \"publishConfig\": {\n    \"access\": \"public\"\n  },\n  \"repository\": {\n    \"type\": \"git\",\n    \"url\": \"https://github.com/decentralized-identity/veramo.git\",\n    \"directory\": \"packages/did-manager\"\n  },\n  \"author\": \"Consensys Mesh R&D <hello@veramo.io>\",\n  \"contributors\": [\n    \"Simonas Karuzas <simonas.karuzas@mesh.xyz>\",\n    \"Mircea Nistor <mircea.nistor@mesh.xyz>\"\n  ],\n  \"keywords\": [\n    \"Veramo\",\n    \"DID\",\n    \"Verifiable Credential\",\n    \"veramo-plugin\",\n    \"DID Manager\",\n    \"aggregator\"\n  ],\n  \"license\": \"Apache-2.0\",\n  \"type\": \"module\",\n  \"moduleDirectories\": [\n    \"node_modules\",\n    \"src\"\n  ]\n}\n"
  },
  {
    "path": "packages/did-manager/src/__tests__/default.test.ts",
    "content": "describe('did-manager', () => {\n  const a = 100\n  it('should run a dummy test', () => {\n    expect(a).toEqual(100)\n  })\n})\n"
  },
  {
    "path": "packages/did-manager/src/abstract-identifier-provider.ts",
    "content": "import {\n  IIdentifier,\n  IKey,\n  IService,\n  IAgentContext,\n  IKeyManager,\n  DIDDocument,\n  IDIDManagerUpdateArgs,\n  IDIDManagerAddKeyArgs,\n  IDIDManagerRemoveKeyArgs,\n  IDIDManagerAddServiceArgs,\n  IDIDManagerRemoveServiceArgs,\n} from '@veramo/core-types'\n\n/**\n * An abstract class for the {@link @veramo/did-manager#DIDManager} identifier providers\n * @public\n */\nexport abstract class AbstractIdentifierProvider {\n  abstract createIdentifier(\n    args: { kms?: string; alias?: string; options?: any },\n    context: IAgentContext<IKeyManager>,\n  ): Promise<Omit<IIdentifier, 'provider'>>\n\n  abstract updateIdentifier?(\n    args: { did: string, document: Partial<DIDDocument>, options?: IDIDManagerUpdateArgs['options'] },\n    context: IAgentContext<IKeyManager>,\n  ): Promise<IIdentifier>\n\n  abstract deleteIdentifier(args: IIdentifier, context: IAgentContext<IKeyManager>): Promise<boolean>\n\n  abstract addKey(\n    args: { identifier: IIdentifier; key: IKey; options?: IDIDManagerAddKeyArgs['options'] },\n    context: IAgentContext<IKeyManager>,\n  ): Promise<any>\n\n  abstract removeKey(\n    args: { identifier: IIdentifier; kid: string; options?: IDIDManagerRemoveKeyArgs['options'] },\n    context: IAgentContext<IKeyManager>,\n  ): Promise<any>\n\n  abstract addService(\n    args: { identifier: IIdentifier; service: IService; options?: IDIDManagerAddServiceArgs['options'] },\n    context: IAgentContext<IKeyManager>,\n  ): Promise<any>\n\n  abstract removeService(\n    args: { identifier: IIdentifier; id: string; options?: IDIDManagerRemoveServiceArgs['options'] },\n    context: IAgentContext<IKeyManager>,\n  ): Promise<any>\n\n  /**\n   * Subclasses can override this to signal that they can work with a given DID prefix\n   * @param prefix - a DID URL prefix, Example: 'did:key:z6Mk', or `did:ethr`, or `did:ethr:arbitrum:testnet`\n   */\n  matchPrefix?(prefix: string): boolean {\n    return false\n  }\n}\n"
  },
  {
    "path": "packages/did-manager/src/abstract-identifier-store.ts",
    "content": "import { IIdentifier } from '@veramo/core-types'\n\n/**\n * An abstract class for the {@link @veramo/did-manager#DIDManager} identifier store\n * @public\n */\nexport abstract class AbstractDIDStore {\n  abstract importDID(args: IIdentifier): Promise<boolean>\n  abstract getDID(args: { did: string }): Promise<IIdentifier>\n  abstract getDID(args: { alias: string }): Promise<IIdentifier>\n  abstract deleteDID(args: { did: string }): Promise<boolean>\n  abstract listDIDs(args: { alias?: string; provider?: string }): Promise<IIdentifier[]>\n}\n"
  },
  {
    "path": "packages/did-manager/src/did-discovery-provider.ts",
    "content": "import { IAgentContext, IDIDManager } from '@veramo/core-types'\nimport {\n  AbstractDidDiscoveryProvider,\n  IDIDDiscoverMatch,\n  IDIDDiscoveryProviderResult,\n  IDIDDiscoveryDiscoverDidArgs,\n} from '@veramo/did-discovery'\n\n/**\n * A DID discovery provider that can filter DIDs by the `alias` used internally in\n * {@link @veramo/did-manager#DIDManager | DIDManager}\n *\n * @beta This API may change without a BREAKING CHANGE notice.\n */\nexport class AliasDiscoveryProvider implements AbstractDidDiscoveryProvider {\n  readonly name = 'alias'\n\n  async discoverDid(\n    args: IDIDDiscoveryDiscoverDidArgs,\n    context: IAgentContext<IDIDManager>,\n  ): Promise<IDIDDiscoveryProviderResult> {\n    const matches = []\n    try {\n      const identifier = await context.agent.didManagerGetByAlias({ alias: args.query })\n      const match: IDIDDiscoverMatch = {\n        did: identifier.did,\n        metaData: {\n          alias: identifier.alias,\n        },\n      }\n      matches.push(match)\n    } catch (e) {\n    }\n\n    return {\n      provider: this.name,\n      matches,\n    }\n  }\n}\n"
  },
  {
    "path": "packages/did-manager/src/id-manager.ts",
    "content": "import { AbstractIdentifierProvider } from './abstract-identifier-provider.js'\nimport {\n  IAgentPlugin,\n  IIdentifier,\n  IAgentContext,\n  IDIDManager,\n  IKeyManager,\n  IDIDManagerGetArgs,\n  IDIDManagerCreateArgs,\n  IDIDManagerGetByAliasArgs,\n  IDIDManagerGetOrCreateArgs,\n  IDIDManagerUpdateArgs,\n  IDIDManagerDeleteArgs,\n  IDIDManagerAddKeyArgs,\n  IDIDManagerRemoveKeyArgs,\n  IDIDManagerAddServiceArgs,\n  IDIDManagerRemoveServiceArgs,\n  IDIDManagerFindArgs,\n  IDIDManagerSetAliasArgs,\n  MinimalImportableIdentifier,\n  IKey,\n  IService,\n} from '@veramo/core-types'\nimport { schema } from '@veramo/core-types'\nimport { AbstractDIDStore } from './abstract-identifier-store.js'\n\n/**\n * Agent plugin that implements {@link @veramo/core-types#IDIDManager} interface\n * @public\n */\nexport class DIDManager implements IAgentPlugin {\n  /**\n   * Plugin methods\n   * @public\n   */\n  readonly methods: IDIDManager\n  readonly schema = schema.IDIDManager\n\n  private providers: Record<string, AbstractIdentifierProvider>\n  private defaultProvider: string\n  private store: AbstractDIDStore\n\n  constructor(options: {\n    providers: Record<string, AbstractIdentifierProvider>\n    defaultProvider: string\n    store: AbstractDIDStore\n  }) {\n    this.providers = options.providers\n    this.defaultProvider = options.defaultProvider\n    this.store = options.store\n    this.methods = {\n      didManagerGetProviders: this.didManagerGetProviders.bind(this),\n      didManagerFind: this.didManagerFind.bind(this),\n      didManagerGet: this.didManagerGet.bind(this),\n      didManagerGetByAlias: this.didManagerGetByAlias.bind(this),\n      didManagerCreate: this.didManagerCreate.bind(this),\n      didManagerSetAlias: this.didManagerSetAlias.bind(this),\n      didManagerGetOrCreate: this.didManagerGetOrCreate.bind(this),\n      didManagerUpdate: this.didManagerUpdate.bind(this),\n      didManagerImport: this.didManagerImport.bind(this),\n      didManagerDelete: this.didManagerDelete.bind(this),\n      didManagerAddKey: this.didManagerAddKey.bind(this),\n      didManagerRemoveKey: this.didManagerRemoveKey.bind(this),\n      didManagerAddService: this.didManagerAddService.bind(this),\n      didManagerRemoveService: this.didManagerRemoveService.bind(this),\n    }\n  }\n\n  private getProvider(name: string): AbstractIdentifierProvider {\n    let provider: AbstractIdentifierProvider | undefined = this.providers[name]\n    if (!provider) {\n      provider = Object.values(this.providers).find(\n        (p) => typeof p.matchPrefix === 'function' && p.matchPrefix(name),\n      )\n    }\n    if (!provider) throw Error('Identifier provider does not exist: ' + name)\n    return provider\n  }\n\n  /** {@inheritDoc @veramo/core-types#IDIDManager.didManagerGetProviders} */\n  async didManagerGetProviders(): Promise<string[]> {\n    return Object.keys(this.providers)\n  }\n\n  /** {@inheritDoc @veramo/core-types#IDIDManager.didManagerFind} */\n  async didManagerFind(args: IDIDManagerFindArgs): Promise<IIdentifier[]> {\n    return this.store.listDIDs(args)\n  }\n\n  /** {@inheritDoc @veramo/core-types#IDIDManager.didManagerGet} */\n  async didManagerGet({ did }: IDIDManagerGetArgs): Promise<IIdentifier> {\n    return this.store.getDID({ did })\n  }\n\n  /** {@inheritDoc @veramo/core-types#IDIDManager.didManagerGetByAlias} */\n  async didManagerGetByAlias({ alias }: IDIDManagerGetByAliasArgs): Promise<IIdentifier> {\n    return this.store.getDID({ alias })\n  }\n\n  /** {@inheritDoc @veramo/core-types#IDIDManager.didManagerCreate} */\n  async didManagerCreate(\n    args: IDIDManagerCreateArgs,\n    context: IAgentContext<IKeyManager>,\n  ): Promise<IIdentifier> {\n    const providerName = args?.provider || this.defaultProvider\n    if (args?.alias !== undefined) {\n      let existingIdentifier\n      try {\n        existingIdentifier = await this.store.getDID({ alias: args.alias })\n      } catch (e) {}\n      if (existingIdentifier) {\n        throw Error(\n          `illegal_argument: Identifier with alias: ${args.alias} already exists: ${existingIdentifier.did}`,\n        )\n      }\n    }\n    const identifierProvider = this.getProvider(providerName)\n    const partialIdentifier = await identifierProvider.createIdentifier(\n      { kms: args?.kms, alias: args?.alias, options: { providerName, ...args?.options } },\n      context,\n    )\n    const identifier: IIdentifier = { ...partialIdentifier, provider: providerName }\n    if (args?.alias) {\n      identifier.alias = args.alias\n    }\n    await this.store.importDID(identifier)\n    return identifier\n  }\n\n  /** {@inheritDoc @veramo/core-types#IDIDManager.didManagerGetOrCreate} */\n  async didManagerGetOrCreate(\n    { provider, alias, kms, options }: IDIDManagerGetOrCreateArgs,\n    context: IAgentContext<IKeyManager>,\n  ): Promise<IIdentifier> {\n    let identifier: IIdentifier | undefined\n    try {\n      identifier = await this.store.getDID({ alias })\n    } catch {\n      const providerName = provider || this.defaultProvider\n      return this.didManagerCreate({ provider: providerName, alias, kms, options }, context)\n    }\n    if (identifier && provider && identifier.provider !== provider) {\n      if (this.getProvider(identifier.provider) !== this.getProvider(provider)) {\n        throw Error(\n          `illegal_argument: Identifier with alias: ${alias}, already exists ${identifier.did}, but was created with a different provider: ${identifier.provider}!==${provider}`,\n        )\n      }\n    }\n    return identifier\n  }\n\n  /** {@inheritDoc @veramo/core-types#IDIDManager.didManagerUpdate} */\n  async didManagerUpdate(\n    { did, document, options }: IDIDManagerUpdateArgs,\n    context: IAgentContext<IKeyManager>,\n  ): Promise<IIdentifier> {\n    /**\n     * 1. Check if the identifier is already in the store\n     * 2. If not, throw\n     * 3. Check if provider implements updateIdentifier (handles ledger resolution logic)\n     * 4. If not, throw\n     * 5. If yes, execute updateIdentifier\n     * 6. Update the identifier in the store\n     * 7. Return the identifier\n     */\n    const identifier = await this.store.getDID({ did })\n    const identifierProvider = this.getProvider(identifier.provider)\n    if (typeof identifierProvider?.updateIdentifier !== 'function') {\n      throw new Error(\n        `not_supported: ${identifier?.provider} provider does not implement full document updates`,\n      )\n    }\n    // the localOnly Flag must be interpreted by the identifierProvider\n    const updatedIdentifier = await identifierProvider.updateIdentifier({ did, document, options }, context)\n    await this.store.importDID(updatedIdentifier)\n    return updatedIdentifier\n  }\n\n  /** {@inheritDoc @veramo/core-types#IDIDManager.didManagerSetAlias} */\n  async didManagerSetAlias(\n    { did, alias }: IDIDManagerSetAliasArgs,\n    context: IAgentContext<IKeyManager>,\n  ): Promise<boolean> {\n    const identifier = await this.store.getDID({ did })\n    identifier.alias = alias\n    return await this.store.importDID(identifier)\n  }\n\n  /** {@inheritDoc @veramo/core-types#IDIDManager.didManagerImport} */\n  async didManagerImport(\n    identifier: MinimalImportableIdentifier,\n    context: IAgentContext<IKeyManager>,\n  ): Promise<IIdentifier> {\n    const keys: IKey[] = []\n    for (const key of identifier.keys) {\n      const importedKey = await context.agent.keyManagerImport(key)\n      keys.push(importedKey)\n    }\n    const services: IService[] = [...(identifier?.services || [])]\n    const importedDID = {\n      ...identifier,\n      keys,\n      services,\n    }\n    await this.store.importDID(importedDID)\n    return importedDID\n  }\n\n  /** {@inheritDoc @veramo/core-types#IDIDManager.didManagerDelete} */\n  async didManagerDelete(\n    { did }: IDIDManagerDeleteArgs,\n    context: IAgentContext<IKeyManager>,\n  ): Promise<boolean> {\n    const identifier = await this.store.getDID({ did })\n    const provider = this.getProvider(identifier.provider)\n    await provider.deleteIdentifier(identifier, context)\n    return this.store.deleteDID({ did })\n  }\n\n  /** {@inheritDoc @veramo/core-types#IDIDManager.didManagerAddKey} */\n  async didManagerAddKey(\n    { did, key, options }: IDIDManagerAddKeyArgs,\n    context: IAgentContext<IKeyManager>,\n  ): Promise<any> {\n    const identifier = await this.store.getDID({ did })\n    const provider = this.getProvider(identifier.provider)\n    let result = true\n    if (!options?.localOnly) {\n      result = await provider.addKey({ identifier, key, options }, context)\n    }\n    identifier.keys.push(key)\n    await this.store.importDID(identifier)\n    return result\n  }\n\n  /** {@inheritDoc @veramo/core-types#IDIDManager.didManagerRemoveKey} */\n  async didManagerRemoveKey(\n    { did, kid, options }: IDIDManagerRemoveKeyArgs,\n    context: IAgentContext<IKeyManager>,\n  ): Promise<any> {\n    const identifier = await this.store.getDID({ did })\n    const provider = this.getProvider(identifier.provider)\n    let result = true\n    if (!options?.localOnly) {\n      result = await provider.removeKey({ identifier, kid, options }, context)\n    }\n    identifier.keys = identifier.keys.filter((k) => k.kid !== kid)\n    await this.store.importDID(identifier)\n    return result\n  }\n\n  /** {@inheritDoc @veramo/core-types#IDIDManager.didManagerAddService} */\n  async didManagerAddService(\n    { did, service, options }: IDIDManagerAddServiceArgs,\n    context: IAgentContext<IKeyManager>,\n  ): Promise<any> {\n    const identifier = await this.store.getDID({ did })\n    const provider = this.getProvider(identifier.provider)\n    let result = true\n    if (!options?.localOnly) {\n      result = await provider.addService({ identifier, service, options }, context)\n    }\n    identifier.services.push(service)\n    await this.store.importDID(identifier)\n    return result\n  }\n\n  /** {@inheritDoc @veramo/core-types#IDIDManager.didManagerRemoveService} */\n  async didManagerRemoveService(\n    { did, id, options }: IDIDManagerRemoveServiceArgs,\n    context: IAgentContext<IKeyManager>,\n  ): Promise<any> {\n    const identifier = await this.store.getDID({ did })\n    const provider = this.getProvider(identifier.provider)\n    let result = true\n    if (!options?.localOnly) {\n      result = await provider.removeService({ identifier, id, options }, context)\n    }\n    identifier.services = identifier.services.filter((s) => s.id !== id)\n    await this.store.importDID(identifier)\n    return result\n  }\n}\n"
  },
  {
    "path": "packages/did-manager/src/index.ts",
    "content": "/**\n * Provides a {@link @veramo/did-manager#DIDManager | plugin} for the\n * {@link @veramo/core#Agent} that implements {@link @veramo/core-types#IDIDManager} interface.\n *\n * @packageDocumentation\n */\nexport { DIDManager } from './id-manager.js'\nexport { AbstractIdentifierProvider } from './abstract-identifier-provider.js'\nexport { AbstractDIDStore } from './abstract-identifier-store.js'\nexport { MemoryDIDStore } from './memory-did-store.js'\nexport { AliasDiscoveryProvider } from './did-discovery-provider.js'\n"
  },
  {
    "path": "packages/did-manager/src/memory-did-store.ts",
    "content": "import { IIdentifier } from '@veramo/core-types'\nimport { AbstractDIDStore } from './abstract-identifier-store.js'\n\n/**\n * An implementation of {@link AbstractDIDStore} that stores everything in memory.\n *\n * @beta This API may change without a BREAKING CHANGE notice.\n */\nexport class MemoryDIDStore extends AbstractDIDStore {\n  private identifiers: Record<string, IIdentifier> = {}\n\n  async getDID({\n    did,\n    alias,\n    provider,\n  }: {\n    did: string\n    alias: string\n    provider: string\n  }): Promise<IIdentifier> {\n    if (did && !alias) {\n      if (!this.identifiers[did]) throw Error(`not_found: IIdentifier not found with did=${did}`)\n      return this.identifiers[did]\n    } else if (!did && alias) {\n      for (const key of Object.keys(this.identifiers)) {\n        if (this.identifiers[key].alias === alias) {\n          return this.identifiers[key]\n        }\n      }\n    } else {\n      throw Error('invalid_argument: Get requires did or (alias and provider)')\n    }\n    throw Error(`not_found: IIdentifier not found with alias=${alias} provider=${provider}`)\n  }\n\n  async deleteDID({ did }: { did: string }) {\n    delete this.identifiers[did]\n    return true\n  }\n\n  async importDID(args: IIdentifier) {\n    const identifier = { ...args }\n    for (const key of identifier.keys) {\n      if (key.privateKeyHex) {\n        delete key.privateKeyHex\n      }\n    }\n    this.identifiers[args.did] = identifier\n    return true\n  }\n\n  async listDIDs(args: { alias?: string; provider?: string }): Promise<IIdentifier[]> {\n    let result: IIdentifier[] = []\n\n    for (const key of Object.keys(this.identifiers)) {\n      result.push(this.identifiers[key])\n    }\n\n    if (args.alias && !args.provider) {\n      result = result.filter((i) => i.alias === args.alias)\n    } else if (args.provider && !args.alias) {\n      result = result.filter((i) => i.provider === args.provider)\n    } else if (args.provider && args.alias) {\n      result = result.filter((i) => i.provider === args.provider && i.alias === args.alias)\n    }\n\n    return result\n  }\n}\n"
  },
  {
    "path": "packages/did-manager/tsconfig.json",
    "content": "{\n  \"extends\": \"../tsconfig.settings.json\",\n  \"compilerOptions\": {\n    \"rootDir\": \"src\",\n    \"outDir\": \"build\",\n    \"declarationDir\": \"build\"\n  },\n  \"references\": [\n    { \"path\": \"../core-types\" },\n    { \"path\": \"../did-discovery\" }\n  ]\n}\n"
  },
  {
    "path": "packages/did-provider-ethr/CHANGELOG.md",
    "content": "# Change Log\n\nAll notable changes to this project will be documented in this file.\nSee [Conventional Commits](https://conventionalcommits.org) for commit guidelines.\n\n# [7.0.0](https://github.com/decentralized-identity/veramo/compare/v6.0.2...v7.0.0) (2026-02-11)\n\n\n### Bug Fixes\n\n* **deps:** bump ethr-did-resolver to v11 ([#1422](https://github.com/decentralized-identity/veramo/issues/1422)) ([2f0b06d](https://github.com/decentralized-identity/veramo/commit/2f0b06ddcce87dfeea1d5ab843eb33276dac071d))\n* **deps:** update devdeps and bump typeorm to 0.3.20 ([#1272](https://github.com/decentralized-identity/veramo/issues/1272)) ([7d17f37](https://github.com/decentralized-identity/veramo/commit/7d17f37ea7cc4e73a8cdae028681ae1be5c4d11c))\n\n\n### Features\n\n* **did-provider-ethr:** add signOnly flag and logic for add/remove key/service ([#1389](https://github.com/decentralized-identity/veramo/issues/1389)) ([2110590](https://github.com/decentralized-identity/veramo/commit/211059019f8bb3b282c4ca5f59117970cfdd9b0a))\n* improve key creation/import options when creating identifiers ([#1423](https://github.com/decentralized-identity/veramo/issues/1423)) ([12aa854](https://github.com/decentralized-identity/veramo/commit/12aa854baa384805f4cae6360720f2e9a5a484aa))\n\n\n\n\n\n## [6.0.2](https://github.com/decentralized-identity/veramo/compare/v6.0.1...v6.0.2) (2026-01-16)\n\n**Note:** Version bump only for package @veramo/did-provider-ethr\n\n\n\n\n\n## [6.0.1](https://github.com/decentralized-identity/veramo/compare/v6.0.0...v6.0.1) (2026-01-16)\n\n**Note:** Version bump only for package @veramo/did-provider-ethr\n\n\n\n\n\n# [6.0.0](https://github.com/decentralized-identity/veramo/compare/v5.6.0...v6.0.0) (2024-04-02)\n\n**Note:** Version bump only for package @veramo/did-provider-ethr\n\n\n\n\n\n# [5.6.0](https://github.com/decentralized-identity/veramo/compare/v5.5.3...v5.6.0) (2024-01-16)\n\n\n### Features\n\n* **remote-client:** allow dynamic headers param for AgentRestClient constructor ([#1314](https://github.com/decentralized-identity/veramo/issues/1314)) ([1b8a0a2](https://github.com/decentralized-identity/veramo/commit/1b8a0a2718dd63492ad3a312a6ebe5f6e7849935)), closes [#1313](https://github.com/decentralized-identity/veramo/issues/1313)\n\n\n\n\n\n## [5.5.3](https://github.com/decentralized-identity/veramo/compare/v5.5.2...v5.5.3) (2023-10-09)\n\n\n### Bug Fixes\n\n* use DIF URLs in packages ([#1271](https://github.com/decentralized-identity/veramo/issues/1271)) ([3dfc601](https://github.com/decentralized-identity/veramo/commit/3dfc6014cdee7902c59d8db76b4c8507b870f227))\n\n\n\n\n\n# [5.5.0](https://github.com/uport-project/veramo/compare/v5.4.1...v5.5.0) (2023-09-19)\n\n\n### Bug Fixes\n\n* **did-provider-key:** use compressed keys for creating Secp256k1 did:key ([#1217](https://github.com/uport-project/veramo/issues/1217)) ([ba8f6f5](https://github.com/uport-project/veramo/commit/ba8f6f5b9b701e57af86491504ecd209ca0c1c1d)), closes [#1213](https://github.com/uport-project/veramo/issues/1213)\n\n\n\n\n\n## [5.4.1](https://github.com/uport-project/veramo/compare/v5.4.0...v5.4.1) (2023-08-04)\n\n\n### Bug Fixes\n\n* **ci:** benign change meant to tag all packages for another patch release ([#1211](https://github.com/uport-project/veramo/issues/1211)) ([41b5c90](https://github.com/uport-project/veramo/commit/41b5c90277171b7b38c5cf49ca01db5cf75b6300))\n\n\n\n\n\n# [5.4.0](https://github.com/uport-project/veramo/compare/v5.3.0...v5.4.0) (2023-08-01)\n\n\n### Features\n\n* **did-comm:** add support for the AES based content and key encryption algorithms ([#1180](https://github.com/uport-project/veramo/issues/1180)) ([5294a81](https://github.com/uport-project/veramo/commit/5294a812ee578c0712b54f216416c3ef78c848da))\n\n\n\n\n\n# [5.3.0](https://github.com/uport-project/veramo/compare/v5.2.0...v5.3.0) (2023-07-27)\n\n**Note:** Version bump only for package @veramo/did-provider-ethr\n\n\n\n\n\n## [5.1.2](https://github.com/uport-project/veramo/compare/v5.1.1...v5.1.2) (2023-02-25)\n\n**Note:** Version bump only for package @veramo/did-provider-ethr\n\n\n\n\n\n# [5.1.0](https://github.com/uport-project/veramo/compare/v5.0.0...v5.1.0) (2023-02-24)\n\n\n### Bug Fixes\n\n* **did-provider-ethr:** export KMSEthereumSigner for convenience ([#1124](https://github.com/uport-project/veramo/issues/1124)) ([cee8d2e](https://github.com/uport-project/veramo/commit/cee8d2ea70950f1e1c07ce371bd6eef0de99a122))\n\n\n\n\n\n# [5.0.0](https://github.com/uport-project/veramo/compare/v4.3.0...v5.0.0) (2023-02-09)\n\n\n### Build System\n\n* convert veramo modules to ESM instead of CommonJS ([#1103](https://github.com/uport-project/veramo/issues/1103)) ([b5cea3c](https://github.com/uport-project/veramo/commit/b5cea3c0d80d900a47bd1d9eea68f84b70a35e7b)), closes [#1099](https://github.com/uport-project/veramo/issues/1099)\n\n\n### Features\n\n* isolate `core-types` package from `core` ([#1116](https://github.com/uport-project/veramo/issues/1116)) ([ba7a303](https://github.com/uport-project/veramo/commit/ba7a303de91cf4cc568a3af1ddf8ca98ed022e9f))\n\n\n### BREAKING CHANGES\n\n* this is a breaking change as modules will have to be imported differently: \n* https://www.typescriptlang.org/docs/handbook/esm-node.html\n* https://nodejs.org/api/esm.html\n* https://caniuse.com/?search=modules\n\ntest(did-provider-ion): skip a couple of tests that fail with unreasonable errors\nchore: use ubuntu-latest on CI\nfix: temporarily remove puppeteer tests\nfix: use craco for test-react-app to enable babel config\ntest: fix unit and integration tests (browser tests still broken)\nfix: fix some build issues that prevented tests from working\nfix: missing deps flagged by pnpm\n\n\n\n\n\n# [4.3.0](https://github.com/uport-project/veramo/compare/v4.2.0...v4.3.0) (2023-01-27)\n\n**Note:** Version bump only for package @veramo/did-provider-ethr\n\n\n\n\n\n# [4.2.0](https://github.com/uport-project/veramo/compare/v4.1.2...v4.2.0) (2022-12-05)\n\n\n### Bug Fixes\n\n* **deps:** bump dependencies ([701b8ed](https://github.com/uport-project/veramo/commit/701b8edf981ea11c7ddb6a81d2817dbbdbb022f3))\n\n\n\n\n\n## [4.1.2](https://github.com/uport-project/veramo/compare/v4.1.1...v4.1.2) (2022-11-03)\n\n\n### Bug Fixes\n\n* **deps:** bump ethr-did to 2.3.6 and cosmetic changes in CLI config ([#1054](https://github.com/uport-project/veramo/issues/1054)) ([eb03b63](https://github.com/uport-project/veramo/commit/eb03b637ef5aecf57b0ee130d08689094b1956df))\n\n\n\n\n\n## [4.1.1](https://github.com/uport-project/veramo/compare/v4.1.0...v4.1.1) (2022-11-01)\n\n**Note:** Version bump only for package @veramo/did-provider-ethr\n\n\n\n\n\n# [4.1.0](https://github.com/uport-project/veramo/compare/v4.0.2...v4.1.0) (2022-10-31)\n\n\n### Bug Fixes\n\n* remove deprecated testnets ([#1028](https://github.com/uport-project/veramo/issues/1028)) ([2823738](https://github.com/uport-project/veramo/commit/28237383d0cc2eb20bcf8e10562221ea2ab32f94)), closes [#1025](https://github.com/uport-project/veramo/issues/1025)\n\n\n### Features\n\n* add support for did:ethr signed/meta transactions ([#1031](https://github.com/uport-project/veramo/issues/1031)) ([88f1da9](https://github.com/uport-project/veramo/commit/88f1da9a39f6d249fbed301e2d77ea3cee167e33))\n* **did-provider-ethr:** implement TypedDataSigner in KmsEthereumSigner ([#1026](https://github.com/uport-project/veramo/issues/1026)) ([4371cb9](https://github.com/uport-project/veramo/commit/4371cb920ddbafa8dafb73b6bcce1e0408ff3d03))\n\n\n\n\n\n# [4.0.0](https://github.com/uport-project/veramo/compare/v3.1.5...v4.0.0) (2022-09-22)\n\n\n### Bug Fixes\n\n* **deps:** update all non-major dependencies ([b537187](https://github.com/uport-project/veramo/commit/b537187ba04ba41cd45c18dfb58c92725b65b084))\n* **deps:** use did-jwt v6 and ethr-did-resolver v6 ([#925](https://github.com/uport-project/veramo/issues/925)) ([0c77d03](https://github.com/uport-project/veramo/commit/0c77d03ec5ec9e2091de3f74f67ab86a22cde197)), closes [#923](https://github.com/uport-project/veramo/issues/923) [#848](https://github.com/uport-project/veramo/issues/848)\n* **did-resolver:** use interface `Resolvable` instead of the `Resolver` class ([9c2e59f](https://github.com/uport-project/veramo/commit/9c2e59f3f23f808511c6c0e8e440b4d53ba5cb00))\n\n\n### Features\n\n* add support for serviceEndpoint property as defined in latest DID Spec ([#988](https://github.com/uport-project/veramo/issues/988)) ([9bed70b](https://github.com/uport-project/veramo/commit/9bed70ba658aed34a97944e0dee27bca6c81d700))\n* **credential-w3c:** align verification API between formats ([#996](https://github.com/uport-project/veramo/issues/996)) ([b987fc0](https://github.com/uport-project/veramo/commit/b987fc0903a31d3bbffb43fef872be4d6c62c2ad)), closes [#935](https://github.com/uport-project/veramo/issues/935) [#954](https://github.com/uport-project/veramo/issues/954) [#375](https://github.com/uport-project/veramo/issues/375) [#989](https://github.com/uport-project/veramo/issues/989)\n* **did-manager:** add`didManagerUpdate` method for full DID document updates ([#974](https://github.com/uport-project/veramo/issues/974)) ([5682b25](https://github.com/uport-project/veramo/commit/5682b2566b7c4f8f9bfda10e8d06a8d2624c2a1b)), closes [#971](https://github.com/uport-project/veramo/issues/971) [#960](https://github.com/uport-project/veramo/issues/960) [#948](https://github.com/uport-project/veramo/issues/948)\n* **did-provider-ethr:** use multiple networks per EthrDIDProvider ([#969](https://github.com/uport-project/veramo/issues/969)) ([0a88058](https://github.com/uport-project/veramo/commit/0a88058a5efddfe09f9f35510cc1bbc21149bf18)), closes [#968](https://github.com/uport-project/veramo/issues/968) [#893](https://github.com/uport-project/veramo/issues/893)\n* **did-provider-ethr:** Using meta account ([994e5af](https://github.com/uport-project/veramo/commit/994e5afb2789840bfb550cb00f5e9e3152669b94))\n* **kms-web3:** add a KMS implementation backed by a web3 provider ([#924](https://github.com/uport-project/veramo/issues/924)) ([14f71af](https://github.com/uport-project/veramo/commit/14f71afbb72dca8274790d3b20b518ddfe4f2585)), closes [#688](https://github.com/uport-project/veramo/issues/688)\n\n\n### BREAKING CHANGES\n\n* the `did-resolver` and connected libraries change the data-type for `ServiceEndpoint` to `Service` and the previous semantic has changed. Services can have multiple endpoints, not just a single string.\n\n\n\n\n\n## [3.1.3](https://github.com/uport-project/veramo/compare/v3.1.2...v3.1.3) (2022-06-01)\n\n**Note:** Version bump only for package @veramo/did-provider-ethr\n\n\n\n\n\n# [3.1.0](https://github.com/uport-project/veramo/compare/v3.0.0...v3.1.0) (2021-11-12)\n\n\n### Bug Fixes\n\n* **data-store:** add support for entityPrefix ([#725](https://github.com/uport-project/veramo/issues/725)) ([801bb95](https://github.com/uport-project/veramo/commit/801bb95ddd22abaa61c938b025834132d4e8d3be)), closes [#724](https://github.com/uport-project/veramo/issues/724)\n\n\n### Features\n\n* **did-comm:** didcomm messaging using did:ethr ([#744](https://github.com/uport-project/veramo/issues/744)) ([1be5e04](https://github.com/uport-project/veramo/commit/1be5e04e09112c0823d776fe2d55117d71a7b448)), closes [#743](https://github.com/uport-project/veramo/issues/743)\n\n\n\n\n\n# [3.0.0](https://github.com/uport-project/veramo/compare/v2.1.3...v3.0.0) (2021-09-20)\n\n\n### Bug Fixes\n\n* **did-ethr-provider:** allow initialization with chainId number ([#678](https://github.com/uport-project/veramo/issues/678)) ([38cd0ae](https://github.com/uport-project/veramo/commit/38cd0aeb438ada57eb95464cabe072d02cbebb2b)), closes [#677](https://github.com/uport-project/veramo/issues/677)\n\n\n\n\n\n# [2.1.0](https://github.com/uport-project/veramo/compare/v2.0.1...v2.1.0) (2021-08-11)\n\n**Note:** Version bump only for package @veramo/did-provider-ethr\n\n\n\n\n\n# [2.0.0](https://github.com/uport-project/veramo/compare/v1.2.2...v2.0.0) (2021-07-14)\n\n\n### Bug Fixes\n\n* **deps:** bump did-jwt to 5.4.0 ([#528](https://github.com/uport-project/veramo/issues/528)) ([65f22cf](https://github.com/uport-project/veramo/commit/65f22cf6dcca48b5bb35331894536a2a567a1189))\n\n\n### Features\n\n* **key-manager:** add generic signing capabilities ([#529](https://github.com/uport-project/veramo/issues/529)) ([5f10a1b](https://github.com/uport-project/veramo/commit/5f10a1bcea214cb593de12fa6ec3a91b3cb712bb)), closes [#522](https://github.com/uport-project/veramo/issues/522)\n\n\n\n\n\n# [1.2.0](https://github.com/uport-project/veramo/compare/v1.1.2...v1.2.0) (2021-04-27)\n\n**Note:** Version bump only for package @veramo/did-provider-ethr\n\n\n\n\n\n# [1.1.0](https://github.com/uport-project/veramo/compare/v1.0.1...v1.1.0) (2021-01-26)\n\n**Note:** Version bump only for package @veramo/did-provider-ethr\n\n\n\n\n\n## 1.0.1 (2020-12-18)\n\n**Note:** Version bump only for package @veramo/did-provider-ethr\n"
  },
  {
    "path": "packages/did-provider-ethr/LICENSE",
    "content": "                                 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 2019 Consensys AG\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"
  },
  {
    "path": "packages/did-provider-ethr/README.md",
    "content": "# Veramo did:ethr provider\n\nThis package contains an implementation of `AbstractIdentifierProvider` for the `did:ethr` method.\nThis enables creation and control of `did:ethr` entities.\n"
  },
  {
    "path": "packages/did-provider-ethr/api-extractor.json",
    "content": "{\n  \"$schema\": \"https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json\",\n  \"apiReport\": {\n    \"enabled\": true,\n    \"reportFolder\": \"./api\",\n    \"reportTempFolder\": \"./api\"\n  },\n\n  \"docModel\": {\n    \"enabled\": true,\n    \"apiJsonFilePath\": \"./api/<unscopedPackageName>.api.json\"\n  },\n\n  \"dtsRollup\": {\n    \"enabled\": false\n  },\n  \"mainEntryPointFilePath\": \"<projectFolder>/build/index.d.ts\"\n}\n"
  },
  {
    "path": "packages/did-provider-ethr/package.json",
    "content": "{\n  \"name\": \"@veramo/did-provider-ethr\",\n  \"description\": \"Veramo ethr-did based identity controller plugin.\",\n  \"version\": \"7.0.0\",\n  \"main\": \"build/index.js\",\n  \"exports\": \"./build/index.js\",\n  \"types\": \"build/index.d.ts\",\n  \"scripts\": {\n    \"build\": \"tsc\",\n    \"extract-api\": \"node ../cli/bin/veramo.js dev extract-api\"\n  },\n  \"dependencies\": {\n    \"@veramo/core-types\": \"workspace:^\",\n    \"@veramo/did-manager\": \"workspace:^\",\n    \"@veramo/utils\": \"workspace:^\",\n    \"debug\": \"^4.3.3\",\n    \"ethers\": \"^6.13.4\",\n    \"ethr-did\": \"^3.0.21\"\n  },\n  \"devDependencies\": {\n    \"@types/debug\": \"4.1.8\",\n    \"typescript\": \"5.7.3\"\n  },\n  \"files\": [\n    \"build/**/*\",\n    \"src/**/*\",\n    \"README.md\",\n    \"LICENSE\"\n  ],\n  \"publishConfig\": {\n    \"access\": \"public\"\n  },\n  \"repository\": {\n    \"type\": \"git\",\n    \"url\": \"https://github.com/decentralized-identity/veramo.git\",\n    \"directory\": \"packages/did-provider-ethr\"\n  },\n  \"author\": \"Consensys Mesh R&D <hello@veramo.io>\",\n  \"contributors\": [\n    \"Simonas Karuzas <simonas.karuzas@mesh.xyz>\",\n    \"Mircea Nistor <mircea.nistor@mesh.xyz>\"\n  ],\n  \"keywords\": [\n    \"Veramo\",\n    \"DID\",\n    \"Verifiable Credential\",\n    \"veramo-plugin\",\n    \"did:ethr\",\n    \"EIP1056\",\n    \"ethr-did\",\n    \"Ethereum\"\n  ],\n  \"license\": \"Apache-2.0\",\n  \"type\": \"module\",\n  \"moduleDirectories\": [\n    \"node_modules\",\n    \"src\"\n  ]\n}\n"
  },
  {
    "path": "packages/did-provider-ethr/src/__tests__/ethr-did-provider.test.ts",
    "content": "import { IDIDManager, IKeyManager, MinimalImportableKey, TAgent } from '@veramo/core-types'\nimport { DIDManager, MemoryDIDStore } from '../../../did-manager/src'\nimport { EthrDIDProvider } from '../ethr-did-provider'\nimport { createAgent } from '../../../core/src'\nimport { KeyManager, MemoryKeyStore, MemoryPrivateKeyStore } from '../../../key-manager/src'\nimport { KeyManagementSystem } from '../../../kms-local/src'\nimport { createGanacheProvider } from '../../../test-react-app/src/test-utils/ganache-provider'\n\nconst PROVIDER = 'did:ethr:ganache'\nconst MOCK_DID = 'did:ethr:ganache:0x76d331386cec35862a73aabdbfa5ef97cdac58cf'\nconst KMS = 'local'\nconst CONTROLLER_KEY = Object.freeze({\n  type: 'Secp256k1',\n  kid: 'controller-key',\n  publicKeyHex:\n    '3fdecd32358c5c3343f1096217baaf4ffffc68d64f5d82f3fb924e60191f6f3c0a46161f0f425d2c48ced2ec9a95f6af1993cdf0525250a4702407bce37f6269',\n  privateKeyHex: 'f090b28a3bd279049710908e913d1644df061a6316fe3e17792a18e5267c4bd5',\n  meta: {\n    algorithms: [\n      'ES256K',\n      'ES256K-R',\n      'eth_signTransaction',\n      'eth_signTypedData',\n      'eth_signMessage',\n      'eth_rawSign',\n    ],\n  },\n  kms: KMS,\n}) satisfies MinimalImportableKey\n\ndescribe('EthrDIDProvider', () => {\n  let agent: TAgent<IKeyManager | IDIDManager>\n\n  beforeAll(async () => {\n    const { provider, registry } = await createGanacheProvider()\n    const ethrDidProvider = new EthrDIDProvider({\n      defaultKms: KMS,\n      network: 'ganache',\n      registry,\n      web3Provider: provider,\n    })\n\n    agent = createAgent<IKeyManager, IDIDManager>({\n      plugins: [\n        new KeyManager({\n          store: new MemoryKeyStore(),\n          kms: {\n            [KMS]: new KeyManagementSystem(new MemoryPrivateKeyStore()),\n          },\n        }),\n        new DIDManager({\n          providers: { [PROVIDER]: ethrDidProvider },\n          defaultProvider: PROVIDER,\n          store: new MemoryDIDStore(),\n        }),\n      ],\n    })\n\n    await agent.keyManagerImport(CONTROLLER_KEY)\n    await agent.didManagerImport({\n      did: MOCK_DID,\n      provider: PROVIDER,\n      controllerKeyId: CONTROLLER_KEY.kid,\n      keys: [CONTROLLER_KEY],\n      services: [],\n    })\n  })\n\n  describe('adding keys', () => {\n    it('supports implicit creation of a Secp256k1 key', async () => {\n      const newDid = await agent.didManagerCreate({\n        kms: KMS,\n        provider: PROVIDER,\n      })\n\n      expect(newDid.controllerKeyId).toBeDefined()\n    })\n\n    it('supports creation with a key reference', async () => {\n      const newKey = await agent.keyManagerCreate({\n        kms: KMS,\n        type: 'Secp256k1',\n      })\n\n      const newDid = await agent.didManagerCreate({\n        kms: KMS,\n        provider: PROVIDER,\n        options: {\n          keyRef: newKey.kid,\n        },\n      })\n\n      expect(newDid.controllerKeyId).toBe(newKey.kid)\n    })\n\n    it('returns the signed addKey transaction parameters for an Ed25519 key type', async () => {\n      expect.assertions(11)\n      const ed25519Key: MinimalImportableKey = {\n        kms: KMS,\n        kid: 'test-ed25519-key',\n        type: 'Ed25519',\n        privateKeyHex: 'f88e9aa3dd651d1abdfb6770159d81d2564728eff8b683b0a3041cf277b3ded2',\n        publicKeyHex: 'cfdf62bdafc9fa7add58270ff29d499d649a85d0e906a1e1a92c877188d6b163',\n        meta: { algorithms: ['EdDSA', 'Ed25519'] },\n      }\n      const importedEd25519Key = await agent.keyManagerImport(ed25519Key)\n      const params = {\n        did: MOCK_DID,\n        key: importedEd25519Key,\n        options: {\n          signOnly: true,\n        },\n      }\n      const [attrName, attrValue, ttl, signature, options] = await agent.didManagerAddKey(params)\n      expect(attrName).toEqual('did/pub/Ed25519/veriKey/hex')\n      expect(attrValue).toContain(ed25519Key.publicKeyHex)\n      expect(attrValue.slice(0, 2)).toBe('0x')\n      expect(ttl).toBe(86_400)\n      expect(signature).toBeDefined()\n      expect(typeof signature.sigV).toBe('number')\n      expect(typeof signature.sigR).toBe('string')\n      expect(signature.sigR).toContain('0x')\n      expect(typeof signature.sigS).toBe('string')\n      expect(signature.sigS).toContain('0x')\n      expect(options).toEqual({ signOnly: true, gasLimit: 100_000 })\n    })\n\n    it('returns the signed removeKey transaction parameters for an Ed25519 key type', async () => {\n      expect.assertions(10)\n      const ed25519Key: MinimalImportableKey = {\n        kms: KMS,\n        kid: 'test-ed25519-key-remove',\n        type: 'Ed25519',\n        privateKeyHex: 'f88e9aa3dd651d1abdfb6770159d81d2564728eff8b683b0a3041cf277b3ded2',\n        publicKeyHex: 'cfdf62bdafc9fa7add58270ff29d499d649a85d0e906a1e1a92c877188d6b163',\n        meta: { algorithms: ['EdDSA', 'Ed25519'] },\n      }\n      const importedEd25519Key = await agent.keyManagerImport(ed25519Key)\n      await agent.didManagerImport({\n        did: MOCK_DID,\n        provider: PROVIDER,\n        controllerKeyId: CONTROLLER_KEY.kid,\n        keys: [CONTROLLER_KEY, ed25519Key],\n      })\n      const params = {\n        did: MOCK_DID,\n        kid: importedEd25519Key.kid,\n        options: {\n          signOnly: true,\n        },\n      }\n      const [attrName, attrValue, signature, options] = await agent.didManagerRemoveKey(params)\n      expect(attrName).toEqual('did/pub/Ed25519/veriKey/hex')\n      expect(attrValue).toContain(ed25519Key.publicKeyHex)\n      expect(attrValue.slice(0, 2)).toBe('0x')\n      expect(signature).toBeDefined()\n      expect(typeof signature.sigV).toBe('number')\n      expect(typeof signature.sigR).toBe('string')\n      expect(signature.sigR).toContain('0x')\n      expect(typeof signature.sigS).toBe('string')\n      expect(signature.sigS).toContain('0x')\n      expect(options).toEqual({ signOnly: true, gasLimit: 100_000 })\n    })\n  })\n\n  describe('adding services', () => {\n    it('returns the signed add service endpoint transaction parameters', async () => {\n      expect.assertions(10)\n      const type = 'DIDCommMessaging'\n      const params = {\n        did: MOCK_DID,\n        service: {\n          id: `${MOCK_DID}#${type}`,\n          type,\n          serviceEndpoint: 'this-is-a-new-service-endpoint',\n        },\n        options: { signOnly: true },\n      }\n\n      const [attrName, attrValue, ttl, signature, options] = await agent.didManagerAddService(params)\n      expect(attrName).toEqual('did/svc/DIDCommMessaging')\n      expect(attrValue).toBe('this-is-a-new-service-endpoint')\n      expect(ttl).toBe(86_400)\n      expect(signature).toBeDefined()\n      expect(typeof signature.sigV).toBe('number')\n      expect(typeof signature.sigR).toBe('string')\n      expect(signature.sigR).toContain('0x')\n      expect(typeof signature.sigS).toBe('string')\n      expect(signature.sigS).toContain('0x')\n      expect(options).toEqual({ signOnly: true, gasLimit: 100_000 })\n    })\n\n    it('returns the signed remove service endpoint transaction parameters', async () => {\n      expect.assertions(9)\n      const type = 'DIDCommMessaging'\n      const params = {\n        did: MOCK_DID,\n        id: `${MOCK_DID}#${type}`,\n        options: { signOnly: true },\n      }\n      const [attrName, attrValue, signature, options] = await agent.didManagerRemoveService(params)\n      expect(attrName).toEqual('did/svc/DIDCommMessaging')\n      expect(attrValue).toBe('this-is-a-new-service-endpoint')\n      expect(signature).toBeDefined()\n      expect(typeof signature.sigV).toBe('number')\n      expect(typeof signature.sigR).toBe('string')\n      expect(signature.sigR).toContain('0x')\n      expect(typeof signature.sigS).toBe('string')\n      expect(signature.sigS).toContain('0x')\n      expect(options).toEqual({ signOnly: true, gasLimit: 100_000 })\n    })\n  })\n})\n"
  },
  {
    "path": "packages/did-provider-ethr/src/__tests__/identity-provider.test.ts",
    "content": "// import SignerProvider from 'ethjs-provider-signer'\n// import { DIDResolverPlugin } from '@veramo/did-resolver'\n// import { IdentifierProvider } from '../identifier-provider'\n// import { Identifier } from '../identifier'\n// import { createJWT, decodeJWT, verifyJWT } from 'did-jwt'\n// const fs = require('fs')\n\ndescribe('dummy', () => {\n  const a = 100\n  it('should run a dummy test', () => {\n    expect(a).toEqual(100)\n  })\n})\n"
  },
  {
    "path": "packages/did-provider-ethr/src/ethr-did-provider.ts",
    "content": "import { IAgentContext, IIdentifier, IKey, IKeyManager, IService } from '@veramo/core-types'\nimport { AbstractIdentifierProvider } from '@veramo/did-manager'\nimport { importOrCreateKey, CreateIdentifierBaseOptions } from '@veramo/utils'\nimport { Provider, SigningKey, computeAddress, JsonRpcProvider, TransactionRequest, Signature } from 'ethers'\nimport { KmsEthereumSigner } from './kms-eth-signer.js'\nimport Debug from 'debug'\nimport { EthrDID } from 'ethr-did'\n\nconst debug = Debug('veramo:did-provider-ethr')\n\nexport type IRequiredContext = IAgentContext<IKeyManager>\n\n/**\n * For most operations at most 60-70k gas is needed, larger amount for safety\n */\nexport const DEFAULT_GAS_LIMIT = 100000\n\n/**\n * Helper method that can computes the ethereumAddress corresponding to a Secp256k1 public key.\n * @param hexPublicKey A hex encoded public key, optionally prefixed with `0x`\n */\nexport function toEthereumAddress(hexPublicKey: string): string {\n  const publicKey = hexPublicKey.startsWith('0x') ? hexPublicKey : '0x' + hexPublicKey\n  return computeAddress(publicKey)\n}\n\n/**\n * Options for creating a did:ethr\n * @beta\n */\nexport type CreateDidEthrOptions = CreateIdentifierBaseOptions<'Secp256k1'> & {\n  /**\n   * This can be a network name or hex encoded chain ID (string) or a chainId number\n   *\n   * If this is not specified, `mainnet` is assumed.\n   */\n  network?: string | number | bigint\n\n  /**\n   * This is usually a did prefix, like `did:ethr` or `did:ethr:sepolia` and can be used to determine the desired\n   * network, if no `network` option is specified.\n   */\n  providerName?: string\n}\n\nexport interface TransactionOptions extends TransactionRequest {\n  ttl?: number\n  encoding?: string\n  metaIdentifierKeyId?: string\n  signOnly?: boolean\n}\n\n/**\n * Possible options for network configuration for `did:ethr`\n *\n * @beta\n */\nexport interface EthrNetworkConfiguration {\n  /**\n   * The name of the network, for example 'mainnet', 'sepolia', 'polygon'.\n   * If this is present, then DIDs anchored on this network will have a human-readable prefix, like\n   * `did:ethr:sepolia:0x...`. See the\n   * {@link https://github.com/uport-project/ethr-did-registry#contract-deployments | official deployments} for a table\n   * of reusable names.\n   * If this parameter is not present, `chainId` MUST be specified.\n   */\n  name?: string\n\n  /**\n   * Web3 provider. This is used to interact with the ethereum network.\n   * When a web3 wallet is used here, it can also be used to sign transactions.\n   * Either a `provider` or a `rpcUrl` must be specified. `provider` takes precedence when both are used.\n   */\n  provider?: Provider\n\n  /**\n   * Equivalent to `provider`\n   * Web3 provider. This is used to interact with the ethereum network.\n   * When a web3 wallet is used here, it can also be used to sign transactions.\n   * Either a `provider` or a `rpcUrl` must be specified. `provider` takes precedence when both are used.\n   */\n  web3Provider?: Provider\n\n  /**\n   * A JSON RPC URL for the ethereum network that is being used.\n   * Either a `provider` or a `rpcUrl` must be specified. `provider` takes precedence when both are used.\n   */\n  rpcUrl?: string\n\n  /**\n   * The EIP1056 registry address for the ethereum network being configured.\n   *\n   * Please See the\n   * {@link https://github.com/uport-project/ethr-did-registry#contract-deployments | official deployments} for a table\n   * of known deployments.\n   */\n  registry?: string\n\n  /**\n   * The chain ID for the ethereum network being configured. This can be a hex-encoded string starting with `0x`.\n   * If `name` is not specified, then the hex encoded `chainId` will be used when creating DIDs, according to the\n   * `did:ethr` spec.\n   *\n   * Example, chainId==42 and name==undefined => DIDs are prefixed with `did:ethr:0x2a:`\n   */\n  chainId?: string | number | bigint\n\n  // eslint-disable-next-line @typescript-eslint/no-explicit-any\n  [index: string]: any\n}\n\n/**\n * {@link @veramo/did-manager#DIDManager} identifier provider for `did:ethr` identifiers\n * @public\n */\nexport class EthrDIDProvider extends AbstractIdentifierProvider {\n  private defaultKms: string\n  private networks: EthrNetworkConfiguration[]\n  private gas?: number\n  private ttl?: number\n\n  constructor(options: {\n    defaultKms: string\n    networks?: EthrNetworkConfiguration[]\n    ttl?: number\n    /**\n     * @deprecated Please use the `networks` parameter instead.\n     */\n    network?: string | number | bigint\n    /**\n     * @deprecated Please use the `networks` parameter instead.\n     */\n    name?: string\n    /**\n     * @deprecated Please use the `networks` parameter instead.\n     */\n    rpcUrl?: string\n    /**\n     * @deprecated Please use the `networks` parameter instead.\n     */\n    web3Provider?: Provider\n    /**\n     * @deprecated Please use the `networks` parameter instead.\n     */\n    registry?: string\n    /**\n     * @deprecated If tweaking is necessary, please specify the maximum `gasLimit` as an `option` to every DID update\n     */\n    gas?: number\n  }) {\n    super()\n    this.defaultKms = options.defaultKms\n    if (options.networks) {\n      this.networks = options.networks\n    } else {\n      const singleNetwork: EthrNetworkConfiguration = {\n        provider: options.web3Provider,\n        rpcUrl: options.rpcUrl,\n        registry: options.registry,\n      }\n      if (typeof singleNetwork.provider === 'undefined') {\n        singleNetwork.provider = new JsonRpcProvider(singleNetwork.rpcUrl, singleNetwork.network)\n      }\n      if (typeof options.network === 'string') {\n        if (options.network.startsWith('0x')) {\n          singleNetwork.chainId = BigInt(options.network)\n        } else {\n          singleNetwork.name = options.network\n        }\n      } else if (typeof options.network === 'bigint') {\n        singleNetwork.chainId = options.network\n        singleNetwork.name = options.name\n      } else if (typeof options.network === 'number') {\n        singleNetwork.chainId = BigInt(options.network)\n        singleNetwork.name = options.name\n      }\n      this.networks = [singleNetwork]\n    }\n    this.ttl = options.ttl\n    this.gas = options.gas\n  }\n\n  async createIdentifier(\n    { kms, options }: { kms?: string; options?: CreateDidEthrOptions },\n    context: IRequiredContext,\n  ): Promise<Omit<IIdentifier, 'provider'>> {\n    let key: IKey\n\n    if (options?.keyRef) {\n      key = await context.agent.keyManagerGet({ kid: options.keyRef })\n\n      if (key.type !== 'Secp256k1') {\n        throw new Error(`not_supported: Key type must be Secp256k1`  );\n      }\n    } else {\n      key = await importOrCreateKey({\n        kms: kms || this.defaultKms,\n        options: {\n          ...(options?.key ?? {}),\n          type: 'Secp256k1',\n        }\n      }, context)\n    }\n\n    const compressedPublicKey = SigningKey.computePublicKey(`0x${key.publicKeyHex}`, true)\n\n    let networkSpecifier\n    if (options?.network) {\n      if (typeof options.network === 'number') {\n        networkSpecifier = BigInt(options?.network)\n      } else {\n        networkSpecifier = options?.network\n      }\n    } else if (options?.providerName?.match(/^did:ethr:.+$/)) {\n      networkSpecifier = options?.providerName?.substring(9)\n    } else {\n      networkSpecifier = undefined\n    }\n\n    const network = this.getNetworkFor(networkSpecifier)\n    if (!network) {\n      throw new Error(\n        `invalid_setup: Cannot create did:ethr. There is no known configuration for network=${networkSpecifier}'`,\n      )\n    }\n    if (typeof networkSpecifier === 'bigint' || typeof networkSpecifier === 'number') {\n      networkSpecifier =\n        network.name && network.name.length > 0 ? network.name : BigInt(options?.network || 1).toString(16)\n    }\n    const networkString = networkSpecifier && networkSpecifier !== 'mainnet' ? `${networkSpecifier}:` : ''\n    const identifier: Omit<IIdentifier, 'provider'> = {\n      did: 'did:ethr:' + networkString + compressedPublicKey,\n      controllerKeyId: key.kid,\n      keys: [key],\n      services: [],\n    }\n    debug('Created', identifier.did)\n    return identifier\n  }\n\n  async updateIdentifier(\n    args: { did: string; kms?: string | undefined; alias?: string | undefined; options?: any },\n    context: IAgentContext<IKeyManager>,\n  ): Promise<IIdentifier> {\n    throw new Error('EthrDIDProvider updateIdentifier not supported yet.')\n  }\n\n  async deleteIdentifier(identifier: IIdentifier, context: IRequiredContext): Promise<boolean> {\n    for (const { kid } of identifier.keys) {\n      // FIXME: keys might be used by multiple DIDs or even independent\n      await context.agent.keyManagerDelete({ kid })\n    }\n    return true\n  }\n\n  private getNetworkFor(\n    networkSpecifier: string | number | bigint | undefined,\n  ): EthrNetworkConfiguration | undefined {\n    let networkNameOrId: string | number | bigint = networkSpecifier || 'mainnet'\n    let network = this.networks.find((n) => {\n      if (n.chainId) {\n        if (typeof networkSpecifier === 'bigint') {\n          if (BigInt(n.chainId) === networkNameOrId) return n\n        } else {\n          if (n.chainId === networkNameOrId) return n\n        }\n      }\n      if (n.name === networkNameOrId || n.description === networkNameOrId) return n\n    })\n    if (!network && !networkSpecifier && this.networks.length === 1) {\n      network = this.networks[0]\n    }\n    return network\n  }\n\n  private async getEthrDidController(\n    identifier: IIdentifier,\n    context: IRequiredContext,\n    metaIdentifierKeyId?: string,\n  ): Promise<EthrDID> {\n    if (identifier.controllerKeyId == null) {\n      throw new Error('invalid_argument: identifier does not list a `controllerKeyId`')\n    }\n    const controllerKey = await context.agent.keyManagerGet({ kid: identifier.controllerKeyId })\n    if (typeof controllerKey === 'undefined') {\n      throw new Error('invalid_argument: identifier.controllerKeyId is not managed by this agent')\n    }\n\n    // find network\n    const networkStringMatcher = /^did:ethr(:.+)?:(0x[0-9a-fA-F]{40}|0x[0-9a-fA-F]{66}).*$/\n    const matches = identifier.did.match(networkStringMatcher)\n    let network = this.getNetworkFor(matches?.[1]?.substring(1))\n\n    if (!matches || !network) {\n      throw new Error(`invalid_argument: cannot find network for ${identifier.did}`)\n    }\n\n    if (!network.provider) {\n      throw new Error(`Provider was not found for network ${identifier.did}`)\n    }\n\n    if (metaIdentifierKeyId) {\n      const metaControllerKey = await context.agent.keyManagerGet({ kid: metaIdentifierKeyId })\n      if (typeof metaControllerKey === 'undefined') {\n        throw new Error('invalid_argument: identifier.controllerKeyId is not managed by this agent')\n      }\n\n      // Identity owner signs payload but metaIdentifier send the tx (meta transaction; signed methods)\n      return new EthrDID({\n        identifier: identifier.did,\n        provider: network.provider,\n        chainNameOrId: network.name || network.chainId,\n        rpcUrl: network.rpcUrl,\n        registry: network.registry,\n        txSigner: new KmsEthereumSigner(metaControllerKey, context, network?.provider),\n      })\n    }\n\n    if (controllerKey.meta?.algorithms?.includes('eth_signTransaction')) {\n      return new EthrDID({\n        identifier: identifier.did,\n        provider: network.provider,\n        chainNameOrId: network.name || network.chainId,\n        rpcUrl: network.rpcUrl,\n        registry: network.registry,\n        txSigner: new KmsEthereumSigner(controllerKey, context, network?.provider),\n      })\n    } else {\n      // Web3Provider should perform signing and sending transaction\n      return new EthrDID({\n        identifier: identifier.did,\n        provider: network.provider,\n        chainNameOrId: network.name || network.chainId,\n        rpcUrl: network.rpcUrl,\n        registry: network.registry,\n      })\n    }\n  }\n\n  async addKey(\n    { identifier, key, options }: { identifier: IIdentifier; key: IKey; options?: TransactionOptions },\n    context: IRequiredContext,\n  ): Promise<any> {\n    const ethrDid = await this.getEthrDidController(identifier, context)\n    const usg = key.type === 'X25519' ? 'enc' : 'veriKey'\n    const encoding = key.type === 'X25519' ? 'base58' : options?.encoding || 'hex'\n    const attrName = `did/pub/${key.type}/${usg}/${encoding}`\n    const attrValue = '0x' + key.publicKeyHex\n    const ttl = options?.ttl || this.ttl || 86400\n    const gasLimit = options?.gasLimit || this.gas || DEFAULT_GAS_LIMIT\n    if (options?.signOnly) {\n      const metaHash = await ethrDid.createSetAttributeHash(attrName, attrValue, ttl)\n      const canonicalSignature = await EthrDIDProvider.createMetaSignature(context, identifier, metaHash)\n      debug('ethrDid.addKeySigned %o', { attrName, attrValue, ttl, gasLimit })\n      delete options.metaIdentifierKeyId\n      const signature = { sigV: canonicalSignature.v, sigR: canonicalSignature.r, sigS: canonicalSignature.s }\n      return [attrName, attrValue, ttl, signature, { ...options, gasLimit }]\n    } else if (options?.metaIdentifierKeyId) {\n      const metaHash = await ethrDid.createSetAttributeHash(attrName, attrValue, ttl)\n      const canonicalSignature = await EthrDIDProvider.createMetaSignature(context, identifier, metaHash)\n\n      const metaEthrDid = await this.getEthrDidController(identifier, context, options.metaIdentifierKeyId!)\n      debug('ethrDid.addKeySigned %o', { attrName, attrValue, ttl, gasLimit })\n      delete options.metaIdentifierKeyId\n      const txHash = await metaEthrDid.setAttributeSigned(\n        attrName,\n        attrValue,\n        ttl,\n        { sigV: canonicalSignature.v, sigR: canonicalSignature.r, sigS: canonicalSignature.s },\n        {\n          ...options,\n          gasLimit,\n        },\n      )\n      debug(`ethrDid.addKeySigned tx = ${txHash}`)\n      return txHash\n    } else {\n      debug('ethrDid.setAttribute %o', { attrName, attrValue, ttl, gasLimit })\n      const txHash = await ethrDid.setAttribute(attrName, attrValue, ttl, undefined, {\n        ...options,\n        gasLimit,\n      })\n      debug(`ethrDid.addKey tx = ${txHash}`)\n      return txHash\n    }\n  }\n\n  async addService(\n    {\n      identifier,\n      service,\n      options,\n    }: { identifier: IIdentifier; service: IService; options?: TransactionOptions },\n    context: IRequiredContext,\n  ): Promise<any> {\n    const ethrDid = await this.getEthrDidController(identifier, context)\n\n    const attrName = 'did/svc/' + service.type\n    const attrValue =\n      typeof service.serviceEndpoint === 'string'\n        ? service.serviceEndpoint\n        : JSON.stringify(service.serviceEndpoint)\n    const ttl = options?.ttl || this.ttl || 86400\n    const gasLimit = options?.gasLimit || this.gas || DEFAULT_GAS_LIMIT\n\n    debug('ethrDid.setAttribute %o', { attrName, attrValue, ttl, gasLimit })\n\n    if (options?.signOnly) {\n      const metaHash = await ethrDid.createSetAttributeHash(attrName, attrValue, ttl)\n      const canonicalSignature = await EthrDIDProvider.createMetaSignature(context, identifier, metaHash)\n      debug('ethrDid.addKeySigned %o', { attrName, attrValue, ttl, gasLimit })\n      delete options.metaIdentifierKeyId\n      const signature = { sigV: canonicalSignature.v, sigR: canonicalSignature.r, sigS: canonicalSignature.s }\n      return [attrName, attrValue, ttl, signature, { ...options, gasLimit }]\n    } else if (options?.metaIdentifierKeyId) {\n      const metaHash = await ethrDid.createSetAttributeHash(attrName, attrValue, ttl)\n      const canonicalSignature = await EthrDIDProvider.createMetaSignature(context, identifier, metaHash)\n\n      const metaEthrDid = await this.getEthrDidController(identifier, context, options.metaIdentifierKeyId!)\n      debug('ethrDid.addServiceSigned %o', { attrName, attrValue, ttl, gasLimit })\n      delete options.metaIdentifierKeyId\n      const txHash = await metaEthrDid.setAttributeSigned(\n        attrName,\n        attrValue,\n        ttl,\n        { sigV: canonicalSignature.v, sigR: canonicalSignature.r, sigS: canonicalSignature.s },\n        {\n          ...options,\n          gasLimit,\n        },\n      )\n      debug(`ethrDid.addServiceSigned tx = ${txHash}`)\n      return txHash\n    } else {\n      const txHash = await ethrDid.setAttribute(attrName, attrValue, ttl, undefined, {\n        ...options,\n        gasLimit,\n      })\n      debug(`ethrDid.addService tx = ${txHash}`)\n      return txHash\n    }\n  }\n\n  async removeKey(\n    args: { identifier: IIdentifier; kid: string; options?: TransactionOptions },\n    context: IRequiredContext,\n  ): Promise<any> {\n    const ethrDid = await this.getEthrDidController(args.identifier, context)\n\n    const key = args.identifier.keys.find((k) => k.kid === args.kid)\n    if (!key) throw Error('Key not found')\n\n    const usg = key.type === 'X25519' ? 'enc' : 'veriKey'\n    const encoding = key.type === 'X25519' ? 'base58' : args.options?.encoding || 'hex'\n    const attrName = `did/pub/${key.type}/${usg}/${encoding}`\n    const attrValue = '0x' + key.publicKeyHex\n    const gasLimit = args.options?.gasLimit || this.gas || DEFAULT_GAS_LIMIT\n    if (args.options?.signOnly) {\n      const metaHash = await ethrDid.createRevokeAttributeHash(attrName, attrValue)\n      const canonicalSignature = await EthrDIDProvider.createMetaSignature(context, args.identifier, metaHash)\n\n      debug('ethrDid.revokeAttributeSigned %o', { attrName, attrValue, gasLimit })\n      delete args.options.metaIdentifierKeyId\n      const signature = { sigV: canonicalSignature.v, sigR: canonicalSignature.r, sigS: canonicalSignature.s }\n      return [attrName, attrValue, signature, { ...args.options, gasLimit }]\n    } else if (args.options?.metaIdentifierKeyId) {\n      const metaHash = await ethrDid.createRevokeAttributeHash(attrName, attrValue)\n      const canonicalSignature = await EthrDIDProvider.createMetaSignature(context, args.identifier, metaHash)\n\n      const metaEthrDid = await this.getEthrDidController(\n        args.identifier,\n        context,\n        args.options.metaIdentifierKeyId!,\n      )\n      debug('ethrDid.revokeAttributeSigned %o', { attrName, attrValue, gasLimit })\n      delete args.options.metaIdentifierKeyId\n      const txHash = await metaEthrDid.revokeAttributeSigned(\n        attrName,\n        attrValue,\n        { sigV: canonicalSignature.v, sigR: canonicalSignature.r, sigS: canonicalSignature.s },\n        {\n          ...args.options,\n          gasLimit,\n        },\n      )\n      debug(`ethrDid.removeKeySigned tx = ${txHash}`)\n      return txHash\n    } else {\n      debug('ethrDid.revokeAttribute', { attrName, attrValue, gasLimit })\n      const txHash = await ethrDid.revokeAttribute(attrName, attrValue, undefined, {\n        ...args.options,\n        gasLimit,\n      })\n      debug(`ethrDid.removeKey tx = ${txHash}`)\n      return txHash\n    }\n  }\n\n  async removeService(\n    args: { identifier: IIdentifier; id: string; options?: TransactionOptions },\n    context: IRequiredContext,\n  ): Promise<any> {\n    const ethrDid = await this.getEthrDidController(args.identifier, context)\n\n    const service = args.identifier.services.find((s) => s.id === args.id)\n    if (!service) throw Error('Service not found')\n\n    const attrName = 'did/svc/' + service.type\n    const attrValue =\n      typeof service.serviceEndpoint === 'string'\n        ? service.serviceEndpoint\n        : JSON.stringify(service.serviceEndpoint)\n    const gasLimit = args.options?.gasLimit || this.gas || DEFAULT_GAS_LIMIT\n\n    if (args.options?.signOnly) {\n      const metaHash = await ethrDid.createRevokeAttributeHash(attrName, attrValue)\n      const canonicalSignature = await EthrDIDProvider.createMetaSignature(context, args.identifier, metaHash)\n\n      debug('ethrDid.revokeAttributeSigned %o', { attrName, attrValue, gasLimit })\n      delete args.options.metaIdentifierKeyId\n      return [\n        attrName,\n        attrValue,\n        { sigV: canonicalSignature.v, sigR: canonicalSignature.r, sigS: canonicalSignature.s },\n        {\n          ...args.options,\n          gasLimit,\n        },\n      ]\n    } else if (args.options?.metaIdentifierKeyId) {\n      const metaHash = await ethrDid.createRevokeAttributeHash(attrName, attrValue)\n      const canonicalSignature = await EthrDIDProvider.createMetaSignature(context, args.identifier, metaHash)\n\n      const metaEthrDid = await this.getEthrDidController(\n        args.identifier,\n        context,\n        args.options.metaIdentifierKeyId!,\n      )\n      debug('ethrDid.revokeAttributeSigned %o', { attrName, attrValue, gasLimit })\n      delete args.options.metaIdentifierKeyId\n      const txHash = await metaEthrDid.revokeAttributeSigned(\n        attrName,\n        attrValue,\n        { sigV: canonicalSignature.v, sigR: canonicalSignature.r, sigS: canonicalSignature.s },\n        {\n          ...args.options,\n          gasLimit,\n        },\n      )\n      debug(`ethrDid.removeServiceSigned tx = ${txHash}`)\n      return txHash\n    } else {\n      debug('ethrDid.revokeAttribute', { attrName, attrValue, gasLimit })\n      const txHash = await ethrDid.revokeAttribute(attrName, attrValue, undefined, {\n        ...args.options,\n        gasLimit,\n      })\n      debug(`ethrDid.removeService tx = ${txHash}`)\n      return txHash\n    }\n  }\n\n  /**\n   * Tries to determine if this DID provider can manage DIDs with the given prefix.\n   *\n   * If this provider was configured for a particular network and that network name or hexChainId is used in the prefix\n   * it will return true.\n   *\n   * @param prefix - The DID prefix to match against\n   */\n  matchPrefix(prefix: string): boolean {\n    const matches = prefix.match(/^did:ethr(:.+)?$/)\n    let network = this.getNetworkFor(matches?.[1]?.substring(1))\n    if (!matches || !network) {\n      return false\n    }\n    return true\n  }\n\n  private static async createMetaSignature(\n    context: IRequiredContext,\n    identifier: IIdentifier,\n    metaHash: string,\n  ) {\n    const controllerKey = await context.agent.keyManagerGet({ kid: identifier.controllerKeyId! })\n    if (typeof controllerKey === 'undefined') {\n      throw new Error('invalid_argument: identifier.controllerKeyId is not managed by this agent')\n    }\n    const signature = await context.agent.keyManagerSign({\n      keyRef: controllerKey.kid,\n      data: metaHash,\n      algorithm: 'eth_rawSign',\n      encoding: 'hex',\n    })\n    return Signature.from(signature)\n  }\n}\n"
  },
  {
    "path": "packages/did-provider-ethr/src/index.ts",
    "content": "/**\n * Provides `did:ethr` {@link @veramo/did-provider-ethr#EthrDIDProvider | identifier provider }\n * for the {@link @veramo/did-manager#DIDManager}\n *\n * @packageDocumentation\n */\nexport { EthrDIDProvider } from './ethr-did-provider.js'\nexport { KmsEthereumSigner } from './kms-eth-signer.js'\n"
  },
  {
    "path": "packages/did-provider-ethr/src/kms-eth-signer.ts",
    "content": "import {\n  type Provider,\n  Signer,\n  TypedDataDomain,\n  TypedDataField,\n  getAddress,\n  computeAddress,\n  Transaction,\n  AbstractSigner,\n} from 'ethers'\nimport { IRequiredContext } from './ethr-did-provider.js'\nimport { IKey } from '@veramo/core-types'\nimport {Addressable} from \"ethers\";\n\n/**\n * Creates an `ethers` - `signer` implementation by wrapping\n * a veramo agent with a key-manager that should be capable of `eth_signTransaction`\n *\n * @internal This is exported for convenience, not meant to be supported as part of the public API\n */\nexport class KmsEthereumSigner extends AbstractSigner {\n  private context: IRequiredContext\n  private controllerKey: IKey\n  readonly provider: Provider | null\n\n  constructor(controllerKey: IKey, context: IRequiredContext, provider?: Provider) {\n    super(provider)\n    this.controllerKey = controllerKey\n    this.context = context\n    this.provider = provider || null\n  }\n\n  async getAddress(): Promise<string> {\n    // publicKeyHex is not available when using web3provider\n    if (this.controllerKey.meta?.account) {\n      return this.controllerKey.meta?.account\n    }\n    return computeAddress('0x' + this.controllerKey.publicKeyHex)\n  }\n\n  async signTransaction(transaction: Transaction): Promise<string> {\n    if (transaction.from != null) {\n      const thisAddress = await this.getAddress()\n      if (getAddress(transaction.from) !== thisAddress) {\n        throw new Error(`transaction from address mismatch ${transaction.from} != ${thisAddress}`)\n      }\n    }\n\n    const signature = await this.context.agent.keyManagerSign({\n      keyRef: this.controllerKey.kid,\n      data: transaction.unsignedSerialized,\n      algorithm: 'eth_signTransaction',\n      encoding: 'base16',\n    })\n    return signature\n  }\n\n  async signTypedData(\n      domain: TypedDataDomain,\n      types: Record<string, Array<TypedDataField>>,\n      value: Record<string, any>,\n  ): Promise<string> {\n    const data = JSON.stringify({\n      domain: domain,\n      types: types,\n      message: value,\n    });\n    return this.context.agent.keyManagerSign({\n      keyRef: this.controllerKey.kid,\n      algorithm: 'eth_signTypedData',\n      data: data,\n    });\n  }\n\n  signMessage(message: string | Uint8Array): Promise<string> {\n    throw new Error('not_implemented: signMessage() Method not implemented by KmsEthereumSigner.')\n  }\n\n  connect(provider: Provider | null) {\n    if(!provider) {\n      throw new Error('provider must not be null')\n    }\n    return new KmsEthereumSigner(this.controllerKey, this.context, provider) as unknown as Signer\n  }\n}\n\nfunction isAddressable(address: any): address is Addressable {\n  return (address as Addressable).getAddress !== undefined;\n}\n"
  },
  {
    "path": "packages/did-provider-ethr/tsconfig.json",
    "content": "{\n  \"extends\": \"../tsconfig.settings.json\",\n  \"compilerOptions\": {\n    \"rootDir\": \"src\",\n    \"outDir\": \"build\",\n    \"declarationDir\": \"build\",\n    \"skipLibCheck\": true\n  },\n  \"references\": [\n    {\n      \"path\": \"../core-types\"\n    },\n    {\n      \"path\": \"../did-manager\"\n    },\n    {\n      \"path\": \"../utils\"\n    }\n  ]\n}\n"
  },
  {
    "path": "packages/did-provider-ion/CHANGELOG.md",
    "content": "# Change Log\n\nAll notable changes to this project will be documented in this file.\nSee [Conventional Commits](https://conventionalcommits.org) for commit guidelines.\n\n# [7.0.0](https://github.com/decentralized-identity/veramo/compare/v6.0.2...v7.0.0) (2026-02-11)\n\n\n### Bug Fixes\n\n* **deps:** update devdeps and bump typeorm to 0.3.20 ([#1272](https://github.com/decentralized-identity/veramo/issues/1272)) ([7d17f37](https://github.com/decentralized-identity/veramo/commit/7d17f37ea7cc4e73a8cdae028681ae1be5c4d11c))\n* **did-comm:** remove isomorphic-webcrypto dependency ([#1401](https://github.com/decentralized-identity/veramo/issues/1401)) ([85cc1ce](https://github.com/decentralized-identity/veramo/commit/85cc1ce1d567afcbc42e0fd89eb2515505044c83)), closes [#1381](https://github.com/decentralized-identity/veramo/issues/1381) [#1387](https://github.com/decentralized-identity/veramo/issues/1387)\n\n\n\n\n\n## [6.0.2](https://github.com/decentralized-identity/veramo/compare/v6.0.1...v6.0.2) (2026-01-16)\n\n**Note:** Version bump only for package @veramo/did-provider-ion\n\n\n\n\n\n## [6.0.1](https://github.com/decentralized-identity/veramo/compare/v6.0.0...v6.0.1) (2026-01-16)\n\n**Note:** Version bump only for package @veramo/did-provider-ion\n\n\n\n\n\n# [6.0.0](https://github.com/decentralized-identity/veramo/compare/v5.6.0...v6.0.0) (2024-04-02)\n\n**Note:** Version bump only for package @veramo/did-provider-ion\n\n\n\n\n\n# [5.6.0](https://github.com/decentralized-identity/veramo/compare/v5.5.3...v5.6.0) (2024-01-16)\n\n\n### Features\n\n* **remote-client:** allow dynamic headers param for AgentRestClient constructor ([#1314](https://github.com/decentralized-identity/veramo/issues/1314)) ([1b8a0a2](https://github.com/decentralized-identity/veramo/commit/1b8a0a2718dd63492ad3a312a6ebe5f6e7849935)), closes [#1313](https://github.com/decentralized-identity/veramo/issues/1313)\n\n\n\n\n\n## [5.5.3](https://github.com/decentralized-identity/veramo/compare/v5.5.2...v5.5.3) (2023-10-09)\n\n\n### Bug Fixes\n\n* use DIF URLs in packages ([#1271](https://github.com/decentralized-identity/veramo/issues/1271)) ([3dfc601](https://github.com/decentralized-identity/veramo/commit/3dfc6014cdee7902c59d8db76b4c8507b870f227))\n\n\n\n\n\n# [5.5.0](https://github.com/uport-project/veramo/compare/v5.4.1...v5.5.0) (2023-09-19)\n\n\n### Bug Fixes\n\n* **deps:** update dependency cross-fetch to v4 ([1c14d34](https://github.com/uport-project/veramo/commit/1c14d34f48a51bef373541e84ed89f2f44711406))\n* **did-provider-key:** use compressed keys for creating Secp256k1 did:key ([#1217](https://github.com/uport-project/veramo/issues/1217)) ([ba8f6f5](https://github.com/uport-project/veramo/commit/ba8f6f5b9b701e57af86491504ecd209ca0c1c1d)), closes [#1213](https://github.com/uport-project/veramo/issues/1213)\n\n\n\n\n\n## [5.4.1](https://github.com/uport-project/veramo/compare/v5.4.0...v5.4.1) (2023-08-04)\n\n\n### Bug Fixes\n\n* **ci:** benign change meant to tag all packages for another patch release ([#1211](https://github.com/uport-project/veramo/issues/1211)) ([41b5c90](https://github.com/uport-project/veramo/commit/41b5c90277171b7b38c5cf49ca01db5cf75b6300))\n\n\n\n\n\n# [5.4.0](https://github.com/uport-project/veramo/compare/v5.3.0...v5.4.0) (2023-08-01)\n\n\n### Features\n\n* **did-comm:** add support for the AES based content and key encryption algorithms ([#1180](https://github.com/uport-project/veramo/issues/1180)) ([5294a81](https://github.com/uport-project/veramo/commit/5294a812ee578c0712b54f216416c3ef78c848da))\n\n\n\n\n\n# [5.3.0](https://github.com/uport-project/veramo/compare/v5.2.0...v5.3.0) (2023-07-27)\n\n\n### Bug Fixes\n\n* add missing js extension for json canonicalizer import ([#1175](https://github.com/uport-project/veramo/issues/1175)) ([d6afc3f](https://github.com/uport-project/veramo/commit/d6afc3f6f87fb26e9bbdeb131e2270faf87018de))\n* **deps:** update dependency @decentralized-identity/ion-sdk to v1 ([6981e68](https://github.com/uport-project/veramo/commit/6981e6845d6f90d7b0c8dd6e0117b73dfd8edfb9))\n\n\n\n\n\n# [5.2.0](https://github.com/uport-project/veramo/compare/v5.1.4...v5.2.0) (2023-05-02)\n\n\n### Bug Fixes\n\n* **deps:** update dependency canonicalize to v2 ([8368462](https://github.com/uport-project/veramo/commit/8368462c415e316318855f9f762b040dbb251296))\n\n\n\n\n\n## [5.1.2](https://github.com/uport-project/veramo/compare/v5.1.1...v5.1.2) (2023-02-25)\n\n\n### Bug Fixes\n\n* **ci:** minor changes to trigger release alignment ([9db312f](https://github.com/uport-project/veramo/commit/9db312f8f049ec13ef394dc77fe6e2759143790d))\n\n\n\n\n\n# [5.1.0](https://github.com/uport-project/veramo/compare/v5.0.0...v5.1.0) (2023-02-24)\n\n**Note:** Version bump only for package @veramo/did-provider-ion\n\n\n\n\n\n# [5.0.0](https://github.com/uport-project/veramo/compare/v4.3.0...v5.0.0) (2023-02-09)\n\n\n### Build System\n\n* convert veramo modules to ESM instead of CommonJS ([#1103](https://github.com/uport-project/veramo/issues/1103)) ([b5cea3c](https://github.com/uport-project/veramo/commit/b5cea3c0d80d900a47bd1d9eea68f84b70a35e7b)), closes [#1099](https://github.com/uport-project/veramo/issues/1099)\n\n\n### Features\n\n* isolate `core-types` package from `core` ([#1116](https://github.com/uport-project/veramo/issues/1116)) ([ba7a303](https://github.com/uport-project/veramo/commit/ba7a303de91cf4cc568a3af1ddf8ca98ed022e9f))\n\n\n### BREAKING CHANGES\n\n* this is a breaking change as modules will have to be imported differently: \n* https://www.typescriptlang.org/docs/handbook/esm-node.html\n* https://nodejs.org/api/esm.html\n* https://caniuse.com/?search=modules\n\ntest(did-provider-ion): skip a couple of tests that fail with unreasonable errors\nchore: use ubuntu-latest on CI\nfix: temporarily remove puppeteer tests\nfix: use craco for test-react-app to enable babel config\ntest: fix unit and integration tests (browser tests still broken)\nfix: fix some build issues that prevented tests from working\nfix: missing deps flagged by pnpm\n\n\n\n\n\n# [4.3.0](https://github.com/uport-project/veramo/compare/v4.2.0...v4.3.0) (2023-01-27)\n\n**Note:** Version bump only for package @veramo/did-provider-ion\n\n\n\n\n\n# [4.2.0](https://github.com/uport-project/veramo/compare/v4.1.2...v4.2.0) (2022-12-05)\n\n\n### Bug Fixes\n\n* **credential-w3c:** correct verification of credentials given as objects with jwt proofs ([#1071](https://github.com/uport-project/veramo/issues/1071)) ([b0d75e9](https://github.com/uport-project/veramo/commit/b0d75e9af7f28384ce2e5ef744dfbc3c302cd1a8))\n* **deps:** bump dependencies ([701b8ed](https://github.com/uport-project/veramo/commit/701b8edf981ea11c7ddb6a81d2817dbbdbb022f3))\n* **did-provider-ion:** await and update deps ([#1074](https://github.com/uport-project/veramo/issues/1074)) ([8cea4c0](https://github.com/uport-project/veramo/commit/8cea4c04746a3ef05e400df51a1b47168b46e45d))\n\n\n\n\n\n## [4.1.1](https://github.com/uport-project/veramo/compare/v4.1.0...v4.1.1) (2022-11-01)\n\n**Note:** Version bump only for package @veramo/did-provider-ion\n\n\n\n\n\n# [4.1.0](https://github.com/uport-project/veramo/compare/v4.0.2...v4.1.0) (2022-10-31)\n\n\n### Bug Fixes\n\n* **deps:** Update dependency ethr-did-resolver to v7 ([#1038](https://github.com/uport-project/veramo/issues/1038)) ([d421c0f](https://github.com/uport-project/veramo/commit/d421c0f9f5934829df2930e58e98bcfce813ce84))\n* **did-provider-ion:** delete new keys if addKey fails([#1045](https://github.com/uport-project/veramo/issues/1045)) ([db02742](https://github.com/uport-project/veramo/commit/db027423d709930dccfb7246738670726a33ab9f))\n\n\n### Features\n\n* add ION DID Provider implementation ([#987](https://github.com/uport-project/veramo/issues/987)) ([594571c](https://github.com/uport-project/veramo/commit/594571cf378ac59a91e2f93484c37285ec593999)), closes [#336](https://github.com/uport-project/veramo/issues/336) [#440](https://github.com/uport-project/veramo/issues/440)\n"
  },
  {
    "path": "packages/did-provider-ion/LICENSE",
    "content": "                                  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 2019 Consensys AG\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"
  },
  {
    "path": "packages/did-provider-ion/README.md",
    "content": "# Veramo did:ion provider\n\nThis package contains an implementation of the `AbstractIdentifierProvider` for the `did:ion` method.\nEnabling creating, updating, deactivating and resolving of `did:ion` entities. The ION Network is an implementation of\nthe\n[Sidetree](https://identity.foundation/sidetree/spec/) protocol\nand [specification](https://identity.foundation/sidetree/spec/) using the Bitcoin blockchain.\nAn explorer can be found [here](https://identity.foundation/ion/explorer/).\n\n_WARNING: Although the update and removal functions for Keys and Services seem to yield a request with a valid response\nfrom the ION\nnode, right now these update and delete operations are not reflected in the eventual DID Document after the anchor time\nhas passed when using Microsoft's Public ION node. We are actively looking to solve this issue_\n\n## Long form and short form ION DIDs\n\nION has the concept of short form DIDs. a Short form DID is a DID, you also typically encounter when using other DID\nmethods. They are resolved using a resolver, as long as the DID is anchored or stored.\n\nSince ION uses the Bitcoin network it takes time to propagate changes (see next chapter). To ensure that ION DIDs can\nalready be resolved directly after creation a long form DID is available. The long form DID starts with the short form\nDID and then a signed string is appended after a colon. This means that a long form DID is self certifying as it is\nsigned. It basically is a representation of the DID Document directly within the DID, similar to for instance did:key.\nLong form DIDs are resolvable immediately.\nMore info about long and short form ION DIDs can be found in\nthe [Sidetree specification](https://identity.foundation/sidetree/spec/#did-uri-composition)\n\nThis ION Provider creates Veramo Identifiers using Long form as the identifier's 'did' value, whilst using the short\nform as it's 'alias' value.\n\n## Timing and limitations of current ION Network\n\nION uses the Bitcoin network to anchor DIDs. As a result it typically also takes at least 10 minutes before requests are\nactually reflected in the ION Network.\nThe net result is that you will not see your updates reflected in for instance\nthe [ION Explorer](https://identity.foundation/ion/explorer/) or when resolving the DID, until this time has passed.\n\nCurrently, you can only use one operation for the same Identifier in between anchoring on the network. This typically is\nroughly 10-15 minutes.\nThe net-result is that you will receive an error in case you are trying to add or remove keys and services for the same\nidentifier within this period.\n\n## Update key(s) and rotation\n\nThe ION DID provider uses Update keys when updating the DID document. The provider creates new update keys internally\nfor every update. These are stored ordered by timestamp. When updating the DID Document if first resolves the current\nDID document to look at the ION/Sidetree update commitment value. It then looks up the local key with the same\ncommitment value. The update request will be signed using the matched update key. At the same time a new update key is\ngenerated, and the new key's update commitment will also be part of the update request, so that this new key needs to be\nused next time. The provider takes care of both the rotation and the selection of the correct update key.\n\n## Recovery key(s) and rotation\n\nRecovery Keys are needed for deleting the Identifier and deactivating the DID. It uses a similar mechanism as described\nabove for the update keys.\nThe ION update keys could also be used in case of loss of update keys. Currently, this provider does not expose methods\nto do this, although most of the methods and infra to do so should be present.\n\n## NodeJS and Browser notice\n\nWhen using the ION DID Provider in the browser or a Node environment, you can ignore the warning about the missing peer\ndependency for `@sphereon/react-native-argon2`. Obviously these are not needed for non react-native\nprojects.\n\n## React Native notice\n\nNext to NodeJS and Browser support, the ION DID Provider also works with react-native. You do need to install the\nfollowing\npackage using your package manager. This has to do with auto-linking not being available for transitive dependencies. We\nneed some native Argon2 Android/IOS modules on React Native because WASM isn't available. As such you will have to\ninstall the dependency directly into your app. You do not need to change settings or anything. The dependency will be\npicked up and used automatically.\nSee [this ticket](https://github.com/react-native-community/cli/issues/870) for a discussion about this issue.\n\nnpm: `npm install @sphereon/react-native-argon2`\n\nyarn: `yarn add @sphereon/react-native-argon2`\n\n## Different ION node and challenge/response settings\n\nThe ION DID provider by default uses Microsoft's publicly hosted ION node(s)\nat: https://beta.ion.msidentity.com/api/v1.0/operations\n\nThis Node uses a challenge/response system to prevent spam. The `challengeEnabled` option, defaults to true with\na `challengeEndpoint` value of https://beta.ion.msidentity.com/api/v1.0/proof-of-work-challenge.\nIf you are running your own node, you might want to change the `solutionEndpoint` constructor option, pointing to your\nION node, together with setting the `challengeEnabled` constructor option to false.\n\n## Creating an identifier\n\nWhen creating a new Veramo Identifier you can choose to import your own keys or have them generated for you. You can\nalso choose to use specific Key IDs for your key, regardless of generation or import.\nThe options object when creating an identifier is as follows:\n\n```typescript\nexport interface ICreateIdentifierOpts {\n  verificationMethods?: VerificationMethod[] // The Verification method to add\n  recoveryKey?: KeyOpts // Recovery key options\n  updateKey?: KeyOpts // Update key options\n  services?: IService[] // Service(s) to add\n  actionTimestamp?: number // Unique number denoting the action. Used for ordering internally. Suggested to use current timestamp\n  anchor?: boolean // Whether the DID should be anchored on ION or not. Handy for testing or importing an ID\n}\n\nexport interface VerificationMethod extends KeyOpts {\n  purposes: IonPublicKeyPurpose[] // In sidetree these are called purposes, but in DID-Core Verification Relationships\n}\n\nexport interface KeyOpts {\n  kid?: string // Key ID to assign in case we are importing or creating a key\n  key?: MinimalImportableKey // Optional key to import. If not specified a key with random kid will be created\n  type?: KeyType // The key type. Defaults to Secp256k1\n}\n\nexport interface IService {\n  id: string // ID\n  type: string // Service type\n  serviceEndpoint: string // Endpoint URL\n  description?: string //Optional description\n}\n```\n\n### Creating an Identifier using auto-generated keys\n\nThe example below generates an update key, a recover key and creates one DID Verification Method as part of the DID\nDocument with id `did-generated`, with accompanying key.\nThe `anchor: true`, means to propagate the anchor to the ION Network. You typically want to use `true`, unless you are\nimporting keys for an existing DID.\nThe purposes are the Verification Method Relationships in the DID Document. ION/Sidetree calls these purposes.\n\n```typescript\nconst identifier: IIdentifier = await agent.didManagerCreate({\n  options: {\n    anchor: true,\n    recoveryKey: {\n      kid: 'recovery-generated',\n    },\n    updateKey: {\n      kid: 'update-generated',\n    },\n    verificationMethods: [\n      {\n        kid: 'did-generated',\n        purposes: [IonPublicKeyPurpose.Authentication, IonPublicKeyPurpose.AssertionMethod],\n      },\n    ],\n  },\n})\n```\n\n### Creating an Identifier using imported keys\n\nThe example below generates an update key with random Key ID. Notice the absence of the recoveryKey property. It imports\nan existing recovery key and creates one DID Verification Method as part of the DID Document with id `did-imported1`,\nusing an imported key.\nThe `anchor: true`, means to propagate the anchor to the ION Network. You typically want to use `true`, unless you are\nimporting keys for an existing DID.\nThe purposes are the Verification Method Relationships in the DID Document. ION/Sidetree calls these purposes.\n\n```typescript\nconst identifier: IIdentifier = await agent.didManagerCreate({\n  options: {\n    anchor: true,\n    updateKey: {\n      kid: 'update-imported',\n    },\n    verificationMethods: [\n      {\n        kid: 'did-imported1',\n        purposes: [IonPublicKeyPurpose.Authentication, IonPublicKeyPurpose.AssertionMethod],\n      },\n    ],\n  },\n})\n```\n\n## Adding and removing Keys\n\nAdding and removing keys typically use the below options:\n\n```typescript\nexport interface IUpdateOpts {\n  actionTimestamp?: number // Unique number denoting the action. Used for ordering internally. Suggested to use current timestamp\n  anchor?: boolean // Whether the DID should be anchored on ION or not. Handy for testing or importing an ID\n}\n\nexport interface VerificationMethod extends KeyOpts {\n  purposes: IonPublicKeyPurpose[] // In sidetree these are called purposes, but in DID-Core Verification Relationships\n}\n\nexport interface KeyOpts {\n  kid?: string // Key ID to assign in case we are importing or creating a key\n  key?: MinimalImportableKey // Optional key to import. If not specified a key with random kid will be created\n  type?: KeyType // The key type. Defaults to Secp256k1\n}\n```\n\n### Adding a Key\n\nAdding a key always has to happen using a previously created or imported key in Veramo. Unlike the create Identifier\nfunction we do not support generating the key on the fly. This has to do with the interface of Veramo requiring a key.\n\n```typescript\nconst key = await agent.keyManagerCreate({ kms: 'mem', type: 'Secp256k1' })\nconst result = agent.didManagerAddKey({\n  did: identifier.did,\n  key,\n  kid: 'my-newly-added-key',\n  options: {\n    purposes: [IonPublicKeyPurpose.AssertionMethod],\n    anchor: true,\n  },\n})\n```\n\n### Removing a Key\n\nRemoving a key always has to happen using a previously created or imported key in Veramo.\n\n```typescript\nconst result = await agent.didManagerRemoveKey({\n  did: identifier.did,\n  kid: 'my-newly-added-key',\n  options: { anchor: true },\n})\n```\n\n## Adding and removing Services\n\nAdding and removing DID Document Services involves the below interfaces:\n\n```typescript\nexport interface IUpdateOpts {\n  actionTimestamp?: number // Unique number denoting the action. Used for ordering internally. Suggested to use current timestamp\n  anchor?: boolean // Whether the DID should be anchored on ION or not. Handy for testing or importing an ID\n}\n\nexport interface VerificationMethod extends KeyOpts {\n  purposes: IonPublicKeyPurpose[] // In sidetree these are called purposes, but in DID-Core Verification Relationships\n}\n\nexport interface IService {\n  id: string // ID\n  type: string // Service type\n  serviceEndpoint: string // Endpoint URL\n  description?: string //Optional description\n}\n```\n\n### Adding a service\n\nAdding a service is straightforward. It requires a Service object which will end up in the DID Document, and it needs\nthe\nDID value.\n\n```typescript\nconst service: IService = {\n  type: 'LinkedDomains',\n  id: 'example-domain',\n  serviceEndpoint: 'https://test-example.com',\n}\n\nconst result = await agent.didManagerAddService({\n  did: identifier.did,\n  service,\n  options: { anchor: true },\n})\n```\n\n### Removing a service\n\nRemoving a service is straightforward. The example has no options, which equates to anchor being true.\n\n```typescript\nconst result = await agent.didManagerRemoveService({\n  did: identifier.did,\n  id: 'example-domain',\n})\n```\n\n## Removing the Identifier and DID\n\n_WARNING: Currently deleting the identifier will always be propagated to the ION Network. Reason is that Veramo doesn't\nexpose an options parameter for deleting an identifier._\n\nDeleting an identifier is straightforward:\n\n```typescript\nconst deleted = await agent.didManagerDelete({ did: identifier.did })\n```\n"
  },
  {
    "path": "packages/did-provider-ion/__tests__/canonicalizer.test.ts",
    "content": "import { JsonCanonicalizer } from '../src/json-canonicalizer.js'\n\ndescribe('canonicalizer result should be', () => {\n  it('throwing an error on null input', () => {\n    expect(() => JsonCanonicalizer.asString(null)).toThrow('Null content received in canonicalizer')\n  })\n  it('quoted empty string on empty string', () => {\n    expect(JsonCanonicalizer.asString('')).toEqual('\"\"')\n  })\n  it('empty json string on empty json', () => {\n    expect(JsonCanonicalizer.asString({})).toEqual('{}')\n  })\n  it('a json string exactly matching input', () => {\n    expect(\n      JsonCanonicalizer.asString({\n        test1: 'test1',\n        test2: 'test2',\n      }),\n    ).toEqual('{\"test1\":\"test1\",\"test2\":\"test2\"}')\n  })\n  it('a json string with properties reordered', () => {\n    expect(\n      JsonCanonicalizer.asString({\n        test2: 'test2',\n        test1: 'test1',\n      }),\n    ).toEqual('{\"test1\":\"test1\",\"test2\":\"test2\"}')\n  })\n  it('a json string with null values intact', () => {\n    expect(\n      JsonCanonicalizer.asString({\n        test1: 'test1',\n        test2: null,\n      }),\n    ).toEqual('{\"test1\":\"test1\",\"test2\":null}')\n  })\n  it('a json string with undefined property values removed', () => {\n    expect(\n      JsonCanonicalizer.asString({\n        test1: 'test1',\n        test2: undefined,\n      }),\n    ).toEqual('{\"test1\":\"test1\"}')\n  })\n  it('a json string with undefined property values removed if nested', () => {\n    expect(\n      JsonCanonicalizer.asString({\n        test1: {\n          test2: 'test2',\n          test3: undefined,\n        },\n      }),\n    ).toEqual('{\"test1\":{\"test2\":\"test2\"}}')\n  })\n})\n"
  },
  {
    "path": "packages/did-provider-ion/__tests__/functions.test.ts",
    "content": "import { ManagedKeyInfo } from '../../core-types/src'\nimport { generatePrivateKeyHex, tempMemoryKey, toIonPrivateKeyJwk } from '../src/functions.js'\nimport { KeyIdentifierRelation, KeyType } from '../src/types/ion-provider-types.js'\n\nconst PRIVATE_RECOVERY_KEY_HEX = '7c90c0575643d09a370c35021c91e9d8af2c968c5f3a4bf73802693511a55b9f'\nconst PRIVATE_UPDATE_KEY_HEX = '7288a92f6219c873446abd1f8d26fcbbe1caa5274b47f6f086ef3e7e75dcad8b'\nconst PRIVATE_DID_KEY_HEX = '06eb9e64569203679b36f834a4d9725c989d32a7fb52c341eae3517b3aff8ee6'\n\ndescribe('functions: key generator', () => {\n  it('Secp256k1 should generate random keys', () => {\n    const key1 = generatePrivateKeyHex(KeyType.Secp256k1)\n    const key2 = generatePrivateKeyHex(KeyType.Secp256k1)\n    const key3 = generatePrivateKeyHex(KeyType.Secp256k1)\n    expect(key1).toBeDefined()\n    expect(key2).toBeDefined()\n    expect(key3).toBeDefined()\n    expect(key1).not.toBe(key2)\n    expect(key2).not.toBe(key3)\n  })\n  it('Secp256k1 should result in hex length 64', () => {\n    expect(generatePrivateKeyHex(KeyType.Secp256k1).length).toBe(64)\n  })\n\n  it('Ed25519 should generate random keys', () => {\n    const key1 = generatePrivateKeyHex(KeyType.Ed25519)\n    const key2 = generatePrivateKeyHex(KeyType.Ed25519)\n    const key3 = generatePrivateKeyHex(KeyType.Ed25519)\n    expect(key1).toBeDefined()\n    expect(key2).toBeDefined()\n    expect(key3).toBeDefined()\n    expect(key1).not.toBe(key2)\n    expect(key2).not.toBe(key3)\n  })\n  it('Ed25519 should result in hex length 128', () => {\n    expect(generatePrivateKeyHex(KeyType.Ed25519).length).toBe(128)\n  })\n})\n\ndescribe('functions: ionKeys', () => {\n  it('toPrivateKeyJwk should be deterministic', () => {\n    const privateKeyJwk = toIonPrivateKeyJwk(PRIVATE_DID_KEY_HEX)\n    expect(privateKeyJwk).toEqual({\n      crv: 'secp256k1',\n      d: 'BuueZFaSA2ebNvg0pNlyXJidMqf7UsNB6uNRezr_juY',\n      kty: 'EC',\n      x: 'aMjNCWMdeXJRg3PDzE7TE9P2xFpoL9fRkJ0toVBMB8E',\n      y: 'Qz7vj0zUj6S4daGIuEMbB_Ua6Q6wOTGAo46tXLi3SxE',\n    })\n  })\n  it('temp recovery Memory Key should be deterministic and have a commitment ', async () => {\n    const tmpKey = await tempMemoryKey(KeyType.Secp256k1, PRIVATE_RECOVERY_KEY_HEX, 'test-recovery-kid', 'test-recovery-kms', {\n      relation: KeyIdentifierRelation.RECOVERY,\n      actionTimestamp: 2,\n    })\n    expect(tmpKey).toMatchObject<ManagedKeyInfo>({\n      kid: 'test-recovery-kid',\n      kms: 'test-recovery-kms',\n      meta: {\n        ion: {\n          actionTimestamp: 2,\n          commitment: 'EiDAQXSi7HcjJVBYAKdO2zrM4HfybmBBCWsl6PQPJ_jklA',\n          relation: 'recovery',\n        },\n      },\n      publicKeyHex:\n        '04d530f20a7b3aa14a1dd4ca0aa67fc36138b6547bc91f454bda8d37f9021e0f5c24eeb53256a81d1b26ac342b00b0e7346b38f25a47c3cf233a0601714ae63b8b',\n      type: 'Secp256k1',\n    })\n  })\n  it('temp update Memory Key should be deterministic and have a commitment ', async () => {\n    const tmpKey = await tempMemoryKey(KeyType.Secp256k1, PRIVATE_UPDATE_KEY_HEX, 'test-update-kid', 'test-update-kms', {\n      relation: KeyIdentifierRelation.UPDATE,\n      actionTimestamp: 4,\n    })\n    expect(tmpKey).toMatchObject<ManagedKeyInfo>({\n      kid: 'test-update-kid',\n      kms: 'test-update-kms',\n      meta: {\n        ion: {\n          actionTimestamp: 4,\n          commitment: 'EiBzp7YhN9mhUcZsFdxnf-lwkRU-hVbBtZWsVoJHV6jkwA',\n          relation: 'update',\n        },\n      },\n      publicKeyHex:\n        '04826d51d96e9accdef1b13d9acfab61a15d5b5a6b0c1050acb68d58070a3baa0402dae4c63691a6d094537930aef1fa9116af81a6796015edb67013a2792e0b09',\n      type: 'Secp256k1',\n    })\n  })\n})\n"
  },
  {
    "path": "packages/did-provider-ion/__tests__/ion-did-provider.test.ts",
    "content": "import { IDIDManager, IIdentifier, IKey, IKeyManager, IService } from '../../core-types/src'\nimport { createAgent } from '../../core/src'\nimport { DIDManager, MemoryDIDStore } from '../../did-manager/src'\nimport { KeyManager, MemoryKeyStore, MemoryPrivateKeyStore } from '../../key-manager/src'\nimport { IonPublicKeyPurpose } from '@decentralized-identity/ion-sdk'\nimport { KeyManagementSystem } from '../../kms-local/src'\nimport { IonDIDProvider } from '../src/ion-did-provider.js'\nimport { ICreateIdentifierOpts } from '../src/types/ion-provider-types.js'\n\nimport { jest } from '@jest/globals'\n// @ts-ignore\nimport nock from 'nock'\n\njest.setTimeout(30000)\n\n// Disable PoW challenge in tests to avoid argon2 WASM fetches\nconst ionDIDProvider = new IonDIDProvider({\n  defaultKms: 'mem',\n  challengeEnabled: false,\n})\nconst agent = createAgent<IKeyManager, IDIDManager>({\n  plugins: [\n    new KeyManager({\n      store: new MemoryKeyStore(),\n      kms: {\n        mem: new KeyManagementSystem(new MemoryPrivateKeyStore()),\n      },\n    }),\n    new DIDManager({\n      providers: {\n        'did:ion': ionDIDProvider,\n      },\n      defaultProvider: 'did:ion',\n      store: new MemoryDIDStore(),\n    }),\n  ],\n})\n\nconst PRIVATE_RECOVERY_KEY_HEX = '7c90c0575643d09a370c35021c91e9d8af2c968c5f3a4bf73802693511a55b9f'\nconst PRIVATE_UPDATE_KEY_HEX = '7288a92f6219c873446abd1f8d26fcbbe1caa5274b47f6f086ef3e7e75dcad8b'\nconst PRIVATE_DID1_KEY_HEX = '06eb9e64569203679b36f834a4d9725c989d32a7fb52c341eae3517b3aff8ee6'\nconst PRIVATE_DID2_KEY_HEX = '42f5d6cbb8af0b484453e19193b6d89e814f1ce66d2c1428271c94ff5465d627'\nconst PRIVATE_DID3_KEY_HEX = 'abebf433281c5bb86ff8a271d2a464e528437041322a58fb8c14815763cfc189'\nconst PRIVATE_DID4_KEY_HEX = '7dd923e40f4615ac496119f7e793cc2899e99b64b88ca8603db986700089532b'\n\n// Generate a new private key in hex format if needed, using the following method:\n// console.log(generatePrivateKeyHex(KeyType.Secp256k1))\n\ndescribe('@veramo/did-provider-ion', () => {\n  beforeAll(async () => {\n    // Mocking ION HTTP requests\n    nock('https://beta.ion.msidentity.com')\n      .persist()\n      .post('/api/v1.0/operations')\n      .reply(200, { operation: 'mocked-operation' })\n\n    nock('https://beta.discover.did.microsoft.com')\n      .persist()\n      .get(/\\/1\\.0\\/identifiers\\/.*/)\n      .reply(200, {\n        didDocument: {\n          '@context': 'https://www.w3.org/ns/did/v1',\n          id: 'did:ion:mock',\n          verificationMethod: [],\n        },\n        didDocumentMetadata: { method: { updateCommitment: 'genesis', recoveryCommitment: 'genesis' } },\n        didResolutionMetadata: {},\n      })\n  })\n\n  it('should create identifier', async () => {\n    const options: ICreateIdentifierOpts = createIdentifierOpts\n    const identifier: IIdentifier = await agent.didManagerCreate({ options })\n\n    expect(identifier).toBeDefined()\n    expect(identifier.keys.length).toBe(4)\n    expect(identifier.services.length).toBe(1)\n\n    expect(identifier.keys[0]).toMatchObject<Partial<IKey>>({\n      kms: 'mem',\n      kid: 'recovery-test',\n      meta: { ion: { relation: 'recovery' } },\n    })\n  })\n\n  // this fails with TypeError: Failed to parse URL from\n  // .../veramo/node_modules/.pnpm/argon2-browser@1.18.0/node_modules/argon2-browser/dist/argon2.wasm\n  it('should add key', async () => {\n    // This DID is known in ION, hence no anchoring\n    const identifier: IIdentifier = await agent.didManagerCreate(\n      existingDidConfig(false, 'did1-test2', PRIVATE_DID1_KEY_HEX),\n    )\n    expect(identifier.alias).toEqual('did:ion:EiCprjAMfWpp7zYXDZV2TGNDV6U4AEBN2Jr6sVsuzL7qhA')\n    expect(identifier.did).toEqual(\n      'did:ion:EiCprjAMfWpp7zYXDZV2TGNDV6U4AEBN2Jr6sVsuzL7qhA:eyJkZWx0YSI6eyJwYXRjaGVzIjpbeyJhY3Rpb24iOiJyZXBsYWNlIiwiZG9jdW1lbnQiOnsicHVibGljS2V5cyI6W3siaWQiOiJkaWQxLXRlc3QyIiwicHVibGljS2V5SndrIjp7ImNydiI6InNlY3AyNTZrMSIsImt0eSI6IkVDIiwieCI6ImFNak5DV01kZVhKUmczUER6RTdURTlQMnhGcG9MOWZSa0owdG9WQk1COEUiLCJ5IjoiUXo3dmowelVqNlM0ZGFHSXVFTWJCX1VhNlE2d09UR0FvNDZ0WExpM1N4RSJ9LCJwdXJwb3NlcyI6WyJhdXRoZW50aWNhdGlvbiIsImFzc2VydGlvbk1ldGhvZCJdLCJ0eXBlIjoiRWNkc2FTZWNwMjU2azFWZXJpZmljYXRpb25LZXkyMDE5In1dfX1dLCJ1cGRhdGVDb21taXRtZW50IjoiRWlCenA3WWhOOW1oVWNac0ZkeG5mLWx3a1JVLWhWYkJ0WldzVm9KSFY2amt3QSJ9LCJzdWZmaXhEYXRhIjp7ImRlbHRhSGFzaCI6IkVpRDl4NFJOekEtRGRpRHJUMGd1UU9vLXAwWDh2RTRNcUpvcEVTelZ2ZUtEQnciLCJyZWNvdmVyeUNvbW1pdG1lbnQiOiJFaURBUVhTaTdIY2pKVkJZQUtkTzJ6ck00SGZ5Ym1CQkNXc2w2UFFQSl9qa2xBIn19',\n    )\n\n    const newKey = await agent.keyManagerCreate({ kms: 'mem', type: 'Secp256k1' })\n    const resultPromise = agent.didManagerAddKey({\n      did: identifier.did,\n      key: newKey,\n      kid: 'test-add-key-' + Date.now(),\n      options: {\n        purposes: [IonPublicKeyPurpose.AssertionMethod, IonPublicKeyPurpose.Authentication],\n        anchor: true,\n      },\n    })\n    try {\n      expect(await resultPromise).toMatchObject({})\n    } catch (error) {\n      if (error.message.includes('discovery_service.not_found')) {\n        // MS node is not entirely stable. Sometimes the above error is thrown\n        return\n      }\n      await expect(error.message).toMatch('An operation request already exists in queue for DID')\n    }\n  })\n\n  it('should add service', async () => {\n    // This DID is known in ION, hence no anchoring\n    const identifier: IIdentifier = await agent.didManagerCreate(\n      existingDidConfig(false, 'test2-kid2', PRIVATE_DID2_KEY_HEX),\n    )\n    expect(identifier.alias).toEqual('did:ion:EiAxehS9OQs5bL00wmnZj6AupzvO5rB5KIobbi3oRtCmiw')\n    expect(identifier.did).toEqual(\n      'did:ion:EiAxehS9OQs5bL00wmnZj6AupzvO5rB5KIobbi3oRtCmiw:eyJkZWx0YSI6eyJwYXRjaGVzIjpbeyJhY3Rpb24iOiJyZXBsYWNlIiwiZG9jdW1lbnQiOnsicHVibGljS2V5cyI6W3siaWQiOiJ0ZXN0Mi1raWQyIiwicHVibGljS2V5SndrIjp7ImNydiI6InNlY3AyNTZrMSIsImt0eSI6IkVDIiwieCI6ImRXcU81cmFkUDVyRnVVemZ2NE9tOGtQZ3ptdTE4S1RCeHhKWkZ5STR4ZTQiLCJ5IjoiWGI5em9WOWhvRTNqbnNmV0dOYjhGSmlqcjU1WUNHamFKbGtxVGJ6SWdWSSJ9LCJwdXJwb3NlcyI6WyJhdXRoZW50aWNhdGlvbiIsImFzc2VydGlvbk1ldGhvZCJdLCJ0eXBlIjoiRWNkc2FTZWNwMjU2azFWZXJpZmljYXRpb25LZXkyMDE5In1dfX1dLCJ1cGRhdGVDb21taXRtZW50IjoiRWlCenA3WWhOOW1oVWNac0ZkeG5mLWx3a1JVLWhWYkJ0WldzVm9KSFY2amt3QSJ9LCJzdWZmaXhEYXRhIjp7ImRlbHRhSGFzaCI6IkVpQXota1h2SVdsSjFfRElCVGlUSkpWRWo0R0U2eHQyTTZHcnVvRFIxcTNHU2ciLCJyZWNvdmVyeUNvbW1pdG1lbnQiOiJFaURBUVhTaTdIY2pKVkJZQUtkTzJ6ck00SGZ5Ym1CQkNXc2w2UFFQSl9qa2xBIn19',\n    )\n\n    const service: IService = {\n      type: 'LinkedDomains',\n      id: 'test' + Date.now(),\n      serviceEndpoint: 'https://test-example.com',\n    }\n\n    const resultPromise = agent.didManagerAddService({\n      did: identifier.did,\n      service,\n      options: { anchor: false },\n    })\n    try {\n      expect(await resultPromise).toMatchObject({})\n    } catch (error) {\n      if (error.message.includes('discovery_service.not_found')) {\n        // MS node is not entirely stable. Sometimes the above error is thrown\n        return\n      }\n      await expect(error.message).toMatch('An operation request already exists in queue for DID')\n    }\n  })\n\n  it('should remove key', async () => {\n    // This DID is known in ION, hence no anchoring\n    const identifier: IIdentifier = await agent.didManagerCreate(\n      existingDidConfig(false, 'did3-test3', PRIVATE_DID3_KEY_HEX),\n    )\n    expect(identifier.alias).toEqual('did:ion:EiCkiD0CYfwNWupjNPycPi7WbTbMpDgt8KzVHboaUoitdw')\n    expect(identifier.did).toEqual(\n      'did:ion:EiCkiD0CYfwNWupjNPycPi7WbTbMpDgt8KzVHboaUoitdw:eyJkZWx0YSI6eyJwYXRjaGVzIjpbeyJhY3Rpb24iOiJyZXBsYWNlIiwiZG9jdW1lbnQiOnsicHVibGljS2V5cyI6W3siaWQiOiJkaWQzLXRlc3QzIiwicHVibGljS2V5SndrIjp7ImNydiI6InNlY3AyNTZrMSIsImt0eSI6IkVDIiwieCI6IktYYXp6U21PUzBvQWo4VEd4a3VnaS1QTzFxYWwyREJJemNWcUV6MjRzYkEiLCJ5IjoiQnVTaDJDVFQ2SV9IRmtVaXhaTkkwemstNjNvZEVKR1E5NkZ4RWxvZG1XayJ9LCJwdXJwb3NlcyI6WyJhdXRoZW50aWNhdGlvbiIsImFzc2VydGlvbk1ldGhvZCJdLCJ0eXBlIjoiRWNkc2FTZWNwMjU2azFWZXJpZmljYXRpb25LZXkyMDE5In1dfX1dLCJ1cGRhdGVDb21taXRtZW50IjoiRWlCenA3WWhOOW1oVWNac0ZkeG5mLWx3a1JVLWhWYkJ0WldzVm9KSFY2amt3QSJ9LCJzdWZmaXhEYXRhIjp7ImRlbHRhSGFzaCI6IkVpQ1N6N0FxV2FyWk5ISmV3ZTR5ZUsxMkxVdHBfNmpaVXhzNzY5ZkZfcXZ1aWciLCJyZWNvdmVyeUNvbW1pdG1lbnQiOiJFaURBUVhTaTdIY2pKVkJZQUtkTzJ6ck00SGZ5Ym1CQkNXc2w2UFFQSl9qa2xBIn19',\n    )\n\n    const resultPromise = agent.didManagerRemoveKey({\n      did: identifier.did,\n      kid: 'did3-test3',\n      options: { anchor: false },\n    })\n    try {\n      expect(await resultPromise).toMatchObject({})\n    } catch (error) {\n      await expect(error.message).toMatch('An operation request already exists in queue for DID')\n    }\n  })\n\n  it('should remove service', async () => {\n    // This DID is known in ION, hence no anchoring\n    const identifier: IIdentifier = await agent.didManagerCreate(\n      existingDidConfig(false, 'did3-test3', PRIVATE_DID3_KEY_HEX),\n    )\n    expect(identifier.alias).toEqual('did:ion:EiCkiD0CYfwNWupjNPycPi7WbTbMpDgt8KzVHboaUoitdw')\n    expect(identifier.did).toEqual(\n      'did:ion:EiCkiD0CYfwNWupjNPycPi7WbTbMpDgt8KzVHboaUoitdw:eyJkZWx0YSI6eyJwYXRjaGVzIjpbeyJhY3Rpb24iOiJyZXBsYWNlIiwiZG9jdW1lbnQiOnsicHVibGljS2V5cyI6W3siaWQiOiJkaWQzLXRlc3QzIiwicHVibGljS2V5SndrIjp7ImNydiI6InNlY3AyNTZrMSIsImt0eSI6IkVDIiwieCI6IktYYXp6U21PUzBvQWo4VEd4a3VnaS1QTzFxYWwyREJJemNWcUV6MjRzYkEiLCJ5IjoiQnVTaDJDVFQ2SV9IRmtVaXhaTkkwemstNjNvZEVKR1E5NkZ4RWxvZG1XayJ9LCJwdXJwb3NlcyI6WyJhdXRoZW50aWNhdGlvbiIsImFzc2VydGlvbk1ldGhvZCJdLCJ0eXBlIjoiRWNkc2FTZWNwMjU2azFWZXJpZmljYXRpb25LZXkyMDE5In1dfX1dLCJ1cGRhdGVDb21taXRtZW50IjoiRWlCenA3WWhOOW1oVWNac0ZkeG5mLWx3a1JVLWhWYkJ0WldzVm9KSFY2amt3QSJ9LCJzdWZmaXhEYXRhIjp7ImRlbHRhSGFzaCI6IkVpQ1N6N0FxV2FyWk5ISmV3ZTR5ZUsxMkxVdHBfNmpaVXhzNzY5ZkZfcXZ1aWciLCJyZWNvdmVyeUNvbW1pdG1lbnQiOiJFaURBUVhTaTdIY2pKVkJZQUtkTzJ6ck00SGZ5Ym1CQkNXc2w2UFFQSl9qa2xBIn19',\n    )\n\n    const service: IService = {\n      type: 'LinkedDomains',\n      id: 'remove-test',\n      serviceEndpoint: 'https://test-example.com',\n    }\n\n    const addPromise = agent.didManagerAddService({\n      did: identifier.did,\n      service,\n      options: { anchor: false },\n    })\n    try {\n      expect(await addPromise).toMatchObject({})\n    } catch (error) {\n      await expect(error.message).toMatch('An operation request already exists in queue for DID')\n    }\n\n    const removePromise = agent.didManagerRemoveService({\n      did: identifier.did,\n      id: 'remove-test',\n      options: { anchor: false },\n    })\n    try {\n      expect(await removePromise).toMatchObject({})\n    } catch (error) {\n      await expect(error.message).toMatch('An operation request already exists in queue for DID')\n    }\n  })\n\n  // this fails with TypeError: Failed to parse URL from\n  // .../veramo/node_modules/.pnpm/argon2-browser@1.18.0/node_modules/argon2-browser/dist/argon2.wasm\n  it('should remove identifier', async () => {\n    const identifier: IIdentifier = await agent.didManagerCreate(\n      existingDidConfig(false, 'remove-test', PRIVATE_DID4_KEY_HEX),\n    )\n\n    expect(identifier).toBeDefined()\n\n    const deletePromise = agent.didManagerDelete({ did: identifier.did, options: { anchor: false } })\n    try {\n      expect(await deletePromise).toBeTruthy()\n    } catch (error) {\n      await expect(error.message).toMatch('An operation request already exists in queue for DID')\n    }\n  })\n})\n\nfunction existingDidConfig(anchor: boolean = false, kid: string, privateDIDKeyHex: String) {\n  return {\n    options: {\n      anchor,\n      recoveryKey: {\n        kid: 'recovery-test2',\n        key: {\n          privateKeyHex: PRIVATE_RECOVERY_KEY_HEX,\n        },\n      },\n      updateKey: {\n        kid: 'update-test2',\n        key: {\n          privateKeyHex: PRIVATE_UPDATE_KEY_HEX,\n        },\n      },\n      verificationMethods: [\n        {\n          kid,\n          purposes: [IonPublicKeyPurpose.Authentication, IonPublicKeyPurpose.AssertionMethod],\n          key: {\n            privateKeyHex: privateDIDKeyHex,\n          },\n        },\n      ],\n    },\n  }\n}\n\nconst createIdentifierOpts = {\n  anchor: false,\n  recoveryKey: {\n    kid: 'recovery-test',\n  },\n  updateKey: {\n    kid: 'update-test',\n  },\n  verificationMethods: [\n    {\n      kid: 'did1-test',\n      purposes: [IonPublicKeyPurpose.Authentication, IonPublicKeyPurpose.AssertionMethod],\n    },\n    {\n      kid: 'did2-test',\n      purposes: [IonPublicKeyPurpose.KeyAgreement],\n    },\n  ],\n  services: [\n    {\n      id: 'bar',\n      type: 'LinkedDomains',\n      serviceEndpoint: 'https://bar.example.com',\n    },\n  ],\n}\n"
  },
  {
    "path": "packages/did-provider-ion/api-extractor.json",
    "content": "{\n  \"$schema\": \"https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json\",\n  \"apiReport\": {\n    \"enabled\": true,\n    \"reportFolder\": \"./api\",\n    \"reportTempFolder\": \"./api\"\n  },\n\n  \"docModel\": {\n    \"enabled\": true,\n    \"apiJsonFilePath\": \"./api/<unscopedPackageName>.api.json\"\n  },\n\n  \"dtsRollup\": {\n    \"enabled\": false\n  },\n  \"mainEntryPointFilePath\": \"<projectFolder>/build/index.d.ts\"\n}\n"
  },
  {
    "path": "packages/did-provider-ion/package.json",
    "content": "{\n  \"name\": \"@veramo/did-provider-ion\",\n  \"description\": \"Veramo ion-did based identity controller plugin.\",\n  \"version\": \"7.0.0\",\n  \"main\": \"build/index.js\",\n  \"exports\": \"./build/index.js\",\n  \"types\": \"build/index.d.ts\",\n  \"scripts\": {\n    \"build\": \"tsc\",\n    \"extract-api\": \"node ../cli/bin/veramo.js dev extract-api\"\n  },\n  \"dependencies\": {\n    \"@decentralized-identity/ion-sdk\": \"^1.0.1\",\n    \"@noble/curves\": \"^1.4.2\",\n    \"@noble/hashes\": \"^1.4.0\",\n    \"@sphereon/ion-pow\": \"^0.2.0\",\n    \"@sphereon/isomorphic-argon2\": \"^1.0.1\",\n    \"@trust/keyto\": \"^1.0.1\",\n    \"@veramo/core-types\": \"workspace:^\",\n    \"@veramo/did-manager\": \"workspace:^\",\n    \"@veramo/key-manager\": \"workspace:^\",\n    \"@veramo/kms-local\": \"workspace:^\",\n    \"@veramo/utils\": \"workspace:^\",\n    \"canonicalize\": \"^2.0.0\",\n    \"cross-fetch\": \"^4.0.0\",\n    \"debug\": \"^4.3.3\",\n    \"did-resolver\": \"^4.1.0\",\n    \"ethers\": \"^6.13.4\",\n    \"multihashes\": \"^4.0.3\"\n  },\n  \"devDependencies\": {\n    \"@types/debug\": \"4.1.8\",\n    \"typescript\": \"5.7.3\"\n  },\n  \"peerDependencies\": {\n    \"@sphereon/react-native-argon2\": \"^2.0.7\"\n  },\n  \"files\": [\n    \"build/**/*\",\n    \"src/**/*\",\n    \"README.md\",\n    \"LICENSE\"\n  ],\n  \"publishConfig\": {\n    \"access\": \"public\"\n  },\n  \"repository\": {\n    \"type\": \"git\",\n    \"url\": \"https://github.com/decentralized-identity/veramo.git\",\n    \"directory\": \"packages/did-provider-ion\"\n  },\n  \"author\": \"Sphereon <dev@sphereon.com>\",\n  \"contributors\": [\n    \"Consensys Mesh R&D <hello@veramo.io>\",\n    \"Simonas Karuzas <simonas.karuzas@mesh.xyz>\",\n    \"Mircea Nistor <mircea.nistor@mesh.xyz>\"\n  ],\n  \"keywords\": [\n    \"Veramo\",\n    \"ION\",\n    \"DID\",\n    \"veramo-plugin\",\n    \"did:ion\",\n    \"Sidetree\"\n  ],\n  \"license\": \"Apache-2.0\",\n  \"type\": \"module\",\n  \"moduleDirectories\": [\n    \"node_modules\",\n    \"src\"\n  ]\n}\n"
  },
  {
    "path": "packages/did-provider-ion/src/functions.ts",
    "content": "import {\n  IonKeyMetadata,\n  ISecp256k1PrivateKeyJwk,\n  ISecp256k1PublicKeyJwk,\n  KeyIdentifierRelation,\n  KeyType,\n} from './types/ion-provider-types.js'\nimport {\n  IonDid,\n  IonDocumentModel,\n  IonPublicKeyModel,\n  IonPublicKeyPurpose,\n  JwkEs256k,\n} from '@decentralized-identity/ion-sdk'\nimport { IKey, ManagedKeyInfo } from '@veramo/core-types'\nimport keyto from '@trust/keyto'\nimport { randomBytes, SigningKey } from 'ethers'\nimport { ed25519 } from '@noble/curves/ed25519'\nimport Debug from 'debug'\nimport { JsonCanonicalizer } from './json-canonicalizer.js'\nimport { MemoryPrivateKeyStore } from '@veramo/key-manager'\nimport { KeyManagementSystem } from '@veramo/kms-local'\nimport { sha256 } from '@noble/hashes/sha256'\nimport multihashes from 'multihashes'\nimport { bytesToBase64url, bytesToHex, concat, hexToBytes, stringToUtf8Bytes } from '@veramo/utils'\n\nconst debug = Debug('veramo:did-provider-ion')\n\nconst MULTI_HASH_SHA256_LITERAL = 18\n\n/**\n * Ensures we only return Jwk properties that ION can handle\n *\n * @param jwk The input JWK\n * @return The sanitized JWK\n */\nexport const toJwkEs256k = (jwk: any): JwkEs256k => {\n  if (jwk.d) {\n    return { kty: jwk.kty, crv: jwk.crv, x: jwk.x, y: jwk.y, d: jwk.d }\n  } else {\n    return { kty: jwk.kty, crv: jwk.crv, x: jwk.x, y: jwk.y }\n  }\n}\n\n/**\n * Create a JWK from a hex private Key\n * @param privateKeyHex The private key in hex form\n * @return The JWK\n */\nexport const toIonPrivateKeyJwk = (privateKeyHex: string): JwkEs256k => {\n  return toJwkEs256k(privateKeyJwkFromPrivateKeyHex(privateKeyHex))\n}\n\n/**\n * Create a JWK from a hex public Key\n * @param privateKeyHex The public key in hex form\n * @return The JWK\n */\nexport const toIonPublicKeyJwk = (publicKeyHex: string): JwkEs256k => {\n  return toJwkEs256k(publicKeyJwkFromPublicKeyHex(publicKeyHex))\n}\n\n/**\n * Example\n * ```js\n * {\n *  kty: 'EC',\n *  crv: 'secp256k1',\n *  d: 'rhYFsBPF9q3-uZThy7B3c4LDF_8wnozFUAEm5LLC4Zw',\n *  x: 'dWCvM4fTdeM0KmloF57zxtBPXTOythHPMm1HCLrdd3A',\n *  y: '36uMVGM7hnw-N6GnjFcihWE3SkrhMLzzLCdPMXPEXlA',\n *  kid: 'JUvpllMEYUZ2joO59UNui_XYDqxVqiFLLAJ8klWuPBw'\n * }\n * ```\n * See [rfc7638](https://tools.ietf.org/html/rfc7638) for more details on Jwk.\n */\nexport const getKid = (jwk: ISecp256k1PrivateKeyJwk | ISecp256k1PublicKeyJwk) => {\n  const copy = { ...jwk } as any\n  delete copy.d\n  delete copy.kid\n  delete copy.alg\n  const digest = sha256(stringToUtf8Bytes(JsonCanonicalizer.asString(copy)))\n  return bytesToBase64url(digest)\n}\n\n/** convert compressed hex encoded private key to jwk */\nconst privateKeyJwkFromPrivateKeyHex = (privateKeyHex: string) => {\n  const jwk = {\n    ...keyto.from(privateKeyHex, 'blk').toJwk('private'),\n    crv: 'secp256k1',\n  }\n  const kid = getKid(jwk)\n  return {\n    ...jwk,\n    kid,\n  }\n}\n\n/** convert compressed hex encoded public key to jwk */\nconst publicKeyJwkFromPublicKeyHex = (publicKeyHex: string) => {\n  let key = publicKeyHex\n  const compressedHexEncodedPublicKeyLength = 66\n  if (publicKeyHex.length === compressedHexEncodedPublicKeyLength) {\n    const publicBytes = hexToBytes(publicKeyHex)\n    key = SigningKey.computePublicKey(publicBytes, true).substring(2)\n  }\n  const jwk = {\n    ...keyto.from(key, 'blk').toJwk('public'),\n    crv: 'secp256k1',\n  }\n  const kid = getKid(jwk)\n\n  return {\n    ...jwk,\n    kid,\n  }\n}\n\n/**\n * Computes the ION Commitment value from a ION public key\n *\n * @param ionKey The ion public key\n * @return The ION commitment value\n */\nexport const computeCommitmentFromIonPublicKey = (ionKey: IonPublicKeyModel): string => {\n  return computeCommitmentFromJwk(toJwkEs256k(ionKey.publicKeyJwk))\n}\n\n/**\n * Computes the ION Commitment from a JWK\n *\n * @param jwk The JWK to computate the commitment for\n */\nexport const computeCommitmentFromJwk = (jwk: JwkEs256k): string => {\n  const data = JsonCanonicalizer.asString(jwk)\n  debug(`canonicalized JWK: ${data}`)\n  const singleHash = sha256(stringToUtf8Bytes(data))\n  const doubleHash = sha256(singleHash)\n\n  const multiHash = multihashes.encode(doubleHash, MULTI_HASH_SHA256_LITERAL)\n  const commitment = bytesToBase64url(multiHash)\n  debug(`commitment: ${commitment}`)\n  return commitment\n}\n\n/**\n * Get the action timestamp if present. Use current date/timestamp otherwise\n * @param timestamp An optional provided timestamp, useful only in case a key needs to be inserted in between other keys\n * @return The action timestamp\n */\nexport const getActionTimestamp = (timestamp = Date.now()): number => {\n  return timestamp\n}\n\n/**\n * Gets a specific recovery key matching the commitment value, typically coming from a DID document, or the latest\n * recovery key in case it is not provided\n *\n * @param keys The actual keys related to an identifier\n * @param commitment An optional commitment value to match the recovery key against. Typically comes from a DID\n *   Document\n * @return The ION Recovery Public Key\n */\nexport const getVeramoRecoveryKey = (keys: IKey[], commitment?: string): IKey => {\n  const typedKeys = veramoKeysOfType(keys, KeyIdentifierRelation.RECOVERY, commitment)\n  return commitment === 'genesis' ? typedKeys[0] : typedKeys[typedKeys.length - 1]\n}\n\n/**\n * Gets a specific update key matching the commitment value, typically coming from a DID document, or the latest update\n * key in case it is not provided\n *\n * @param keys The actual keys related to an identifier\n * @param commitment An optional commitment value to match the update key against. Typically comes from a DID Document\n * @return The Veramo Update Key\n */\nexport const getVeramoUpdateKey = (keys: IKey[], commitment?: string): IKey => {\n  const typedKeys = veramoKeysOfType(keys, KeyIdentifierRelation.UPDATE, commitment)\n  return commitment === 'genesis' ? typedKeys[0] : typedKeys[typedKeys.length - 1]\n}\n\n/**\n * Get the Ion Public keys from Veramo which have a specific relation type. If the commitment value is set the Key\n * belonging to that value will be returned, otherwise the latest key\n * @param keys The Veramo Keys to inspect\n * @param relation The Key relation ship type\n * @param commitment An optional commitment value, typically coming from a DID Document. The value 'genisis' returns\n *   the first key found\n */\nexport const ionKeysOfType = (\n  keys: IKey[],\n  relation: KeyIdentifierRelation,\n  commitment?: string,\n): IonPublicKeyModel[] => {\n  return veramoKeysOfType(keys, relation, commitment).flatMap((key) => {\n    return toIonPublicKey(key)\n  })\n}\n\n/**\n * Get the Veramo keys which have a specific relation type. If the commitment value is set the Key belonging to that\n * value will be returned, otherwise the latest key\n * @param keys The Veramo Keys to inspect\n * @param relation The Key relation ship type\n * @param commitment An optional commitment value, typically coming from a DID Document. The value 'genisis' returns\n *   the first key found\n */\nexport const veramoKeysOfType = (\n  keys: IKey[],\n  relation: KeyIdentifierRelation,\n  commitment?: string,\n): IKey[] => {\n  return keys\n    .sort((key1, key2) => {\n      const opId1 = key1.meta?.ion?.operationId\n      const opId2 = key2.meta?.ion?.operationId\n      return !opId1 ? 1 : !opId2 ? -1 : opId1 - opId2\n    })\n    .filter(\n      (key) =>\n        !commitment ||\n        commitment === 'genesis' ||\n        !key.meta?.ion.commitment ||\n        key.meta?.ion.commitment === commitment,\n    )\n    .filter((key) => key.meta?.ion.relation === relation)\n    .flatMap((keys) => keys)\n}\n\n/**\n * Ion/Sidetree only supports kid with a maximum length of 50 characters. This method truncates longer keys when create\n * ION requests\n *\n * @param kid The Veramo kid\n * @return A truncated kid if the input kid contained more than 50 characters\n */\nexport const truncateKidIfNeeded = (kid: string): string => {\n  const id = kid.substring(0, 50) // ION restricts the id to 50 chars. Ideally we can also provide kids for key\n  // creation in Veramo\n  if (id.length != kid.length) {\n    debug(`Key kid ${kid} has been truncated to 50 chars to support ION!`)\n  }\n  return id\n}\n\n/**\n * Creates an Ion Public Key (Verification Method), used in ION request from a Veramo Key\n * @param key The Veramo Key\n * @param createKeyPurposes The verification relationships (Sidetree calls them purposes) to explicitly set. Used\n *   during key creation\n * @return An Ion Public Key which can be used in Ion request objects\n */\nexport const toIonPublicKey = (\n  key: ManagedKeyInfo,\n  createKeyPurposes?: IonPublicKeyPurpose[],\n): IonPublicKeyModel => {\n  const purposes: IonPublicKeyPurpose[] = createKeyPurposes\n    ? createKeyPurposes\n    : key.meta?.ion?.purposes\n    ? key.meta.ion.purposes\n    : []\n  const publicKeyJwk = toIonPublicKeyJwk(key.publicKeyHex)\n  const id = truncateKidIfNeeded(key.kid)\n\n  return {\n    id,\n    type: 'EcdsaSecp256k1VerificationKey2019',\n    publicKeyJwk,\n    purposes,\n  }\n}\n\n/**\n * Generates a random Private Hex Key for the specified key type\n * @param type The key type\n * @return The private key in Hex form\n */\nexport const generatePrivateKeyHex = (type: KeyType): string => {\n  let privateKeyHex: string\n\n  switch (type) {\n    case KeyType.Ed25519: {\n      // @noble/curves doesn't precompute the public key\n      const secretKey = ed25519.utils.randomPrivateKey()\n      const publicKey = ed25519.utils.getExtendedPublicKey(secretKey.subarray(0, 32)).pointBytes\n      privateKeyHex = bytesToHex(concat([secretKey, publicKey]))\n      break\n    }\n    case KeyType.Secp256k1: {\n      const privateBytes = randomBytes(32)\n      privateKeyHex = bytesToHex(privateBytes)\n      break\n    }\n    default:\n      throw Error('not_supported: Key type not supported: ' + type)\n  }\n  return privateKeyHex\n}\n\n/**\n * Create a Veramo Key entirely in Memory. It is not stored\n *\n * Didn't want to recreate the logic to extract the pub key for the different key types\n * So let's create a temp in-mem kms to do it for us\n *\n * @param type\n * @param privateKeyHex\n * @param kid\n * @param kms\n * @param ionMeta\n */\nexport const tempMemoryKey = async (\n  type: KeyType.Ed25519 | KeyType.Secp256k1 | KeyType,\n  privateKeyHex: string,\n  kid: string,\n  kms: string,\n  ionMeta: IonKeyMetadata,\n): Promise<IKey> => {\n  const tmpKey = (await new KeyManagementSystem(new MemoryPrivateKeyStore()).importKey({\n    type,\n    privateKeyHex,\n    kid,\n  })) as IKey\n  tmpKey.meta!.ion = JSON.parse(JSON.stringify(ionMeta))\n  tmpKey.meta!.ion.commitment = computeCommitmentFromJwk(toIonPublicKeyJwk(tmpKey.publicKeyHex))\n  tmpKey.kms = kms\n  // tmpKey.privateKeyHex = privateKeyHex\n  return tmpKey\n}\n\n/**\n * Generate a deterministic Ion Long form DID from the creation keys\n *\n * @param input The creation keys\n * @return The Ion Long form DID\n */\nexport const ionLongFormDidFromCreation = async (input: {\n  recoveryKey: JwkEs256k\n  updateKey: JwkEs256k\n  document: IonDocumentModel\n}): Promise<string> => {\n  return await IonDid.createLongFormDid(input)\n}\n\n/**\n * Generate a deterministic Ion Short form DID from the creation keys\n *\n * @param input The creation keys\n * @return The Ion Short form DID\n */\nexport const ionShortFormDidFromCreation = async (input: {\n  recoveryKey: JwkEs256k\n  updateKey: JwkEs256k\n  document: IonDocumentModel\n}): Promise<string> => {\n  return ionShortFormDidFromLong(await ionLongFormDidFromCreation(input))\n}\n\n/**\n * Convert an Ion Long form DID into a short form DID. Be aware that the input really needs to be a long Form DID!\n * @param longFormDid The Ion Long form DID\n * @return An Ion Short form DID\n */\nexport const ionShortFormDidFromLong = (longFormDid: string): string => {\n  // Only call this from a long form DID!\n\n  // todo: Add min length check\n  return longFormDid.split(':').slice(0, -1).join(':')\n}\n\n/**\n * Gets the method specific Short form Id from the Long form DID. So the did: prefix and Ion Long Form suffix have been\n * removed\n * @param longFormDid The Ion Long form DID\n * @return The Short form method specific Id\n */\nexport const ionDidSuffixFromLong = (longFormDid: string): string => {\n  return ionDidSuffixFromShort(ionShortFormDidFromLong(longFormDid))\n}\n\n/**\n * Gets the method specific Short form Id from the Short form DID. So the did: prefix has been removed\n * @param shortFormDid The Ion Short form DID\n * @return The Short form method specific Id\n */\nexport const ionDidSuffixFromShort = (shortFormDid: string): string => {\n  const suffix = shortFormDid.split(':').pop()\n  if (!suffix) {\n    throw new Error(`Could not extract ion DID suffix from short form DID ${shortFormDid}`)\n  }\n  return suffix\n}\n"
  },
  {
    "path": "packages/did-provider-ion/src/index.ts",
    "content": "/**\n * Provides `did:ion` {@link @veramo/did-provider-ion#IonDIDProvider | identifier provider }\n * for the {@link @veramo/did-manager#DIDManager}\n *\n * @packageDocumentation\n */\nexport { IonDIDProvider } from './ion-did-provider.js'\nexport { getDidIonResolver } from './ion-did-resolver.js'\n"
  },
  {
    "path": "packages/did-provider-ion/src/ion-did-provider.ts",
    "content": "import {\n  DIDResolutionResult,\n  IAgentContext,\n  IIdentifier,\n  IKey,\n  IKeyManager,\n  IService,\n  ManagedKeyInfo,\n} from '@veramo/core-types'\nimport { AbstractIdentifierProvider } from '@veramo/did-manager'\n\nimport Debug from 'debug'\nimport {\n  IAddKeyOpts,\n  IContext,\n  ICreateIdentifierOpts,\n  IKeyRotation,\n  IonDidForm,\n  IonKeyMetadata,\n  IUpdateOpts,\n  KeyIdentifierRelation,\n  KeyOpts,\n  KeyType,\n  VerificationMethod,\n} from './types/ion-provider-types.js'\n\nimport { IonSigner } from './ion-signer.js'\nimport { resolveDidIonFromIdentifier } from './ion-did-resolver.js'\n\nimport { IonPublicKeyModel, IonPublicKeyPurpose, IonRequest } from '@decentralized-identity/ion-sdk'\nimport {\n  computeCommitmentFromIonPublicKey,\n  generatePrivateKeyHex,\n  getActionTimestamp,\n  getVeramoRecoveryKey,\n  getVeramoUpdateKey,\n  ionDidSuffixFromLong,\n  ionLongFormDidFromCreation,\n  ionShortFormDidFromLong,\n  tempMemoryKey,\n  toIonPublicKey,\n  toIonPublicKeyJwk,\n  toJwkEs256k,\n  truncateKidIfNeeded,\n} from './functions.js'\nimport { IonPoW } from '@sphereon/ion-pow'\n\nconst debug = Debug('veramo:ion-did-provider')\n\n/**\n * {@link @veramo/did-manager#DIDManager} identifier provider for `did:ion` identifiers\n * @public\n */\nexport class IonDIDProvider extends AbstractIdentifierProvider {\n  private readonly defaultKms: string\n  private readonly ionPoW: IonPoW\n\n  constructor(options: {\n    defaultKms: string\n    challengeEnabled?: boolean\n    challengeEndpoint?: string\n    solutionEndpoint?: string\n  }) {\n    super()\n    this.defaultKms = options.defaultKms\n    const challengeEnabled = options?.challengeEnabled === undefined ? true : options.challengeEnabled\n    const challengeEndpoint = options?.challengeEndpoint\n    const solutionEndpoint = options?.solutionEndpoint\n    this.ionPoW = new IonPoW({ challengeEnabled, challengeEndpoint, solutionEndpoint })\n  }\n\n  /** {@inheritDoc @veramo/core-types#IDIDManager.didManagerCreate} */\n  async createIdentifier(\n    { kms, options, alias }: { kms?: string; alias?: string; options?: ICreateIdentifierOpts },\n    context: IAgentContext<IKeyManager>,\n  ): Promise<Omit<IIdentifier, 'provider'>> {\n    const actionTimestamp = getActionTimestamp(options?.actionTimestamp)\n\n    const recoveryKey = await this.importProvidedOrGeneratedKey(\n      {\n        kms,\n        actionTimestamp: actionTimestamp,\n        relation: KeyIdentifierRelation.RECOVERY,\n        options: options?.recoveryKey,\n      },\n      context,\n    )\n    const updateKey = await this.importProvidedOrGeneratedKey(\n      {\n        kms,\n        actionTimestamp: actionTimestamp,\n        relation: KeyIdentifierRelation.UPDATE,\n        options: options?.updateKey,\n      },\n      context,\n    )\n\n    // No options or no verification method options, results in us generating a single key as the only authentication verification method in the DID\n    const verificationMethods = options?.verificationMethods\n      ? options.verificationMethods\n      : [\n          {\n            type: KeyType.Secp256k1,\n            purposes: [IonPublicKeyPurpose.Authentication],\n          },\n        ]\n\n    const veramoKeys: ManagedKeyInfo[] = [recoveryKey, updateKey]\n    const ionPublicKeys: IonPublicKeyModel[] = []\n    for (const verificationMethod of verificationMethods) {\n      const key = await this.importProvidedOrGeneratedKey(\n        {\n          kms,\n          actionTimestamp: actionTimestamp,\n          relation: KeyIdentifierRelation.DID,\n          options: verificationMethod,\n        },\n        context,\n      )\n      veramoKeys.push(key)\n      ionPublicKeys.push(toIonPublicKey(key, verificationMethod.purposes))\n    }\n\n    const services = options?.services ? options.services : undefined\n\n    const createRequest = {\n      recoveryKey: toIonPublicKeyJwk(recoveryKey.publicKeyHex),\n      updateKey: toIonPublicKeyJwk(updateKey.publicKeyHex),\n      document: {\n        publicKeys: ionPublicKeys,\n        services,\n      },\n    }\n    const longFormDid = await ionLongFormDidFromCreation(createRequest)\n    const shortFormDid = ionShortFormDidFromLong(longFormDid)\n\n    const request = await IonRequest.createCreateRequest(createRequest)\n    await this.anchorRequest(request, options?.anchor)\n\n    const identifier: Omit<IIdentifier, 'provider'> = {\n      did: longFormDid,\n      controllerKeyId: updateKey.kid,\n      alias: shortFormDid,\n      keys: veramoKeys,\n      services: services ? services : [],\n    }\n\n    debug('Created DID (short, long form): ', identifier.alias, identifier.did)\n    return identifier\n  }\n\n  async updateIdentifier(\n    args: { did: string; kms?: string | undefined; alias?: string | undefined; options?: any },\n    context: IAgentContext<IKeyManager>,\n  ): Promise<IIdentifier> {\n    throw new Error('IonDIDProvider updateIdentifier not supported yet.')\n  }\n\n  /** {@inheritDoc @veramo/core-types#IDIDManager.didManagerDelete} */\n  async deleteIdentifier(identifier: IIdentifier, context: IContext): Promise<boolean> {\n    const didResolution = await this.getAssertedDidDocument(identifier, IonDidForm.LONG)\n    const recoveryKey = getVeramoRecoveryKey(\n      identifier.keys,\n      didResolution.didDocumentMetadata.method.recoveryCommitment,\n    )\n    const request = await IonRequest.createDeactivateRequest({\n      didSuffix: ionDidSuffixFromLong(identifier.did),\n      recoveryPublicKey: toJwkEs256k(toIonPublicKeyJwk(recoveryKey.publicKeyHex)),\n      signer: new IonSigner(context, recoveryKey.kid),\n    })\n\n    await this.anchorRequest(request, true)\n\n    return true\n  }\n\n  /** {@inheritDoc @veramo/core-types#IDIDManager.didManagerAddKey} */\n  async addKey(\n    { identifier, key, options }: { identifier: IIdentifier; key: IKey; options?: IAddKeyOpts },\n    context: IContext,\n  ): Promise<any> {\n    if (!options) {\n      throw Error('Add key needs options, since we need to know the purpose(s) of the key')\n    }\n    const rotation = await this.rotateVeramoKey({ identifier, options, kms: key.kms, context })\n\n    const request = await IonRequest.createUpdateRequest({\n      didSuffix: ionDidSuffixFromLong(identifier.did),\n      updatePublicKey: rotation.currentJwk,\n      nextUpdatePublicKey: rotation.nextJwk,\n      signer: new IonSigner(context, rotation.currentVeramoKey.kid),\n      publicKeysToAdd: [\n        {\n          ...toIonPublicKey(key, options.purposes),\n        },\n      ],\n    })\n\n    try {\n      await this.anchorRequest(request, options.anchor)\n      return request\n    } catch (error) {\n      // It would have been nicer if we hadn't stored the new update key yet\n      await this.deleteKeyOnError(rotation.nextVeramoKey.kid, context)\n      throw error\n    }\n  }\n\n  /** {@inheritDoc @veramo/core-types#IDIDManager.didManagerAddService} */\n  async addService(\n    { identifier, service, options }: { identifier: IIdentifier; service: IService; options?: IUpdateOpts },\n    context: IContext,\n  ): Promise<any> {\n    const rotation = await this.rotateVeramoKey({ identifier, options, context })\n\n    const request = await IonRequest.createUpdateRequest({\n      didSuffix: ionDidSuffixFromLong(identifier.did),\n      updatePublicKey: rotation.currentJwk,\n      nextUpdatePublicKey: rotation.nextJwk,\n      signer: new IonSigner(context, rotation.currentVeramoKey.kid),\n      servicesToAdd: [\n        {\n          ...service,\n        },\n      ],\n    })\n\n    try {\n      await this.anchorRequest(request, options?.anchor)\n      return request\n    } catch (error) {\n      // It would have been nicer if we hadn't stored the new update key yet\n      await this.deleteKeyOnError(rotation.nextVeramoKey.kid, context)\n      throw error\n    }\n  }\n\n  /** {@inheritDoc @veramo/core-types#IDIDManager.didManagerRemoveKey} */\n  async removeKey(\n    { identifier, kid, options }: { identifier: IIdentifier; kid: string; options?: IUpdateOpts },\n    context: IContext,\n  ): Promise<any> {\n    const rotation = await this.rotateVeramoKey({ identifier, options, context })\n\n    const request = await IonRequest.createUpdateRequest({\n      didSuffix: ionDidSuffixFromLong(identifier.did),\n      updatePublicKey: rotation.currentJwk,\n      nextUpdatePublicKey: rotation.nextJwk,\n      signer: new IonSigner(context, rotation.currentVeramoKey.kid),\n      idsOfPublicKeysToRemove: [truncateKidIfNeeded(kid)],\n    })\n\n    try {\n      await this.anchorRequest(request, options?.anchor)\n      return request\n    } catch (error) {\n      // It would have been nicer if we hadn't stored the new update key yet\n      await this.deleteKeyOnError(rotation.nextVeramoKey.kid, context)\n      throw error\n    }\n  }\n\n  /** {@inheritDoc @veramo/core-types#IDIDManager.didManagerRemoveService} */\n  async removeService(\n    { identifier, id, options }: { identifier: IIdentifier; id: string; options?: IUpdateOpts },\n    context: IContext,\n  ): Promise<any> {\n    const rotation = await this.rotateVeramoKey({ identifier, options, context })\n\n    const request = await IonRequest.createUpdateRequest({\n      didSuffix: ionDidSuffixFromLong(identifier.did),\n      updatePublicKey: rotation.currentJwk,\n      nextUpdatePublicKey: rotation.nextJwk,\n      signer: new IonSigner(context, rotation.currentVeramoKey.kid),\n      idsOfServicesToRemove: [truncateKidIfNeeded(id)],\n    })\n\n    try {\n      await this.anchorRequest(request, options?.anchor)\n      return request\n    } catch (error) {\n      // It would have been nicer if we hadn't stored the new update key yet\n      await this.deleteKeyOnError(rotation.nextVeramoKey.kid, context)\n      throw error\n    }\n  }\n\n  /**\n   * Gets as DID document from the identifier in either short or long form\n   *\n   * @param identifier - The Identifier (DID) to use\n   * @param didForm - Use short or long form (the default) for resolution\n   * @returns - A DID Document promise\n   */\n  private async getAssertedDidDocument(\n    identifier: IIdentifier,\n    didForm: IonDidForm = IonDidForm.LONG,\n  ): Promise<DIDResolutionResult> {\n    const didDocument = await resolveDidIonFromIdentifier(identifier, didForm)\n    if (!didDocument) {\n      return Promise.reject(Error(`Could not resolve existing DID document for did ${identifier.did}`))\n    }\n    return didDocument\n  }\n\n  /**\n   * Rotate an update or recovery key. Meaning a new key will be generated, which will be used from that moment on for recoveries or updates.\n   * It returns an object which is used internally to get access to current en next update/recovery keys, which are transformed in different types (Veramo, JWK, ION Public Key)\n   *\n   * @param identifier - The identifier (DID) for which to update the recovery/update key\n   * @param commitment - The current commitment value for either the update or recovery key from the DID document\n   * @param relation - Whether it is an update key or a recovery key\n   * @param kms - The KMS to use\n   * @param options - Allows to set a kid for the new key or to import a key for the new update/recovery key\n   * @param actionTimestamp - The action Timestamp. These are used to order keys in chronological order. Normally you will want to use Date.now() for these\n   * @param context - The Veramo Agent context\n   */\n  private async rotateUpdateOrRecoveryKey(\n    {\n      identifier,\n      commitment,\n      relation,\n      kms,\n      options,\n      actionTimestamp,\n    }: {\n      identifier: IIdentifier\n      commitment: string\n      actionTimestamp: number\n      relation: KeyIdentifierRelation\n      kms?: string\n      alias?: string\n      options?: KeyOpts\n    },\n    context: IAgentContext<IKeyManager>,\n  ): Promise<IKeyRotation> {\n    const currentVeramoKey =\n      relation == KeyIdentifierRelation.UPDATE\n        ? getVeramoUpdateKey(identifier.keys, commitment)\n        : getVeramoRecoveryKey(identifier.keys, commitment)\n    const currentIonKey = toIonPublicKey(currentVeramoKey)\n    const currentJwk = toIonPublicKeyJwk(currentVeramoKey.publicKeyHex)\n    //todo alias?\n    const nextVeramoKey = await this.importProvidedOrGeneratedKey(\n      {\n        kms,\n        actionTimestamp: actionTimestamp,\n        relation,\n        options,\n      },\n      context,\n    )\n    const nextIonKey = toIonPublicKey(nextVeramoKey)\n    const nextJwk = toIonPublicKeyJwk(nextVeramoKey.publicKeyHex)\n\n    return { currentIonKey, currentVeramoKey, currentJwk, nextJwk, nextIonKey, nextVeramoKey }\n  }\n\n  /**\n   * Rotates an actual update/recovery key in Veramo\n   *\n   * @param kms - The KMS to use\n   * @param context - The Veramo agent context\n   * @param options - options Allows to set a kid for the new key or to import a key for the new update/recovery key\n   * @param identifier - The identifier (DID) for which to update the recovery/update key\n   */\n  private async rotateVeramoKey({\n    kms,\n    context,\n    options,\n    identifier,\n  }: {\n    identifier: IIdentifier\n    options?: IUpdateOpts\n    kms?: string\n    context: IContext\n  }) {\n    const didResolution = await this.getAssertedDidDocument(identifier, IonDidForm.LONG)\n    const currentUpdateKey = getVeramoUpdateKey(\n      identifier.keys,\n      didResolution.didDocumentMetadata.method.updateCommitment,\n    )\n    const commitment = computeCommitmentFromIonPublicKey(toIonPublicKey(currentUpdateKey))\n    const actionId = getActionTimestamp(options?.actionTimestamp)\n\n    const rotation = await this.rotateUpdateOrRecoveryKey(\n      {\n        identifier,\n        commitment,\n        relation: KeyIdentifierRelation.UPDATE,\n        actionTimestamp: actionId,\n        kms: kms ? kms : this.defaultKms,\n        options: {},\n      },\n      context,\n    )\n    return rotation\n  }\n\n  /**\n   * We optionally generate and then import our own keys.\n   *\n   * Reason for this is that we want to be able to assign Key IDs (kid), which Veramo supports on import, but not creation. The net result is that we do not support keys which have been created from keyManagerCreate\n   *\n   * @param kms - The KMS to use\n   * @param actionTimestamp - The action Timestamp. These are used to order keys in chronological order. Normally you will want to use Date.now() for these\n   * @param relation - Whether it is a DID Verification Method key, an update key or a recovery key\n   * @param options - Allows to set a kid for the new key or to import a key for the new update/recovery key\n   * @param context - The Veramo agent context\n   */\n  private async importProvidedOrGeneratedKey(\n    {\n      kms,\n      actionTimestamp,\n      relation,\n      options,\n    }: {\n      kms?: string\n      actionTimestamp: number\n      relation: KeyIdentifierRelation\n      options?: KeyOpts | VerificationMethod\n    },\n    context: IAgentContext<IKeyManager>,\n  ): Promise<IKey> {\n    const kid = options?.kid ? options.kid : options?.key?.kid\n    const type = options?.type\n      ? options.type\n      : options?.key?.type\n      ? (options.key.type as KeyType)\n      : KeyType.Secp256k1\n\n    const meta = options?.key?.meta ? options.key.meta : {}\n    const ionMeta: IonKeyMetadata = {\n      relation,\n      actionTimestamp: actionTimestamp,\n    }\n    if (options && 'purposes' in options) {\n      ionMeta.purposes = options.purposes\n    }\n    let privateKeyHex: string\n    if (options?.key) {\n      if (!options.key.privateKeyHex) {\n        throw new Error(\n          `We need to have a private key when importing a recovery or update key. Key ${kid} did not have one`,\n        )\n      }\n      privateKeyHex = options.key.privateKeyHex\n    } else {\n      privateKeyHex = generatePrivateKeyHex(type)\n    }\n    if (relation === KeyIdentifierRelation.RECOVERY || relation === KeyIdentifierRelation.UPDATE) {\n      // We need a commitment for these keys. As they are based on the publicKey let's create an in mem key\n      const tmpKey = await tempMemoryKey(type, privateKeyHex, kid!, kms ? kms : this.defaultKms, ionMeta)\n      ionMeta.commitment = tmpKey.meta!.ion.commitment\n    }\n    meta.ion = ionMeta\n\n    const key: IKey = await context.agent.keyManagerImport({\n      kms: kms || this.defaultKms,\n      type,\n      privateKeyHex,\n      kid,\n      meta,\n    })\n    // We need it in case we are importing it again in the same call\n    // key.privateKeyHex = privateKeyHex\n\n    debug('Created key', type, relation, kid, key.publicKeyHex)\n\n    return key\n  }\n\n  /**\n   * Whether to actually anchor the request on the ION network\n   *\n   * @param request - The ION request\n   * @param anchor - Whether to anchor or not (defaults to true)\n   * @returns - The anchor request\n   */\n  private async anchorRequest(request: IonRequest, anchor?: boolean) {\n    if (anchor !== false) {\n      await this.ionPoW.submit(JSON.stringify(request))\n    } else {\n      debug(`Not anchoring as anchoring was not enabled`)\n    }\n  }\n\n  /**\n   * Deletes a key (typically a rotation key) on error. As this happens in an exception flow, any issues with deletion are only debug logged.\n   *\n   * @param kid - the internal ID of the key being deleted\n   * @param context - the Veramo instance calling this method\n   */\n  private async deleteKeyOnError(kid: string, context: IAgentContext<IKeyManager>) {\n    try {\n      await context.agent.keyManagerDelete({ kid })\n    } catch (ignore) {\n      debug(ignore.message)\n    }\n  }\n}\n"
  },
  {
    "path": "packages/did-provider-ion/src/ion-did-resolver.ts",
    "content": "import { fetch } from 'cross-fetch'\nimport { IIdentifier } from '@veramo/core-types'\nimport { DIDResolutionOptions, DIDResolutionResult, DIDResolver } from 'did-resolver'\nimport { IonDidForm } from './types/ion-provider-types.js'\n\nexport const resolveDidIonFromIdentifier = async (\n  identifier: IIdentifier,\n  ionDidForm: IonDidForm = IonDidForm.LONG,\n  options?: DIDResolutionOptions\n): Promise<DIDResolutionResult> => {\n  return await resolve(ionDidForm == IonDidForm.LONG ? identifier.did : identifier.alias!, options)\n}\n\nexport const resolveDidIon: DIDResolver = async (didUrl: string, options?: DIDResolutionOptions): Promise<DIDResolutionResult> => {\n  return resolve(didUrl, options)\n}\n\nconst resolve = async (didUrl: string, options?: DIDResolutionOptions) => {\n  return fetch(\n    (options?.nodeEndpoint || 'https://beta.discover.did.microsoft.com/1.0/identifiers/') + didUrl,\n  ).then(async (response) => {\n    if (response.status >= 400) {\n      throw new Error(`Not Found:\\r\\n${didUrl}\\r\\n${JSON.stringify(await response.json())}`)\n    }\n    return response.json()\n  })\n}\n\n/**\n * @public\n */\nexport function getDidIonResolver() {\n  return { ion: resolveDidIon }\n}\n"
  },
  {
    "path": "packages/did-provider-ion/src/ion-signer.ts",
    "content": "import { IContext } from './types/ion-provider-types.js'\nimport { sha256 } from '@noble/hashes/sha256'\nimport { bytesToBase64url, bytesToHex, stringToUtf8Bytes } from '@veramo/utils'\n\n/**\n * This class is responsible for signing the JWT when sending in Anchor requests to an ION node. It is using the update\n * or recovery key denoted by 'kid'\n */\nexport class IonSigner {\n  private readonly kid: string\n\n  /**\n   * Construct the signer object\n   *\n   * @param context The agent context\n   * @param kid The Veramo update or recovery Key ID (kid)\n   */\n  constructor(private context: IContext, kid: string) {\n    this.kid = kid\n  }\n\n  /**\n   * Sign the JWT header and payload using the Key ID (kid) provided during construction.\n   *\n   * @param header The JWT header (only 'alg' supported for now)\n   * @param payload The ION update delta payload\n   */\n  async sign(header: any, payload: any): Promise<string> {\n    if (!header) {\n      header = {\n        alg: 'ES256K',\n      }\n    }\n    const encodedHeader = bytesToBase64url(stringToUtf8Bytes(JSON.stringify(header)))\n    const encodedPayload = bytesToBase64url(stringToUtf8Bytes(JSON.stringify(payload)))\n    const toBeSigned = `${encodedHeader}.${encodedPayload}`\n    const message = stringToUtf8Bytes(toBeSigned)\n    const digest = bytesToHex(sha256(message))\n    // The keyManagerSign already performs base64url encoding\n    const encodedSignature = await this.context.agent.keyManagerSign({\n      keyRef: this.kid,\n      algorithm: header.alg,\n      data: digest,\n      encoding: 'hex',\n    })\n    return `${encodedHeader}.${encodedPayload}.${encodedSignature}`\n  }\n}\n"
  },
  {
    "path": "packages/did-provider-ion/src/json-canonicalizer.ts",
    "content": "import canonicalize from 'canonicalize'\n/**\n * Class containing reusable JSON canonicalization operations using JSON Canonicalization Scheme (JCS).\n */\nexport class JsonCanonicalizer {\n  /**\n   * Canonicalizes the given content as a string\n   * @param The content to canonicalize\n   * @return The canonicalized content\n   */\n  static asString(content: unknown): string {\n    if (content == null) {\n      throw Error('Null content received in canonicalizer')\n    }\n    // We need to remove all properties with `undefined` as value so that JCS canonicalization will not produce invalid JSON.\n    const contentWithoutUndefinedProperties = JsonCanonicalizer.removeAllUndefinedProperties(content)\n    const canonicalizedString = canonicalize(contentWithoutUndefinedProperties)\n    if (!canonicalizedString) {\n      throw new Error('Could not canonicalize input')\n    }\n    return canonicalizedString\n  }\n  /**\n   * Removes all properties within the given object with `undefined` as value as that would mess up the validity\n   */\n  private static removeAllUndefinedProperties(content: any): unknown {\n    for (const key in content) {\n      if (typeof content[key] === 'object') {\n        JsonCanonicalizer.removeAllUndefinedProperties(content[key])\n      } else if (content[key] === undefined) {\n        delete content[key]\n      }\n    }\n    return content\n  }\n}\n"
  },
  {
    "path": "packages/did-provider-ion/src/types/@trust/keyto/index.d.ts",
    "content": "declare module '@trust/keyto'\n"
  },
  {
    "path": "packages/did-provider-ion/src/types/ion-provider-types.ts",
    "content": "import { IAgentContext, IKey, IKeyManager, IService, MinimalImportableKey } from '@veramo/core-types'\nimport { IonPublicKeyPurpose, IonPublicKeyModel, JwkEs256k } from '@decentralized-identity/ion-sdk'\n\nexport type IContext = IAgentContext<IKeyManager>\n\nexport interface VerificationMethod extends KeyOpts {\n  purposes: IonPublicKeyPurpose[] // In sidetree these are called purposes, but in DID-Core Verification Relationships\n}\n\nexport interface KeyOpts {\n  kid?: string // Key ID to assign in case we are importing a key\n  key?: MinimalImportableKey // Optional key to import. If not specified a key with random kid will be created\n  type?: KeyType // The key type. Defaults to Secp256k1\n}\n\nexport interface ICreateIdentifierOpts {\n  verificationMethods?: VerificationMethod[] // The Verification method to add\n  recoveryKey?: KeyOpts // Recovery key options\n  updateKey?: KeyOpts // Update key options\n  services?: IService[] // Service(s) to add\n  actionTimestamp?: number // Unique number denoting the action. Used for ordering internally. Suggested to use current timestamp\n  anchor?: boolean // Whether the DID should be anchored on ION or not. Handy for testing or importing an ID\n}\n\nexport interface IAddKeyOpts extends IUpdateOpts {\n  purposes: IonPublicKeyPurpose[] // In sidetree these are called purposes, but in DID-Core Verification Relationships\n}\n\nexport interface IUpdateOpts {\n  actionTimestamp?: number // Unique number denoting the action. Used for ordering internally. Suggested to use current timestamp\n  anchor?: boolean // Whether the DID should be anchored on ION or not. Handy for testing or importing an ID\n}\n\nexport interface IonKeyMetadata {\n  purposes?: IonPublicKeyPurpose[] // The Verification Method Relationships, or purposes as they are called in ION/Sidetree\n  actionTimestamp: number // Unique number denoting the action. Used for ordering internally. Suggested to use current timestamp\n  relation: KeyIdentifierRelation // The type of key, which is either recovery, update or DID\n  commitment?: string // Commitment value in case this is an update or recovery key. Used to get latest update/recovery keys\n}\n\nexport enum KeyType {\n  Ed25519 = 'Ed25519', // EdDSA key type\n  Secp256k1 = 'Secp256k1', // EcDSA key type (not yet supported)\n}\n\nexport enum KeyIdentifierRelation {\n  RECOVERY = 'recovery', // A recovery key can be used to recover access to a DID, after loosing the update key(s)\n  UPDATE = 'update', // An update key is used to commit changes on ION. Please note that new update keys will be automatically created on every update\n  DID = 'did', // A key which ends up as a Verification Method in a DID document\n}\n\nexport enum IonDidForm {\n  LONG = 'long', // A long form ION DID, which contains the short form, but also a self-certifying part, which can be resolved before the anchor happened. This is handy during the initial anchoring (as that might take a long time)\n  SHORT = 'short', // The short form ION DID, which can only be used once anchored\n}\n\nexport interface IKeyRotation {\n  currentVeramoKey: IKey // Current update/recovery Veramo Key\n  currentIonKey: IonPublicKeyModel // Current update/recovery Key in ION form\n  currentJwk: JwkEs256k // Current update/recovery JWK of the key\n  nextVeramoKey: IKey // Next Veramo update/recovery key\n  nextIonKey: IonPublicKeyModel // Next update/recovery key in ION form\n  nextJwk: JwkEs256k // Next JWK of the update/recovery key\n}\n\n\n/** Secp256k1 Private Key  */\nexport interface ISecp256k1PrivateKeyJwk {\n  /** key type */\n  kty: string;\n\n  /** curve */\n  crv: string;\n\n  /** private point */\n  d: string;\n\n  /** public point */\n  x: string;\n\n  /** public point */\n  y: string;\n\n  /** key id */\n  kid: string;\n}\n\n/** Secp256k1 Public Key  */\nexport interface ISecp256k1PublicKeyJwk {\n  /** key type */\n  kty: string;\n\n  /** curve */\n  crv: string;\n\n  /** public point */\n  x: string;\n\n  /** public point */\n  y: string;\n\n  /** key id */\n  kid: string;\n}\n\nexport type IRequiredContext = IAgentContext<IKeyManager>\n"
  },
  {
    "path": "packages/did-provider-ion/tsconfig.json",
    "content": "{\n  \"extends\": \"../tsconfig.settings.json\",\n  \"compilerOptions\": {\n    \"rootDir\": \"src\",\n    \"outDir\": \"build\",\n    \"declarationDir\": \"build\",\n    \"skipLibCheck\": true\n  },\n  \"references\": [\n    {\n      \"path\": \"../core-types\"\n    },\n    {\n      \"path\": \"../did-manager\"\n    },\n    {\n      \"path\": \"../key-manager\"\n    },\n    {\n      \"path\": \"../kms-local\"\n    },\n    {\n      \"path\": \"../utils\"\n    }\n  ]\n}\n"
  },
  {
    "path": "packages/did-provider-jwk/CHANGELOG.md",
    "content": "# Change Log\n\nAll notable changes to this project will be documented in this file.\nSee [Conventional Commits](https://conventionalcommits.org) for commit guidelines.\n\n# [7.0.0](https://github.com/decentralized-identity/veramo/compare/v6.0.2...v7.0.0) (2026-02-11)\n\n\n### Bug Fixes\n\n* **deps:** update devdeps and bump typeorm to 0.3.20 ([#1272](https://github.com/decentralized-identity/veramo/issues/1272)) ([7d17f37](https://github.com/decentralized-identity/veramo/commit/7d17f37ea7cc4e73a8cdae028681ae1be5c4d11c))\n* **did-comm:** remove isomorphic-webcrypto dependency ([#1401](https://github.com/decentralized-identity/veramo/issues/1401)) ([85cc1ce](https://github.com/decentralized-identity/veramo/commit/85cc1ce1d567afcbc42e0fd89eb2515505044c83)), closes [#1381](https://github.com/decentralized-identity/veramo/issues/1381) [#1387](https://github.com/decentralized-identity/veramo/issues/1387)\n\n\n### Features\n\n* **credential-w3c:** refactor the ICredentialProvider API ([#1488](https://github.com/decentralized-identity/veramo/issues/1488)) ([cbd848d](https://github.com/decentralized-identity/veramo/commit/cbd848d4ce2b52497d99d335f1c93bd8b005cdb2))\n* improve key creation/import options when creating identifiers ([#1423](https://github.com/decentralized-identity/veramo/issues/1423)) ([12aa854](https://github.com/decentralized-identity/veramo/commit/12aa854baa384805f4cae6360720f2e9a5a484aa))\n\n\n### BREAKING CHANGES\n\n* **credential-w3c:** This changeset, along with the previous changes in #1395 modify the CredentialPlugin to support extensibility without modifications to the veramo repository. This plugin now acts as an orchestrator for other ICredentialProvider implementations that provide the actual support for various verifiable data formats. ICredentialProvider implementations can be implemented externally and used with this plugin.\n\n\n\n\n\n## [6.0.2](https://github.com/decentralized-identity/veramo/compare/v6.0.1...v6.0.2) (2026-01-16)\n\n**Note:** Version bump only for package @veramo/did-provider-jwk\n\n\n\n\n\n## [6.0.1](https://github.com/decentralized-identity/veramo/compare/v6.0.0...v6.0.1) (2026-01-16)\n\n**Note:** Version bump only for package @veramo/did-provider-jwk\n\n\n\n\n\n# [6.0.0](https://github.com/decentralized-identity/veramo/compare/v5.6.0...v6.0.0) (2024-04-02)\n\n\n### Features\n\n* **cli:** add support for did:jwk and did:peer to CLI ([#1320](https://github.com/decentralized-identity/veramo/issues/1320)) ([3ac343e](https://github.com/decentralized-identity/veramo/commit/3ac343e52dbd744c137bbe610cba9f5409a6100c))\n\n\n\n\n\n# [5.6.0](https://github.com/decentralized-identity/veramo/compare/v5.5.3...v5.6.0) (2024-01-16)\n\n\n### Features\n\n* **remote-client:** allow dynamic headers param for AgentRestClient constructor ([#1314](https://github.com/decentralized-identity/veramo/issues/1314)) ([1b8a0a2](https://github.com/decentralized-identity/veramo/commit/1b8a0a2718dd63492ad3a312a6ebe5f6e7849935)), closes [#1313](https://github.com/decentralized-identity/veramo/issues/1313)\n\n\n\n\n\n## [5.5.3](https://github.com/decentralized-identity/veramo/compare/v5.5.2...v5.5.3) (2023-10-09)\n\n\n### Bug Fixes\n\n* use DIF URLs in packages ([#1271](https://github.com/decentralized-identity/veramo/issues/1271)) ([3dfc601](https://github.com/decentralized-identity/veramo/commit/3dfc6014cdee7902c59d8db76b4c8507b870f227))\n\n\n\n\n\n# [5.5.0](https://github.com/uport-project/veramo/compare/v5.4.1...v5.5.0) (2023-09-19)\n\n\n### Bug Fixes\n\n* **did-provider-key:** use compressed keys for creating Secp256k1 did:key ([#1217](https://github.com/uport-project/veramo/issues/1217)) ([ba8f6f5](https://github.com/uport-project/veramo/commit/ba8f6f5b9b701e57af86491504ecd209ca0c1c1d)), closes [#1213](https://github.com/uport-project/veramo/issues/1213)\n\n\n\n\n\n## [5.4.1](https://github.com/uport-project/veramo/compare/v5.4.0...v5.4.1) (2023-08-04)\n\n\n### Bug Fixes\n\n* **ci:** benign change meant to tag all packages for another patch release ([#1211](https://github.com/uport-project/veramo/issues/1211)) ([41b5c90](https://github.com/uport-project/veramo/commit/41b5c90277171b7b38c5cf49ca01db5cf75b6300))\n\n\n\n\n\n# [5.4.0](https://github.com/uport-project/veramo/compare/v5.3.0...v5.4.0) (2023-08-01)\n\n\n### Features\n\n* **did-comm:** add support for the AES based content and key encryption algorithms ([#1180](https://github.com/uport-project/veramo/issues/1180)) ([5294a81](https://github.com/uport-project/veramo/commit/5294a812ee578c0712b54f216416c3ef78c848da))\n\n\n\n\n\n# [5.3.0](https://github.com/uport-project/veramo/compare/v5.2.0...v5.3.0) (2023-07-27)\n\n**Note:** Version bump only for package @veramo/did-provider-jwk\n\n\n\n\n\n# [5.2.0](https://github.com/uport-project/veramo/compare/v5.1.4...v5.2.0) (2023-05-02)\n\n**Note:** Version bump only for package @veramo/did-provider-jwk\n\n\n\n\n\n## [5.1.2](https://github.com/uport-project/veramo/compare/v5.1.1...v5.1.2) (2023-02-25)\n\n**Note:** Version bump only for package @veramo/did-provider-jwk\n\n\n\n\n\n## [5.1.1](https://github.com/uport-project/veramo/compare/v5.1.0...v5.1.1) (2023-02-25)\n\n\n### Bug Fixes\n\n* **ci:** add publishConfig for did-provider-jwk ([b8b18e9](https://github.com/uport-project/veramo/commit/b8b18e97b75c709f0b2445324923c8ae3c4c2d74))\n\n\n\n\n\n# [5.1.0](https://github.com/uport-project/veramo/compare/v5.0.0...v5.1.0) (2023-02-24)\n\n\n### Bug Fixes\n\n* P256 key parity corrections ([#1137](https://github.com/uport-project/veramo/issues/1137)) ([d0eca2b](https://github.com/uport-project/veramo/commit/d0eca2b3cd9ca6741f7f056e28bb9799910bc5ec)), closes [#1136](https://github.com/uport-project/veramo/issues/1136) [#1135](https://github.com/uport-project/veramo/issues/1135)\n\n\n### Features\n\n* **did-provider-jwk:** add did:jwk method support ([#1128](https://github.com/uport-project/veramo/issues/1128)) ([0a22d9c](https://github.com/uport-project/veramo/commit/0a22d9c2426c69c95263b2f0b36617794b59be62))\n"
  },
  {
    "path": "packages/did-provider-jwk/README.md",
    "content": "# Veramo did:jwk provider\n\nThis package contains an implementation of `AbstractIdentifierProvider` for the `did:jwk` method, according to the [specification](https://github.com/quartzjer/did-jwk/blob/main/spec.md).\nThis enables creation and control of `did:jwk` entities.\n"
  },
  {
    "path": "packages/did-provider-jwk/api-extractor.json",
    "content": "{\n  \"$schema\": \"https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json\",\n  \"apiReport\": {\n    \"enabled\": true,\n    \"reportFolder\": \"./api\",\n    \"reportTempFolder\": \"./api\"\n  },\n\n  \"docModel\": {\n    \"enabled\": true,\n    \"apiJsonFilePath\": \"./api/<unscopedPackageName>.api.json\"\n  },\n\n  \"dtsRollup\": {\n    \"enabled\": false\n  },\n  \"mainEntryPointFilePath\": \"<projectFolder>/build/index.d.ts\"\n}\n"
  },
  {
    "path": "packages/did-provider-jwk/package.json",
    "content": "{\n  \"name\": \"@veramo/did-provider-jwk\",\n  \"version\": \"7.0.0\",\n  \"description\": \"Veramo plugin that can enable creation and control of did:jwk identifiers.\",\n  \"main\": \"build/index.js\",\n  \"types\": \"build/index.d.ts\",\n  \"exports\": \"./build/index.js\",\n  \"scripts\": {\n    \"build\": \"tsc\",\n    \"extract-api\": \"node ../cli/bin/veramo.js dev extract-api\"\n  },\n  \"dependencies\": {\n    \"@noble/curves\": \"^1.4.2\",\n    \"@veramo/core-types\": \"workspace:^\",\n    \"@veramo/did-manager\": \"workspace:^\",\n    \"@veramo/utils\": \"workspace:^\",\n    \"debug\": \"^4.3.3\",\n    \"did-resolver\": \"^4.1.0\"\n  },\n  \"devDependencies\": {\n    \"@types/debug\": \"4.1.8\",\n    \"@veramo/core\": \"workspace:*\",\n    \"@veramo/did-resolver\": \"workspace:*\",\n    \"@veramo/key-manager\": \"workspace:*\",\n    \"@veramo/kms-local\": \"workspace:*\",\n    \"typescript\": \"5.7.3\"\n  },\n  \"repository\": {\n    \"type\": \"git\",\n    \"url\": \"https://github.com/decentralized-identity/veramo.git\",\n    \"directory\": \"packages/did-provider-jwk\"\n  },\n  \"author\": \"Tadej Podrekar\",\n  \"contributors\": [\n    \"Consensys Mesh R&D <hello@veramo.io>\",\n    \"Mircea Nistor <mircea.nistor@mesh.xyz>\"\n  ],\n  \"keywords\": [\n    \"Veramo\",\n    \"DID\",\n    \"Verifiable Credential\",\n    \"veramo-plugin\",\n    \"did:jwk\",\n    \"JWK\"\n  ],\n  \"license\": \"Apache-2.0\",\n  \"files\": [\n    \"build/**/*\",\n    \"src/**/*\",\n    \"README.md\",\n    \"LICENSE\"\n  ],\n  \"type\": \"module\",\n  \"moduleDirectories\": [\n    \"node_modules\",\n    \"src\"\n  ],\n  \"publishConfig\": {\n    \"access\": \"public\"\n  }\n}\n"
  },
  {
    "path": "packages/did-provider-jwk/src/__tests__/jwk.test.ts",
    "content": "import { JwkDIDProvider } from '../jwk-did-provider'\nimport { getDidJwkResolver } from '../resolver'\nimport { IDIDManager, IKeyManager, IResolver } from '@veramo/core-types'\nimport { createAgent } from '@veramo/core'\nimport { KeyManager, MemoryKeyStore, MemoryPrivateKeyStore } from '@veramo/key-manager'\nimport { KeyManagementSystem } from '@veramo/kms-local'\nimport { DIDManager, MemoryDIDStore } from '@veramo/did-manager'\nimport { DIDResolverPlugin } from '@veramo/did-resolver'\n\nconst defaultKms = 'memory'\nconst jwkDIDProvider = new JwkDIDProvider({ defaultKms })\n\nconst agent = createAgent<IKeyManager & IDIDManager & IResolver>({\n  plugins: [\n    new KeyManager({\n      store: new MemoryKeyStore(),\n      kms: {\n        [defaultKms]: new KeyManagementSystem(new MemoryPrivateKeyStore()),\n      },\n    }),\n    new DIDManager({\n      providers: {\n        'did:jwk': jwkDIDProvider,\n      },\n      defaultProvider: 'did:jwk',\n      store: new MemoryDIDStore(),\n    }),\n    new DIDResolverPlugin({\n      ...getDidJwkResolver(),\n    }),\n  ],\n})\ndescribe('create did:jwk', () => {\n  it('Secp256k1', async () => {\n    const id = await agent.didManagerCreate({\n      options: {\n        key: {\n          type: 'Secp256k1',\n          privateKeyHex: 'a5e81a8cd50cf5c31d5b87db3e153e2817f86de350a60edc2335f76d5c3b4e0d',\n        }\n      },\n    })\n    expect(id.did).toEqual(\n      'did:jwk:eyJhbGciOiJFUzI1NksiLCJjcnYiOiJzZWNwMjU2azEiLCJrdHkiOiJFQyIsInVzZSI6InNpZyIsIngiOiJVNV85NlJMQWxMeEl0a3llNXhzcnJzNGt4eEM4clN4N3JNN1dGZllLNVRrIiwieSI6IlNjM0pVM25yVUZWdEVjc0stckRscHNxTXRIWFVFN0x4SXdmTUxYOVVPTjQifQ',\n    )\n  })\n\n  it('Secp256k1 with keyRef', async () => {\n    const key = await agent.keyManagerImport({\n      kms: defaultKms,\n      type: 'Secp256k1',\n      privateKeyHex: 'a5e81a8cd50cf5c31d5b87db3e153e2817f86de350a60edc2335f76d5c3b4e0d',\n    })\n\n    const id = await agent.didManagerCreate({\n      options: {\n        keyRef: key.kid\n      },\n    })\n\n    expect(id.did).toEqual(\n      'did:jwk:eyJhbGciOiJFUzI1NksiLCJjcnYiOiJzZWNwMjU2azEiLCJrdHkiOiJFQyIsInVzZSI6InNpZyIsIngiOiJVNV85NlJMQWxMeEl0a3llNXhzcnJzNGt4eEM4clN4N3JNN1dGZllLNVRrIiwieSI6IlNjM0pVM25yVUZWdEVjc0stckRscHNxTXRIWFVFN0x4SXdmTUxYOVVPTjQifQ',\n    )\n  })\n\n  it('Secp256k1 deprecated config', async () => {\n    const id = await agent.didManagerCreate({\n      options: {\n        keyType: 'Secp256k1',\n        privateKeyHex: 'a5e81a8cd50cf5c31d5b87db3e153e2817f86de350a60edc2335f76d5c3b4e0d',\n      },\n    })\n    expect(id.did).toEqual(\n      'did:jwk:eyJhbGciOiJFUzI1NksiLCJjcnYiOiJzZWNwMjU2azEiLCJrdHkiOiJFQyIsInVzZSI6InNpZyIsIngiOiJVNV85NlJMQWxMeEl0a3llNXhzcnJzNGt4eEM4clN4N3JNN1dGZllLNVRrIiwieSI6IlNjM0pVM25yVUZWdEVjc0stckRscHNxTXRIWFVFN0x4SXdmTUxYOVVPTjQifQ',\n    )\n  })\n\n  it('Ed25519', async () => {\n    const id = await agent.didManagerCreate({\n      options: {\n        key: {\n          type: 'Ed25519',\n          privateKeyHex: 'a5e81a8cd50cf5c31d5b87db3e153e2817f86de350a60edc2335f76d5c3b4e0d',\n        }\n      },\n    })\n    expect(id.did).toEqual(\n      'did:jwk:eyJhbGciOiJFZERTQSIsImNydiI6IkVkMjU1MTkiLCJrdHkiOiJPS1AiLCJ1c2UiOiJzaWciLCJ4IjoiTTNodVJCZnJpU3lHemlJS3pUSE5nS1djSVhuX3IxUzYxRnZBcUQyVmhSUSJ9',\n    )\n  })\n\n  it('Ed25519 with keyRef', async () => {\n    const key = await agent.keyManagerImport({\n      kms: defaultKms,\n      type: 'Ed25519',\n      privateKeyHex: 'a5e81a8cd50cf5c31d5b87db3e153e2817f86de350a60edc2335f76d5c3b4e0d',\n    })\n\n    const id = await agent.didManagerCreate({\n      options: {\n        keyRef: key.kid\n      },\n    })\n\n    expect(id.did).toEqual(\n      'did:jwk:eyJhbGciOiJFZERTQSIsImNydiI6IkVkMjU1MTkiLCJrdHkiOiJPS1AiLCJ1c2UiOiJzaWciLCJ4IjoiTTNodVJCZnJpU3lHemlJS3pUSE5nS1djSVhuX3IxUzYxRnZBcUQyVmhSUSJ9',\n    )\n  })\n\n  it('Ed25519 deprecated config', async () => {\n    const id = await agent.didManagerCreate({\n      options: {\n        keyType: 'Ed25519',\n        privateKeyHex: 'a5e81a8cd50cf5c31d5b87db3e153e2817f86de350a60edc2335f76d5c3b4e0d',\n      },\n    })\n    expect(id.did).toEqual(\n      'did:jwk:eyJhbGciOiJFZERTQSIsImNydiI6IkVkMjU1MTkiLCJrdHkiOiJPS1AiLCJ1c2UiOiJzaWciLCJ4IjoiTTNodVJCZnJpU3lHemlJS3pUSE5nS1djSVhuX3IxUzYxRnZBcUQyVmhSUSJ9',\n    )\n  })\n\n  it('X25519', async () => {\n    const id = await agent.didManagerCreate({\n      options: {\n        key: {\n          type: 'X25519',\n          privateKeyHex: 'a5e81a8cd50cf5c31d5b87db3e153e2817f86de350a60edc2335f76d5c3b4e0d',\n        }\n      },\n    })\n    expect(id.did).toEqual(\n      'did:jwk:eyJhbGciOiJFQ0RILUVTIiwiY3J2IjoiWDI1NTE5Iiwia3R5IjoiT0tQIiwidXNlIjoiZW5jIiwieCI6IlVuNFNEWk12R2dReENiZkRBOWpwNjlyNDdvVWdsSF93eU1aRjU2THAwbU0ifQ',\n    )\n  })\n\n  it('X25519 with keyRef', async () => {\n    const key = await agent.keyManagerImport({\n      kms: defaultKms,\n      type: 'X25519',\n      privateKeyHex: 'a5e81a8cd50cf5c31d5b87db3e153e2817f86de350a60edc2335f76d5c3b4e0d',\n    })\n\n    const id = await agent.didManagerCreate({\n      options: {\n        keyRef: key.kid\n      },\n    })\n\n    expect(id.did).toEqual(\n      'did:jwk:eyJhbGciOiJFQ0RILUVTIiwiY3J2IjoiWDI1NTE5Iiwia3R5IjoiT0tQIiwidXNlIjoiZW5jIiwieCI6IlVuNFNEWk12R2dReENiZkRBOWpwNjlyNDdvVWdsSF93eU1aRjU2THAwbU0ifQ',\n    )\n  })\n\n  it('X25519 deprecated config', async () => {\n    const id = await agent.didManagerCreate({\n      options: {\n        keyType: 'X25519',\n        privateKeyHex: 'a5e81a8cd50cf5c31d5b87db3e153e2817f86de350a60edc2335f76d5c3b4e0d',\n      },\n    })\n    expect(id.did).toEqual(\n      'did:jwk:eyJhbGciOiJFQ0RILUVTIiwiY3J2IjoiWDI1NTE5Iiwia3R5IjoiT0tQIiwidXNlIjoiZW5jIiwieCI6IlVuNFNEWk12R2dReENiZkRBOWpwNjlyNDdvVWdsSF93eU1aRjU2THAwbU0ifQ',\n    )\n  })\n\n  it('Secp256r1', async () => {\n    const id = await agent.didManagerCreate({\n      options: {\n        key: {\n          type: 'Secp256r1',\n          privateKeyHex: 'a5e81a8cd50cf5c31d5b87db3e153e2817f86de350a60edc2335f76d5c3b4e0d',\n        }\n      },\n    })\n    expect(id.did).toEqual(\n      'did:jwk:eyJhbGciOiJFUzI1NiIsImNydiI6IlAtMjU2Iiwia3R5IjoiRUMiLCJ1c2UiOiJzaWciLCJ4IjoiejhTTlNYTVgxUjZlVEt6SkdtLUE3ZWpBZkZsdURsaUhKdW9nT2FQc0REUSIsInkiOiJLUUtBTWVwTU56dHJseTB6ODI3MTg0dDRQdkFuU0lULW1MMFFsaUg1enU0In0',\n    )\n  })\n\n  it('Secp256r1 with keyRef', async () => {\n    const key = await agent.keyManagerImport({\n      kms: defaultKms,\n      type: 'Secp256r1',\n      privateKeyHex: 'a5e81a8cd50cf5c31d5b87db3e153e2817f86de350a60edc2335f76d5c3b4e0d',\n    })\n\n    const id = await agent.didManagerCreate({\n      options: {\n        keyRef: key.kid\n      },\n    })\n\n    expect(id.did).toEqual(\n      'did:jwk:eyJhbGciOiJFUzI1NiIsImNydiI6IlAtMjU2Iiwia3R5IjoiRUMiLCJ1c2UiOiJzaWciLCJ4IjoiejhTTlNYTVgxUjZlVEt6SkdtLUE3ZWpBZkZsdURsaUhKdW9nT2FQc0REUSIsInkiOiJLUUtBTWVwTU56dHJseTB6ODI3MTg0dDRQdkFuU0lULW1MMFFsaUg1enU0In0',\n    )\n  })\n\n  it('Secp256r1 deprecated config', async () => {\n    const id = await agent.didManagerCreate({\n      options: {\n        keyType: 'Secp256r1',\n        privateKeyHex: 'a5e81a8cd50cf5c31d5b87db3e153e2817f86de350a60edc2335f76d5c3b4e0d',\n      },\n    })\n    expect(id.did).toEqual(\n      'did:jwk:eyJhbGciOiJFUzI1NiIsImNydiI6IlAtMjU2Iiwia3R5IjoiRUMiLCJ1c2UiOiJzaWciLCJ4IjoiejhTTlNYTVgxUjZlVEt6SkdtLUE3ZWpBZkZsdURsaUhKdW9nT2FQc0REUSIsInkiOiJLUUtBTWVwTU56dHJseTB6ODI3MTg0dDRQdkFuU0lULW1MMFFsaUg1enU0In0',\n    )\n  })\n})\n\ndescribe('resolve did:jwk', () => {\n  it('should resolve Secp256k1', async () => {\n    const did =\n      'did:jwk:eyJhbGciOiJFUzI1NksiLCJjcnYiOiJzZWNwMjU2azEiLCJrdHkiOiJFQyIsInVzZSI6InNpZyIsIngiOiJVNV85NlJMQWxMeEl0a3llNXhzcnJzNGt4eEM4clN4N3JNN1dGZllLNVRrIiwieSI6IlNjM0pVM25yVUZWdEVjc0stckRscHNxTXRIWFVFN0x4SXdmTUxYOVVPTjQifQ'\n    const result = await agent.resolveDid({ didUrl: did })\n\n    expect(result.didDocument).toEqual({\n      id: did,\n      '@context': ['https://www.w3.org/ns/did/v1', 'https://w3id.org/security/suites/jws-2020/v1'],\n      verificationMethod: [\n        {\n          id: `${did}#0`,\n          type: 'JsonWebKey2020',\n          controller: did,\n          publicKeyJwk: {\n            alg: 'ES256K',\n            crv: 'secp256k1',\n            kty: 'EC',\n            use: 'sig',\n            x: 'U5_96RLAlLxItkye5xsrrs4kxxC8rSx7rM7WFfYK5Tk',\n            y: 'Sc3JU3nrUFVtEcsK-rDlpsqMtHXUE7LxIwfMLX9UON4',\n          },\n        },\n      ],\n      assertionMethod: [`${did}#0`],\n      authentication: [`${did}#0`],\n      capabilityInvocation: [`${did}#0`],\n      capabilityDelegation: [`${did}#0`],\n    })\n  })\n\n  it('should resolve P-256', async () => {\n    const did =\n      'did:jwk:eyJhbGciOiJFUzI1NiIsImNydiI6IlAtMjU2Iiwia3R5IjoiRUMiLCJ1c2UiOiJzaWciLCJ4IjoiejhTTlNYTVgxUjZlVEt6SkdtLUE3ZWpBZkZsdURsaUhKdW9nT2FQc0REUSIsInkiOiJLUUtBTWVwTU56dHJseTB6ODI3MTg0dDRQdkFuU0lULW1MMFFsaUg1enU0In0'\n    const result = await agent.resolveDid({ didUrl: did })\n\n    expect(result.didDocument).toEqual({\n      id: did,\n      '@context': ['https://www.w3.org/ns/did/v1', 'https://w3id.org/security/suites/jws-2020/v1'],\n      verificationMethod: [\n        {\n          id: `${did}#0`,\n          type: 'JsonWebKey2020',\n          controller: did,\n          publicKeyJwk: {\n            alg: 'ES256',\n            crv: 'P-256',\n            kty: 'EC',\n            use: 'sig',\n            x: 'z8SNSXMX1R6eTKzJGm-A7ejAfFluDliHJuogOaPsDDQ',\n            y: 'KQKAMepMNztrly0z827184t4PvAnSIT-mL0QliH5zu4',\n          },\n        },\n      ],\n      assertionMethod: [`${did}#0`],\n      authentication: [`${did}#0`],\n      capabilityInvocation: [`${did}#0`],\n      capabilityDelegation: [`${did}#0`],\n    })\n  })\n\n  it('should resolve Ed25519', async () => {\n    const did =\n      'did:jwk:eyJhbGciOiJFZERTQSIsImNydiI6IkVkMjU1MTkiLCJrdHkiOiJPS1AiLCJ1c2UiOiJzaWciLCJ4IjoiTTNodVJCZnJpU3lHemlJS3pUSE5nS1djSVhuX3IxUzYxRnZBcUQyVmhSUSJ9'\n    const result = await agent.resolveDid({ didUrl: did })\n\n    expect(result.didDocument).toEqual({\n      id: did,\n      '@context': ['https://www.w3.org/ns/did/v1', 'https://w3id.org/security/suites/jws-2020/v1'],\n      verificationMethod: [\n        {\n          id: `${did}#0`,\n          type: 'JsonWebKey2020',\n          controller: did,\n          publicKeyJwk: {\n            alg: 'EdDSA',\n            crv: 'Ed25519',\n            kty: 'OKP',\n            use: 'sig',\n            x: 'M3huRBfriSyGziIKzTHNgKWcIXn_r1S61FvAqD2VhRQ',\n          },\n        },\n      ],\n      assertionMethod: [`${did}#0`],\n      authentication: [`${did}#0`],\n      capabilityInvocation: [`${did}#0`],\n      capabilityDelegation: [`${did}#0`],\n    })\n  })\n\n  it('should resolve X25519', async () => {\n    const did =\n      'did:jwk:eyJhbGciOiJFQ0RILUVTIiwiY3J2IjoiWDI1NTE5Iiwia3R5IjoiT0tQIiwidXNlIjoiZW5jIiwieCI6IlVuNFNEWk12R2dReENiZkRBOWpwNjlyNDdvVWdsSF93eU1aRjU2THAwbU0ifQ'\n    const result = await agent.resolveDid({ didUrl: did })\n\n    expect(result.didDocument).toEqual({\n      id: did,\n      '@context': ['https://www.w3.org/ns/did/v1', 'https://w3id.org/security/suites/jws-2020/v1'],\n      verificationMethod: [\n        {\n          id: `${did}#0`,\n          type: 'JsonWebKey2020',\n          controller: did,\n          publicKeyJwk: {\n            alg: 'ECDH-ES',\n            crv: 'X25519',\n            kty: 'OKP',\n            use: 'enc',\n            x: 'Un4SDZMvGgQxCbfDA9jp69r47oUglH_wyMZF56Lp0mM',\n          },\n        },\n      ],\n      keyAgreement: [`${did}#0`],\n    })\n  })\n})\n"
  },
  {
    "path": "packages/did-provider-jwk/src/index.ts",
    "content": "/**\r\n * Provides `did:jwk` {@link @veramo/did-provider-jwk#JwkDIDProvider | identifier provider } for the\r\n * {@link @veramo/did-manager#DIDManager}\r\n *\r\n * @packageDocumentation\r\n */\r\nexport { JwkDIDProvider } from './jwk-did-provider.js'\r\nexport { getDidJwkResolver } from './resolver.js'\r\nexport * from './types/jwk-provider-types.js'\r\n"
  },
  {
    "path": "packages/did-provider-jwk/src/jwk-did-provider.ts",
    "content": "import { IIdentifier, IKey, IService, IAgentContext, IKeyManager } from '@veramo/core-types'\r\nimport { AbstractIdentifierProvider } from '@veramo/did-manager'\r\nimport { SupportedKeyTypes, JwkDidSupportedKeyTypes, encodeJoseBlob, importOrCreateKey, generateJwkFromVerificationMethod } from '@veramo/utils'\r\nimport { VerificationMethod } from 'did-resolver'\r\nimport type { JwkCreateIdentifierOptions } from './types/jwk-provider-types.js'\r\n\r\nimport Debug from 'debug'\r\nconst debug = Debug('veramo:did-jwk:identifier-provider')\r\n\r\ntype IContext = IAgentContext<IKeyManager>\r\n\r\n/**\r\n * {@link @veramo/did-manager#DIDManager} identifier provider for `did:jwk` identifiers\r\n *\r\n * @beta This API may change without a BREAKING CHANGE notice.\r\n */\r\nexport class JwkDIDProvider extends AbstractIdentifierProvider {\r\n  private defaultKms: string\r\n\r\n  constructor(options: { defaultKms: string }) {\r\n    super()\r\n    this.defaultKms = options.defaultKms\r\n  }\r\n\r\n  async createIdentifier(\r\n    {\r\n      kms,\r\n      options\r\n    }: {\r\n      kms?: string;\r\n      options?: JwkCreateIdentifierOptions\r\n    },\r\n    context: IContext,\r\n  ): Promise<Omit<IIdentifier, 'provider'>> {\r\n    let keyType: JwkDidSupportedKeyTypes = options?.key?.type || options?.keyType || 'Secp256k1'\r\n    const privateKeyHex = options?.key?.privateKeyHex || options?.privateKeyHex\r\n\r\n    let key: IKey\r\n\r\n    if (options?.keyRef) {\r\n      key = await context.agent.keyManagerGet({ kid: options.keyRef })\r\n      if (!Object.keys(SupportedKeyTypes).includes(key.type)) {\r\n        throw new Error(`not_supported: Key type ${key.type} is not supported`)\r\n      }\r\n      keyType = key.type as JwkDidSupportedKeyTypes\r\n    } else {\r\n      key = await importOrCreateKey(\r\n        {\r\n          kms: kms || this.defaultKms,\r\n          options: {\r\n            ...(options?.key ?? {}),\r\n            type: keyType,\r\n            privateKeyHex,\r\n          },\r\n        },\r\n        context,\r\n      )\r\n    }\r\n\r\n    const jwk = generateJwkFromVerificationMethod(\r\n      keyType,\r\n      {\r\n        publicKeyHex: key.publicKeyHex,\r\n      } as VerificationMethod,\r\n      options?.keyUse,\r\n    )\r\n    const jwkBase64url = encodeJoseBlob(jwk as {})\r\n\r\n    const identifier: Omit<IIdentifier, 'provider'> = {\r\n      did: `did:jwk:${jwkBase64url}`,\r\n      controllerKeyId: key.kid,\r\n      keys: [key],\r\n      services: [],\r\n    }\r\n    debug('Created', identifier.did)\r\n    return identifier\r\n  }\r\n\r\n  async updateIdentifier(\r\n    args: {\r\n      did: string\r\n      kms?: string\r\n      alias?: string\r\n      options?: any\r\n    },\r\n    context: IAgentContext<IKeyManager>,\r\n  ): Promise<IIdentifier> {\r\n    throw new Error('not_supported: JwkDIDProvider updateIdentifier not possible')\r\n  }\r\n\r\n  async deleteIdentifier(identifier: IIdentifier, context: IContext): Promise<boolean> {\r\n    for (const { kid } of identifier.keys) {\r\n      await context.agent.keyManagerDelete({ kid })\r\n    }\r\n    return true\r\n  }\r\n\r\n  async addKey(\r\n    { identifier, key, options }: { identifier: IIdentifier; key: IKey; options?: any },\r\n    context: IContext,\r\n  ): Promise<any> {\r\n    throw Error('not_supported: JwkDIDProvider addKey not possible')\r\n  }\r\n\r\n  async addService(\r\n    { identifier, service, options }: { identifier: IIdentifier; service: IService; options?: any },\r\n    context: IContext,\r\n  ): Promise<any> {\r\n    throw Error('not_supported: JwkDIDProvider addService not possible')\r\n  }\r\n\r\n  async removeKey(\r\n    args: { identifier: IIdentifier; kid: string; options?: any },\r\n    context: IContext,\r\n  ): Promise<any> {\r\n    throw Error('not_supported: JwkDIDProvider removeKey not possible')\r\n  }\r\n\r\n  async removeService(\r\n    args: { identifier: IIdentifier; id: string; options?: any },\r\n    context: IContext,\r\n  ): Promise<any> {\r\n    throw Error('not_supported: JwkDIDProvider removeService not possible')\r\n  }\r\n}\r\n"
  },
  {
    "path": "packages/did-provider-jwk/src/resolver.ts",
    "content": "import {\r\n  DIDDocument,\r\n  DIDResolutionOptions,\r\n  DIDResolutionResult,\r\n  DIDResolver,\r\n  ParsedDID,\r\n  Resolvable,\r\n  JsonWebKey,\r\n} from 'did-resolver'\r\nimport { encodeBase64url, decodeBase64url, isJWK } from '@veramo/utils'\r\n\r\nfunction generateDidResolution(jwk: JsonWebKey, parsed: ParsedDID): Promise<DIDResolutionResult> {\r\n  return new Promise((resolve, reject) => {\r\n    try {\r\n      const sig = jwk.use === 'sig'\r\n      const enc = jwk.use === 'enc'\r\n      const did = `did:jwk:${encodeBase64url(JSON.stringify(jwk))}`\r\n      const didDocument: DIDDocument = {\r\n        id: did,\r\n        '@context': ['https://www.w3.org/ns/did/v1', 'https://w3id.org/security/suites/jws-2020/v1'],\r\n        verificationMethod: [\r\n          {\r\n            id: `${did}#0`,\r\n            type: 'JsonWebKey2020',\r\n            controller: did,\r\n            publicKeyJwk: jwk,\r\n          },\r\n        ],\r\n        ...(sig && { assertionMethod: [`${did}#0`] }),\r\n        ...(sig && { authentication: [`${did}#0`] }),\r\n        ...(sig && { capabilityInvocation: [`${did}#0`] }),\r\n        ...(sig && { capabilityDelegation: [`${did}#0`] }),\r\n        ...(enc && { keyAgreement: [`${did}#0`] }),\r\n      }\r\n      resolve({\r\n        didDocumentMetadata: {},\r\n        didResolutionMetadata: {\r\n          contentType: 'application/did+ld+json',\r\n          pattern: '^(did:jwk:.+)$',\r\n          did: {\r\n            didString: did,\r\n            methodSpecificId: parsed.id,\r\n            method: 'jwk',\r\n          },\r\n        },\r\n        didDocument,\r\n      } as DIDResolutionResult)\r\n    } catch (error: any) {\r\n      reject(error)\r\n    }\r\n  })\r\n}\r\n\r\nfunction parseDidJwkIdentifier(didIdentifier: string): JsonWebKey {\r\n  try {\r\n    const jwk = JSON.parse(decodeBase64url(didIdentifier)) as unknown\r\n    if (!isJWK(jwk)) {\r\n      throw new Error(\"illegal_argument: DID identifier doesn't contain a valid JWK\")\r\n    }\r\n    return jwk\r\n  } catch (error: any) {\r\n    throw new Error('illegal_argument: Invalid DID identifier')\r\n  }\r\n}\r\n\r\nexport const resolveDidJwk: DIDResolver = async (\r\n  did: string,\r\n  parsed: ParsedDID,\r\n  resolver: Resolvable,\r\n  options: DIDResolutionOptions,\r\n): Promise<DIDResolutionResult> => {\r\n  try {\r\n    if (parsed.method !== 'jwk') throw Error('illegal_argument: Invalid DID method')\r\n\r\n    const didIdentifier = did.split('did:jwk:')[1]\r\n    if (!didIdentifier) throw Error('illegal_argument: Invalid DID')\r\n\r\n    const jwk = parseDidJwkIdentifier(didIdentifier)\r\n    const didResolution = await generateDidResolution(jwk, parsed)\r\n    return didResolution\r\n  } catch (err: any) {\r\n    return {\r\n      didDocumentMetadata: {},\r\n      didResolutionMetadata: {\r\n        error: err.message,\r\n      },\r\n      didDocument: null,\r\n    } as DIDResolutionResult\r\n  }\r\n}\r\n\r\n/**\r\n * Provides a mapping to a did:jwk resolver, usable by {@link did-resolver#Resolver}.\r\n *\r\n * @public\r\n */\r\nexport function getDidJwkResolver() {\r\n  return { jwk: resolveDidJwk }\r\n}\r\n"
  },
  {
    "path": "packages/did-provider-jwk/src/types/jwk-provider-types.ts",
    "content": "import { CreateIdentifierBaseOptions, JwkDidSupportedKeyTypes, KeyUse } from '@veramo/utils'\n\n/**\n * Options for creating a JWK DID identifier\n * @internal\n */\nexport type JwkCreateIdentifierOptions = CreateIdentifierBaseOptions<JwkDidSupportedKeyTypes> & {\n  /**\n   * @deprecated use key.type instead\n   */\n  keyType?: JwkDidSupportedKeyTypes\n\n  /**\n   * @deprecated use key.privateKeyHex instead\n   */\n  privateKeyHex?: string\n\n  keyUse?: KeyUse\n};\n"
  },
  {
    "path": "packages/did-provider-jwk/tsconfig.json",
    "content": "{\n  \"extends\": \"../tsconfig.settings.json\",\n  \"compilerOptions\": {\n    \"rootDir\": \"src\",\n    \"outDir\": \"build\",\n    \"declarationDir\": \"build\",\n    \"skipLibCheck\": true\n  },\n  \"references\": [\n    {\n      \"path\": \"../core-types\"\n    },\n    {\n      \"path\": \"../core\"\n    },\n    {\n      \"path\": \"../did-manager\"\n    },\n    {\n      \"path\": \"../did-resolver\"\n    },\n    {\n      \"path\": \"../key-manager\"\n    },\n    {\n      \"path\": \"../kms-local\"\n    },\n    {\n      \"path\": \"../utils\"\n    }\n  ]\n}\n"
  },
  {
    "path": "packages/did-provider-key/CHANGELOG.md",
    "content": "# Change Log\n\nAll notable changes to this project will be documented in this file.\nSee [Conventional Commits](https://conventionalcommits.org) for commit guidelines.\n\n# [7.0.0](https://github.com/decentralized-identity/veramo/compare/v6.0.2...v7.0.0) (2026-02-11)\n\n\n### Bug Fixes\n\n* **deps:** update devdeps and bump typeorm to 0.3.20 ([#1272](https://github.com/decentralized-identity/veramo/issues/1272)) ([7d17f37](https://github.com/decentralized-identity/veramo/commit/7d17f37ea7cc4e73a8cdae028681ae1be5c4d11c))\n\n\n### Features\n\n* improve key creation/import options when creating identifiers ([#1423](https://github.com/decentralized-identity/veramo/issues/1423)) ([12aa854](https://github.com/decentralized-identity/veramo/commit/12aa854baa384805f4cae6360720f2e9a5a484aa))\n\n\n\n\n\n## [6.0.2](https://github.com/decentralized-identity/veramo/compare/v6.0.1...v6.0.2) (2026-01-16)\n\n**Note:** Version bump only for package @veramo/did-provider-key\n\n\n\n\n\n## [6.0.1](https://github.com/decentralized-identity/veramo/compare/v6.0.0...v6.0.1) (2026-01-16)\n\n**Note:** Version bump only for package @veramo/did-provider-key\n\n\n\n\n\n# [6.0.0](https://github.com/decentralized-identity/veramo/compare/v5.6.0...v6.0.0) (2024-04-02)\n\n\n### Bug Fixes\n\n* **did-provider-key:** align did:key resolver to spec ([#1332](https://github.com/decentralized-identity/veramo/issues/1332)) ([8e3b94c](https://github.com/decentralized-identity/veramo/commit/8e3b94cf997619d7adcb5cb8827e0f55ff88cdb5)), closes [#1330](https://github.com/decentralized-identity/veramo/issues/1330)\n\n\n\n\n\n# [5.6.0](https://github.com/decentralized-identity/veramo/compare/v5.5.3...v5.6.0) (2024-01-16)\n\n\n### Features\n\n* **remote-client:** allow dynamic headers param for AgentRestClient constructor ([#1314](https://github.com/decentralized-identity/veramo/issues/1314)) ([1b8a0a2](https://github.com/decentralized-identity/veramo/commit/1b8a0a2718dd63492ad3a312a6ebe5f6e7849935)), closes [#1313](https://github.com/decentralized-identity/veramo/issues/1313)\n\n\n\n\n\n## [5.5.3](https://github.com/decentralized-identity/veramo/compare/v5.5.2...v5.5.3) (2023-10-09)\n\n\n### Bug Fixes\n\n* use DIF URLs in packages ([#1271](https://github.com/decentralized-identity/veramo/issues/1271)) ([3dfc601](https://github.com/decentralized-identity/veramo/commit/3dfc6014cdee7902c59d8db76b4c8507b870f227))\n\n\n\n\n\n# [5.5.0](https://github.com/uport-project/veramo/compare/v5.4.1...v5.5.0) (2023-09-19)\n\n\n### Bug Fixes\n\n* **did-provider-key:** use compressed keys for creating Secp256k1 did:key ([#1217](https://github.com/uport-project/veramo/issues/1217)) ([ba8f6f5](https://github.com/uport-project/veramo/commit/ba8f6f5b9b701e57af86491504ecd209ca0c1c1d)), closes [#1213](https://github.com/uport-project/veramo/issues/1213)\n\n\n\n\n\n## [5.4.1](https://github.com/uport-project/veramo/compare/v5.4.0...v5.4.1) (2023-08-04)\n\n\n### Bug Fixes\n\n* **ci:** benign change meant to tag all packages for another patch release ([#1211](https://github.com/uport-project/veramo/issues/1211)) ([41b5c90](https://github.com/uport-project/veramo/commit/41b5c90277171b7b38c5cf49ca01db5cf75b6300))\n* **deps:** Update did-vc-libraries to v6 ([3cadd56](https://github.com/uport-project/veramo/commit/3cadd56356a23463acc04f9a8a58239a9475b1c1))\n\n\n\n\n\n# [5.4.0](https://github.com/uport-project/veramo/compare/v5.3.0...v5.4.0) (2023-08-01)\n\n\n### Features\n\n* **did-comm:** add support for the AES based content and key encryption algorithms ([#1180](https://github.com/uport-project/veramo/issues/1180)) ([5294a81](https://github.com/uport-project/veramo/commit/5294a812ee578c0712b54f216416c3ef78c848da))\n\n\n\n\n\n# [5.3.0](https://github.com/uport-project/veramo/compare/v5.2.0...v5.3.0) (2023-07-27)\n\n\n### Bug Fixes\n\n* **deps:** update dependency multiformats to v12 ([11fa7c3](https://github.com/uport-project/veramo/commit/11fa7c340da78101ea5e974e8ae0f90193933976))\n\n\n\n\n\n# [5.2.0](https://github.com/uport-project/veramo/compare/v5.1.4...v5.2.0) (2023-05-02)\n\n\n### Features\n\n* add did-peer provider and resolver ([#1156](https://github.com/uport-project/veramo/issues/1156)) ([9502063](https://github.com/uport-project/veramo/commit/95020632f741bd4640b3496b7b1bf19f5e6641d0))\n* **did-provider-key:** add option to create the identifier from a given private key ([#1165](https://github.com/uport-project/veramo/issues/1165)) ([ad79a22](https://github.com/uport-project/veramo/commit/ad79a229666d48546c5b7ccb15c638adee44b7a6))\n\n\n\n\n\n## [5.1.2](https://github.com/uport-project/veramo/compare/v5.1.1...v5.1.2) (2023-02-25)\n\n\n### Bug Fixes\n\n* **ci:** minor changes to trigger release alignment ([9db312f](https://github.com/uport-project/veramo/commit/9db312f8f049ec13ef394dc77fe6e2759143790d))\n\n\n\n\n\n# [5.1.0](https://github.com/uport-project/veramo/compare/v5.0.0...v5.1.0) (2023-02-24)\n\n**Note:** Version bump only for package @veramo/did-provider-key\n\n\n\n\n\n# [5.0.0](https://github.com/uport-project/veramo/compare/v4.3.0...v5.0.0) (2023-02-09)\n\n\n### Build System\n\n* convert veramo modules to ESM instead of CommonJS ([#1103](https://github.com/uport-project/veramo/issues/1103)) ([b5cea3c](https://github.com/uport-project/veramo/commit/b5cea3c0d80d900a47bd1d9eea68f84b70a35e7b)), closes [#1099](https://github.com/uport-project/veramo/issues/1099)\n\n\n### Features\n\n* isolate `core-types` package from `core` ([#1116](https://github.com/uport-project/veramo/issues/1116)) ([ba7a303](https://github.com/uport-project/veramo/commit/ba7a303de91cf4cc568a3af1ddf8ca98ed022e9f))\n\n\n### BREAKING CHANGES\n\n* this is a breaking change as modules will have to be imported differently: \n* https://www.typescriptlang.org/docs/handbook/esm-node.html\n* https://nodejs.org/api/esm.html\n* https://caniuse.com/?search=modules\n\ntest(did-provider-ion): skip a couple of tests that fail with unreasonable errors\nchore: use ubuntu-latest on CI\nfix: temporarily remove puppeteer tests\nfix: use craco for test-react-app to enable babel config\ntest: fix unit and integration tests (browser tests still broken)\nfix: fix some build issues that prevented tests from working\nfix: missing deps flagged by pnpm\n\n\n\n\n\n# [4.3.0](https://github.com/uport-project/veramo/compare/v4.2.0...v4.3.0) (2023-01-27)\n\n**Note:** Version bump only for package @veramo/did-provider-key\n\n\n\n\n\n# [4.2.0](https://github.com/uport-project/veramo/compare/v4.1.2...v4.2.0) (2022-12-05)\n\n\n### Bug Fixes\n\n* **deps:** bump dependencies ([701b8ed](https://github.com/uport-project/veramo/commit/701b8edf981ea11c7ddb6a81d2817dbbdbb022f3))\n\n\n\n\n\n## [4.1.1](https://github.com/uport-project/veramo/compare/v4.1.0...v4.1.1) (2022-11-01)\n\n**Note:** Version bump only for package @veramo/did-provider-key\n\n\n\n\n\n# [4.1.0](https://github.com/uport-project/veramo/compare/v4.0.2...v4.1.0) (2022-10-31)\n\n**Note:** Version bump only for package @veramo/did-provider-key\n\n\n\n\n\n# [4.0.0](https://github.com/uport-project/veramo/compare/v3.1.5...v4.0.0) (2022-09-22)\n\n\n### Bug Fixes\n\n* **deps:** replace @transmute/lds-ecdsa-secp256k1-recovery2020 with fork ([#953](https://github.com/uport-project/veramo/issues/953)) ([573a0ef](https://github.com/uport-project/veramo/commit/573a0efe8d28653bd0389e401c25a2dd9c361a96)), closes [#952](https://github.com/uport-project/veramo/issues/952)\n* **did-resolver:** use interface `Resolvable` instead of the `Resolver` class ([9c2e59f](https://github.com/uport-project/veramo/commit/9c2e59f3f23f808511c6c0e8e440b4d53ba5cb00))\n* update and fix inline documentation of all exported types ([#921](https://github.com/uport-project/veramo/issues/921)) ([63e64e0](https://github.com/uport-project/veramo/commit/63e64e0e2693808c4704dca8cc511dc0bab3f3b1))\n\n\n### Features\n\n* **credential-ld:** add support for browser environments ([#916](https://github.com/uport-project/veramo/issues/916)) ([435e4d2](https://github.com/uport-project/veramo/commit/435e4d260b1774f96b182c1a75ab2f1c993f2291))\n* **did-manager:** add`didManagerUpdate` method for full DID document updates ([#974](https://github.com/uport-project/veramo/issues/974)) ([5682b25](https://github.com/uport-project/veramo/commit/5682b2566b7c4f8f9bfda10e8d06a8d2624c2a1b)), closes [#971](https://github.com/uport-project/veramo/issues/971) [#960](https://github.com/uport-project/veramo/issues/960) [#948](https://github.com/uport-project/veramo/issues/948)\n\n\n\n\n\n## [3.1.3](https://github.com/uport-project/veramo/compare/v3.1.2...v3.1.3) (2022-06-01)\n\n**Note:** Version bump only for package @veramo/did-provider-key\n\n\n\n\n\n# [3.1.0](https://github.com/uport-project/veramo/compare/v3.0.0...v3.1.0) (2021-11-12)\n\n**Note:** Version bump only for package @veramo/did-provider-key\n\n\n\n\n\n# [3.0.0](https://github.com/uport-project/veramo/compare/v2.1.3...v3.0.0) (2021-09-20)\n\n**Note:** Version bump only for package @veramo/did-provider-key\n\n\n\n\n\n# [2.1.0](https://github.com/uport-project/veramo/compare/v2.0.1...v2.1.0) (2021-08-11)\n\n**Note:** Version bump only for package @veramo/did-provider-key\n\n\n\n\n\n# [2.0.0](https://github.com/uport-project/veramo/compare/v1.2.2...v2.0.0) (2021-07-14)\n\n\n### Features\n\n* add fake did method usable in tests ([4fc587c](https://github.com/uport-project/veramo/commit/4fc587cf07a56b2065c7c6beec2345001f5a5f40))\n* **cli:** export new agent methods and request LD DIDDocument by default ([#617](https://github.com/uport-project/veramo/issues/617)) ([26d088b](https://github.com/uport-project/veramo/commit/26d088b86ecfd66a00cdef7c7bb926148f46fbc9))\n\n\n\n\n\n# [1.2.0](https://github.com/uport-project/veramo/compare/v1.1.2...v1.2.0) (2021-04-27)\n\n\n### Bug Fixes\n\n* **deps:** update all non-major dependencies ([#462](https://github.com/uport-project/veramo/issues/462)) ([4a2b206](https://github.com/uport-project/veramo/commit/4a2b20633810b45a155bf2149cbff57d157bda3c))\n* **deps:** update dependency multibase to v4 ([#396](https://github.com/uport-project/veramo/issues/396)) ([7ea7a8d](https://github.com/uport-project/veramo/commit/7ea7a8d38b36be82f8eb9f025783fd95e9b51508))\n* **deps:** update dependency multicodec to v3 ([#398](https://github.com/uport-project/veramo/issues/398)) ([9e23a10](https://github.com/uport-project/veramo/commit/9e23a102506792d199fed5820a01290de2474392))\n\n\n### Features\n\n* add native resolver for did:key ([#458](https://github.com/uport-project/veramo/issues/458)) ([a026f24](https://github.com/uport-project/veramo/commit/a026f247ad91dcb3a996e0e95b0fe253cf538f8b)), closes [#352](https://github.com/uport-project/veramo/issues/352)\n* **did-provider-key:** add did:key provider; fixes [#335](https://github.com/uport-project/veramo/issues/335) ([#351](https://github.com/uport-project/veramo/issues/351)) ([42cd2b0](https://github.com/uport-project/veramo/commit/42cd2b08a2fd21b5b5d7bdfa57dd00ccc7184dc7)), closes [decentralized-identity/did-jwt#78](https://github.com/decentralized-identity/did-jwt/issues/78)\n"
  },
  {
    "path": "packages/did-provider-key/LICENSE",
    "content": "                                 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 2019 Consensys AG\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"
  },
  {
    "path": "packages/did-provider-key/README.md",
    "content": "# Veramo did:key provider\n\nThis package contains an implementation of `AbstractIdentifierProvider` for the `did:key` method.\nThis enables creation and control of `did:key` entities.\n"
  },
  {
    "path": "packages/did-provider-key/__tests__/key-did-provider.test.ts",
    "content": "import { IDIDManager, IKeyManager, IResolver } from '../../core-types/src'\nimport { createAgent } from '../../core/src'\nimport { DIDManager, MemoryDIDStore } from '../../did-manager/src'\nimport { DIDResolverPlugin } from '../../did-resolver/src'\nimport { KeyManager, MemoryKeyStore, MemoryPrivateKeyStore } from '../../key-manager/src'\nimport { KeyManagementSystem } from '../../kms-local/src'\n\nimport { getDidKeyResolver, KeyDIDProvider } from '../src'\n\nconst defaultKms = 'mem'\n\nconst agent = createAgent<IKeyManager & IDIDManager & IResolver>({\n  plugins: [\n    new KeyManager({\n      store: new MemoryKeyStore(),\n      kms: {\n        [defaultKms]: new KeyManagementSystem(new MemoryPrivateKeyStore()),\n      },\n    }),\n    new DIDManager({\n      providers: {\n        'did:key': new KeyDIDProvider({\n          defaultKms,\n        }),\n      },\n      defaultProvider: 'did:key',\n      store: new MemoryDIDStore(),\n    }),\n    new DIDResolverPlugin(getDidKeyResolver()),\n  ],\n})\n\ndescribe('@veramo/did-provider-key', () => {\n  it('should create identifier with no params', async () => {\n    const did = await agent.didManagerCreate({})\n    expect(did).toBeDefined()\n    expect(did.did).toMatch(/^did:key:.*/)\n  })\n\n  it('should create identifier with Ed25519 key', async () => {\n    const did = await agent.didManagerCreate({\n      options: {\n        key: {\n          type: 'Ed25519',\n        }\n      }\n    })\n    expect(did).toBeDefined()\n    expect(did.did).toMatch(/^did:key:z6Mk.*/)\n  })\n\n  it('should create identifier with X25519 key', async () => {\n    const did = await agent.didManagerCreate({\n      options: {\n        key: {\n          type: 'X25519'\n        }\n      }\n    })\n    expect(did).toBeDefined()\n    expect(did.did).toMatch(/^did:key:z6LS.*/)\n  })\n\n  it('should create identifier with Secp256k1 key', async () => {\n    const did = await agent.didManagerCreate({\n      options: {\n        key: {\n          type: 'Secp256k1'\n        }\n      }\n    })\n    expect(did).toBeDefined()\n    expect(did.did).toMatch(/^did:key:zQ3s.*/)\n  })\n\n  it('should create identifier with Ed25519 key ref', async () => {\n    const privateKeyHex = '06eb9e64569203679b36f834a4d9725c989d32a7fb52c341eae3517b3aff8ee6'\n    const key = await agent.keyManagerImport({\n      kms: defaultKms,\n      type: 'Ed25519',\n      privateKeyHex\n    })\n    const did = await agent.didManagerCreate({\n      options: {\n        keyRef: key.kid\n      }\n    })\n    expect(did).toBeDefined()\n    expect(did.did).toMatch(/^did:key:z6Mkq3FR8bz4e3oDcbHhGAmfUUW7bdCtEL2vK2Fsw16Z99Vk$/)\n  })\n\n  it('should create identifier with X25519 key ref', async () => {\n    const privateKeyHex = '06eb9e64569203679b36f834a4d9725c989d32a7fb52c341eae3517b3aff8ee6'\n    const key = await agent.keyManagerImport({\n      kms: defaultKms,\n      type: 'X25519',\n      privateKeyHex\n    })\n    const did = await agent.didManagerCreate({\n      options: {\n        keyRef: key.kid\n      }\n    })\n    expect(did).toBeDefined()\n    expect(did.did).toMatch(/^did:key:z6LSk74Z9nwqCr3M6Y2JNFEz1aQUaG2Ehnvc8XGjuK9LzbkS$/)\n  })\n\n  it('should create identifier with Secp256k1 key ref', async () => {\n    const privateKeyHex = '06eb9e64569203679b36f834a4d9725c989d32a7fb52c341eae3517b3aff8ee6'\n    const key = await agent.keyManagerImport({\n      kms: defaultKms,\n      type: 'Secp256k1',\n      privateKeyHex\n    })\n    const did = await agent.didManagerCreate({\n      options: {\n        keyRef: key.kid\n      }\n    })\n    expect(did).toBeDefined()\n    expect(did.did).toMatch(/^did:key:zQ3shmh97kcXoAqLZLjjc86HB5YNPGBekgFq7W7LmpEwE5mov$/)\n  })\n\n  it('should create identifier with Ed25519 key given a private key', async () => {\n    const privateKeyHex = '06eb9e64569203679b36f834a4d9725c989d32a7fb52c341eae3517b3aff8ee6'\n    const did = await agent.didManagerCreate({\n      options: {\n        key: {\n          type: 'Ed25519',\n          privateKeyHex\n        }\n      }\n    })\n    expect(did).toBeDefined()\n    expect(did.did).toMatch(/^did:key:z6Mkq3FR8bz4e3oDcbHhGAmfUUW7bdCtEL2vK2Fsw16Z99Vk$/)\n  })\n\n  it('should create identifier with X25519 key given a private key', async () => {\n    const privateKeyHex = '06eb9e64569203679b36f834a4d9725c989d32a7fb52c341eae3517b3aff8ee6'\n    const did = await agent.didManagerCreate({\n      options: {\n        key: {\n          type: 'X25519',\n          privateKeyHex\n        }\n      }\n    })\n    expect(did).toBeDefined()\n    expect(did.did).toMatch(/^did:key:z6LSk74Z9nwqCr3M6Y2JNFEz1aQUaG2Ehnvc8XGjuK9LzbkS$/)\n  })\n\n  it('should create identifier with Secp256k1 key given a private key', async () => {\n    const privateKeyHex = '06eb9e64569203679b36f834a4d9725c989d32a7fb52c341eae3517b3aff8ee6'\n    const did = await agent.didManagerCreate({\n      options: {\n        key: {\n          type: 'Secp256k1',\n          privateKeyHex\n        }\n      }\n    })\n    expect(did).toBeDefined()\n    expect(did.did).toMatch(/^did:key:zQ3shmh97kcXoAqLZLjjc86HB5YNPGBekgFq7W7LmpEwE5mov$/)\n  })\n\n  describe('deprecated config format', () => {\n    it('should create identifier with Ed25519 key', async () => {\n      const did = await agent.didManagerCreate({ options: { keyType: 'Ed25519' } })\n      expect(did).toBeDefined()\n      expect(did.did).toMatch(/^did:key:z6Mk.*/)\n    })\n  \n    it('should create identifier with X25519 key', async () => {\n      const did = await agent.didManagerCreate({ options: { keyType: 'X25519' } })\n      expect(did).toBeDefined()\n      expect(did.did).toMatch(/^did:key:z6LS.*/)\n    })\n  \n    it('should create identifier with Secp256k1 key', async () => {\n      const did = await agent.didManagerCreate({ options: { keyType: 'Secp256k1' } })\n      expect(did).toBeDefined()\n      expect(did.did).toMatch(/^did:key:zQ3s.*/)\n    })\n  \n    it('should create identifier with Ed25519 key given a private key', async () => {\n      const privateKeyHex = '06eb9e64569203679b36f834a4d9725c989d32a7fb52c341eae3517b3aff8ee6'\n      const did = await agent.didManagerCreate({ options: { keyType: 'Ed25519', privateKeyHex } })\n      expect(did).toBeDefined()\n      expect(did.did).toMatch(/^did:key:z6Mkq3FR8bz4e3oDcbHhGAmfUUW7bdCtEL2vK2Fsw16Z99Vk$/)\n    })\n  \n    it('should create identifier with X25519 key given a private key', async () => {\n      const privateKeyHex = '06eb9e64569203679b36f834a4d9725c989d32a7fb52c341eae3517b3aff8ee6'\n      const did = await agent.didManagerCreate({ options: { keyType: 'X25519', privateKeyHex } })\n      expect(did).toBeDefined()\n      expect(did.did).toMatch(/^did:key:z6LSk74Z9nwqCr3M6Y2JNFEz1aQUaG2Ehnvc8XGjuK9LzbkS$/)\n    })\n  \n    it('should create identifier with Secp256k1 key given a private key', async () => {\n      const privateKeyHex = '06eb9e64569203679b36f834a4d9725c989d32a7fb52c341eae3517b3aff8ee6'\n      const did = await agent.didManagerCreate({ options: { keyType: 'Secp256k1', privateKeyHex } })\n      expect(did).toBeDefined()\n      expect(did.did).toMatch(/^did:key:zQ3shmh97kcXoAqLZLjjc86HB5YNPGBekgFq7W7LmpEwE5mov$/)\n    })\n  })\n})\n"
  },
  {
    "path": "packages/did-provider-key/api-extractor.json",
    "content": "{\n  \"$schema\": \"https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json\",\n  \"apiReport\": {\n    \"enabled\": true,\n    \"reportFolder\": \"./api\",\n    \"reportTempFolder\": \"./api\"\n  },\n\n  \"docModel\": {\n    \"enabled\": true,\n    \"apiJsonFilePath\": \"./api/<unscopedPackageName>.api.json\"\n  },\n\n  \"dtsRollup\": {\n    \"enabled\": false\n  },\n  \"mainEntryPointFilePath\": \"<projectFolder>/build/index.d.ts\"\n}\n"
  },
  {
    "path": "packages/did-provider-key/package.json",
    "content": "{\n  \"name\": \"@veramo/did-provider-key\",\n  \"description\": \"Veramo plugin that can enable creation and control of did:key identifiers.\",\n  \"version\": \"7.0.0\",\n  \"main\": \"build/index.js\",\n  \"exports\": \"./build/index.js\",\n  \"types\": \"build/index.d.ts\",\n  \"scripts\": {\n    \"build\": \"tsc\",\n    \"extract-api\": \"node ../cli/bin/veramo.js dev extract-api\"\n  },\n  \"dependencies\": {\n    \"@veramo/core-types\": \"workspace:^\",\n    \"@veramo/did-manager\": \"workspace:^\",\n    \"@veramo/utils\": \"workspace:^\",\n    \"debug\": \"^4.3.3\",\n    \"did-resolver\": \"^4.1.0\",\n    \"ethers\": \"^6.13.4\"\n  },\n  \"devDependencies\": {\n    \"@types/debug\": \"4.1.8\",\n    \"typescript\": \"5.7.3\"\n  },\n  \"resolutions\": {\n    \"jsonld\": \"npm:@digitalcredentials/jsonld@^6.0.0\"\n  },\n  \"files\": [\n    \"build/**/*\",\n    \"src/**/*\",\n    \"README.md\",\n    \"LICENSE\"\n  ],\n  \"publishConfig\": {\n    \"access\": \"public\"\n  },\n  \"repository\": {\n    \"type\": \"git\",\n    \"url\": \"https://github.com/decentralized-identity/veramo.git\",\n    \"directory\": \"packages/did-provider-key\"\n  },\n  \"author\": \"Consensys Mesh R&D <hello@veramo.io>\",\n  \"contributors\": [\n    \"Oliver Terbu\",\n    \"Simonas Karuzas <simonas.karuzas@mesh.xyz>\",\n    \"Mircea Nistor <mircea.nistor@mesh.xyz>\"\n  ],\n  \"keywords\": [\n    \"Veramo\",\n    \"DID\",\n    \"Verifiable Credential\",\n    \"veramo-plugin\",\n    \"did:key\",\n    \"multibase\",\n    \"multiformats\",\n    \"Ed25519\",\n    \"X25519\",\n    \"Secp256k1\"\n  ],\n  \"license\": \"Apache-2.0\",\n  \"type\": \"module\",\n  \"moduleDirectories\": [\n    \"node_modules\",\n    \"src\"\n  ]\n}\n"
  },
  {
    "path": "packages/did-provider-key/src/__tests__/key.resolver.test.ts",
    "content": "import { Resolver } from 'did-resolver'\nimport { getDidKeyResolver } from '../resolver.js'\n\nconst resolver = new Resolver(getDidKeyResolver())\n\ndescribe('did:key resolver', () => {\n  describe('Ed25519', () => {\n    it('should resolve with defaults', async () => {\n      const sigMultibase = 'z6MkhaXgBZDvotDkL5257faiztiGiC2QtKLGpbnnEGta2doK'\n      const encMultibase = 'z6LSj72tK8brWgZja8NLRwPigth2T9QRiG1uH9oKZuKjdh9p'\n      const did = `did:key:${sigMultibase}`\n      const result = await resolver.resolve(did)\n\n      const expectedResult = {\n        didDocumentMetadata: { contentType: 'application/did+ld+json' },\n        didResolutionMetadata: {},\n        didDocument: {\n          id: did,\n          verificationMethod: [\n            {\n              id: `${did}#${sigMultibase}`,\n              type: 'JsonWebKey2020',\n              controller: did,\n              publicKeyJwk: {\n                alg: 'EdDSA',\n                crv: 'Ed25519',\n                kty: 'OKP',\n                use: 'sig',\n                x: 'Lm_M42cB3HkUiODQsXRcweM6TByfzEHGO9ND274JcOY',\n              },\n            },\n            {\n              id: `${did}#${encMultibase}`,\n              type: 'JsonWebKey2020',\n              controller: did,\n              publicKeyJwk: {\n                alg: 'ECDH-ES',\n                crv: 'X25519',\n                kty: 'OKP',\n                use: 'enc',\n                x: 'bl_3kgKpz9jgsg350CNuHa_kQL3B60Gi-98WmdQW2h8',\n              },\n            },\n          ],\n          authentication: [`${did}#${sigMultibase}`],\n          assertionMethod: [`${did}#${sigMultibase}`],\n          capabilityDelegation: [`${did}#${sigMultibase}`],\n          capabilityInvocation: [`${did}#${sigMultibase}`],\n          keyAgreement: [`${did}#${encMultibase}`],\n          '@context': ['https://www.w3.org/ns/did/v1', 'https://w3id.org/security/suites/jws-2020/v1'],\n        },\n      }\n\n      expect(result).toEqual(expectedResult)\n    })\n\n    it('should resolve with Multikey', async () => {\n      const sigMultibase = 'z6MkhaXgBZDvotDkL5257faiztiGiC2QtKLGpbnnEGta2doK'\n      const encMultibase = 'z6LSj72tK8brWgZja8NLRwPigth2T9QRiG1uH9oKZuKjdh9p'\n      const did = `did:key:${sigMultibase}`\n      const result = await resolver.resolve(did, { publicKeyFormat: 'Multikey' })\n\n      const expectedResult = {\n        didDocumentMetadata: { contentType: 'application/did+ld+json' },\n        didResolutionMetadata: {},\n        didDocument: {\n          id: did,\n          verificationMethod: [\n            {\n              id: `${did}#${sigMultibase}`,\n              type: 'Multikey',\n              controller: did,\n              publicKeyMultibase: sigMultibase,\n            },\n            {\n              id: `${did}#${encMultibase}`,\n              type: 'Multikey',\n              controller: did,\n              publicKeyMultibase: encMultibase,\n            },\n          ],\n          authentication: [`${did}#${sigMultibase}`],\n          assertionMethod: [`${did}#${sigMultibase}`],\n          capabilityDelegation: [`${did}#${sigMultibase}`],\n          capabilityInvocation: [`${did}#${sigMultibase}`],\n          keyAgreement: [`${did}#${encMultibase}`],\n          '@context': ['https://www.w3.org/ns/did/v1', 'https://w3id.org/security/multikey/v1'],\n        },\n      }\n\n      expect(result).toEqual(expectedResult)\n    })\n\n    it('should resolve with 2020 suite', async () => {\n      const sigMultibase = 'z6MkhaXgBZDvotDkL5257faiztiGiC2QtKLGpbnnEGta2doK'\n      const encMultibase = 'z6LSj72tK8brWgZja8NLRwPigth2T9QRiG1uH9oKZuKjdh9p'\n      const did = `did:key:${sigMultibase}`\n      const result = await resolver.resolve(did, { publicKeyFormat: 'Ed25519VerificationKey2020' })\n\n      const expectedResult = {\n        didDocumentMetadata: { contentType: 'application/did+ld+json' },\n        didResolutionMetadata: {},\n        didDocument: {\n          id: did,\n          verificationMethod: [\n            {\n              id: `${did}#${sigMultibase}`,\n              type: 'Ed25519VerificationKey2020',\n              controller: did,\n              publicKeyMultibase: sigMultibase,\n            },\n            {\n              id: `${did}#${encMultibase}`,\n              type: 'X25519KeyAgreementKey2020',\n              controller: did,\n              publicKeyMultibase: encMultibase,\n            },\n          ],\n          authentication: [`${did}#${sigMultibase}`],\n          assertionMethod: [`${did}#${sigMultibase}`],\n          capabilityDelegation: [`${did}#${sigMultibase}`],\n          capabilityInvocation: [`${did}#${sigMultibase}`],\n          keyAgreement: [`${did}#${encMultibase}`],\n          '@context': [\n            'https://www.w3.org/ns/did/v1',\n            'https://w3id.org/security/suites/ed25519-2020/v1',\n            'https://w3id.org/security/suites/x25519-2020/v1',\n          ],\n        },\n      }\n\n      expect(result).toEqual(expectedResult)\n    })\n\n    it('should resolve with 2018 suite', async () => {\n      const sigMultibase = 'z6MkhaXgBZDvotDkL5257faiztiGiC2QtKLGpbnnEGta2doK'\n      const encMultibase = 'z6LSj72tK8brWgZja8NLRwPigth2T9QRiG1uH9oKZuKjdh9p'\n      const did = `did:key:${sigMultibase}`\n      const result = await resolver.resolve(did, { publicKeyFormat: 'Ed25519VerificationKey2018' })\n\n      const expectedResult = {\n        didDocumentMetadata: { contentType: 'application/did+ld+json' },\n        didResolutionMetadata: {},\n        didDocument: {\n          id: did,\n          verificationMethod: [\n            {\n              id: `${did}#${sigMultibase}`,\n              type: 'Ed25519VerificationKey2018',\n              controller: did,\n              publicKeyBase58: '48GdbJyVULjHDaBNS6ct9oAGtckZUS5v8asrPzvZ7R1w',\n            },\n            {\n              id: `${did}#${encMultibase}`,\n              type: 'X25519KeyAgreementKey2019',\n              controller: did,\n              publicKeyBase58: '8RrinpnzRDqzUjzZuHsmNJUYbzsK1eqkQB5e5SgCvKP4',\n            },\n          ],\n          authentication: [`${did}#${sigMultibase}`],\n          assertionMethod: [`${did}#${sigMultibase}`],\n          capabilityDelegation: [`${did}#${sigMultibase}`],\n          capabilityInvocation: [`${did}#${sigMultibase}`],\n          keyAgreement: [`${did}#${encMultibase}`],\n          '@context': [\n            'https://www.w3.org/ns/did/v1',\n            'https://w3id.org/security/suites/ed25519-2018/v1',\n            'https://w3id.org/security/suites/x25519-2019/v1',\n          ],\n        },\n      }\n\n      expect(result).toEqual(expectedResult)\n    })\n  })\n\n  describe('X25519', () => {\n    it('should resolve with defaults', async () => {\n      const encMultibase = 'z6LSj72tK8brWgZja8NLRwPigth2T9QRiG1uH9oKZuKjdh9p'\n      const did = `did:key:${encMultibase}`\n      const result = await resolver.resolve(did)\n\n      const expectedResult = {\n        didDocumentMetadata: { contentType: 'application/did+ld+json' },\n        didResolutionMetadata: {},\n        didDocument: {\n          id: did,\n          verificationMethod: [\n            {\n              id: `${did}#${encMultibase}`,\n              type: 'JsonWebKey2020',\n              controller: did,\n              publicKeyJwk: {\n                alg: 'ECDH-ES',\n                crv: 'X25519',\n                kty: 'OKP',\n                use: 'enc',\n                x: 'bl_3kgKpz9jgsg350CNuHa_kQL3B60Gi-98WmdQW2h8',\n              },\n            },\n          ],\n          keyAgreement: [`${did}#${encMultibase}`],\n          '@context': ['https://www.w3.org/ns/did/v1', 'https://w3id.org/security/suites/jws-2020/v1'],\n        },\n      }\n\n      expect(result).toEqual(expectedResult)\n    })\n\n    it('should resolve with Multikey', async () => {\n      const encMultibase = 'z6LSj72tK8brWgZja8NLRwPigth2T9QRiG1uH9oKZuKjdh9p'\n      const did = `did:key:${encMultibase}`\n      const result = await resolver.resolve(did, { publicKeyFormat: 'Multikey' })\n\n      const expectedResult = {\n        didDocumentMetadata: { contentType: 'application/did+ld+json' },\n        didResolutionMetadata: {},\n        didDocument: {\n          id: did,\n          verificationMethod: [\n            {\n              id: `${did}#${encMultibase}`,\n              type: 'Multikey',\n              controller: did,\n              publicKeyMultibase: encMultibase,\n            },\n          ],\n          keyAgreement: [`${did}#${encMultibase}`],\n          '@context': ['https://www.w3.org/ns/did/v1', 'https://w3id.org/security/multikey/v1'],\n        },\n      }\n\n      expect(result).toEqual(expectedResult)\n    })\n\n    it('should resolve with 2020 suite', async () => {\n      const encMultibase = 'z6LSj72tK8brWgZja8NLRwPigth2T9QRiG1uH9oKZuKjdh9p'\n      const did = `did:key:${encMultibase}`\n      const result = await resolver.resolve(did, { publicKeyFormat: 'X25519KeyAgreementKey2020' })\n\n      const expectedResult = {\n        didDocumentMetadata: { contentType: 'application/did+ld+json' },\n        didResolutionMetadata: {},\n        didDocument: {\n          id: did,\n          verificationMethod: [\n            {\n              id: `${did}#${encMultibase}`,\n              type: 'X25519KeyAgreementKey2020',\n              controller: did,\n              publicKeyMultibase: encMultibase,\n            },\n          ],\n          keyAgreement: [`${did}#${encMultibase}`],\n          '@context': ['https://www.w3.org/ns/did/v1', 'https://w3id.org/security/suites/x25519-2020/v1'],\n        },\n      }\n\n      expect(result).toEqual(expectedResult)\n    })\n\n    it('should resolve with 2019 suite', async () => {\n      const encMultibase = 'z6LSj72tK8brWgZja8NLRwPigth2T9QRiG1uH9oKZuKjdh9p'\n      const did = `did:key:${encMultibase}`\n      const result = await resolver.resolve(did, { publicKeyFormat: 'X25519KeyAgreementKey2019' })\n\n      const expectedResult = {\n        didDocumentMetadata: { contentType: 'application/did+ld+json' },\n        didResolutionMetadata: {},\n        didDocument: {\n          id: did,\n          verificationMethod: [\n            {\n              id: `${did}#${encMultibase}`,\n              type: 'X25519KeyAgreementKey2019',\n              controller: did,\n              publicKeyBase58: '8RrinpnzRDqzUjzZuHsmNJUYbzsK1eqkQB5e5SgCvKP4',\n            },\n          ],\n          keyAgreement: [`${did}#${encMultibase}`],\n          '@context': ['https://www.w3.org/ns/did/v1', 'https://w3id.org/security/suites/x25519-2019/v1'],\n        },\n      }\n\n      expect(result).toEqual(expectedResult)\n    })\n  })\n\n  describe('Secp256k1', () => {\n    it('should resolve with defaults', async () => {\n      const sigMultibase = 'zQ3shokFTS3brHcDQrn82RUDfCZESWL1ZdCEJwekUDPQiYBme'\n      const did = `did:key:${sigMultibase}`\n      const result = await resolver.resolve(did)\n\n      const expectedResult = {\n        didDocumentMetadata: { contentType: 'application/did+ld+json' },\n        didResolutionMetadata: {},\n        didDocument: {\n          id: did,\n          verificationMethod: [\n            {\n              id: `${did}#${sigMultibase}`,\n              type: 'JsonWebKey2020',\n              controller: did,\n              publicKeyJwk: {\n                alg: 'ES256K',\n                crv: 'secp256k1',\n                kty: 'EC',\n                use: 'sig',\n                x: 'h0wVx_2iDlOcblulc8E5iEw1EYh5n1RYtLQfeSTyNc0',\n                y: 'O2EATIGbu6DezKFptj5scAIRntgfecanVNXxat1rnwE',\n              },\n            },\n          ],\n          authentication: [`${did}#${sigMultibase}`],\n          assertionMethod: [`${did}#${sigMultibase}`],\n          capabilityDelegation: [`${did}#${sigMultibase}`],\n          capabilityInvocation: [`${did}#${sigMultibase}`],\n          '@context': ['https://www.w3.org/ns/did/v1', 'https://w3id.org/security/suites/jws-2020/v1'],\n        },\n      }\n\n      expect(result).toEqual(expectedResult)\n    })\n\n    it('should resolve with Multikey', async () => {\n      const sigMultibase = 'zQ3shokFTS3brHcDQrn82RUDfCZESWL1ZdCEJwekUDPQiYBme'\n      const did = `did:key:${sigMultibase}`\n      const result = await resolver.resolve(did, { publicKeyFormat: 'Multikey' })\n\n      const expectedResult = {\n        didDocumentMetadata: { contentType: 'application/did+ld+json' },\n        didResolutionMetadata: {},\n        didDocument: {\n          id: did,\n          verificationMethod: [\n            {\n              id: `${did}#${sigMultibase}`,\n              type: 'Multikey',\n              controller: did,\n              publicKeyMultibase: sigMultibase,\n            },\n          ],\n          authentication: [`${did}#${sigMultibase}`],\n          assertionMethod: [`${did}#${sigMultibase}`],\n          capabilityDelegation: [`${did}#${sigMultibase}`],\n          capabilityInvocation: [`${did}#${sigMultibase}`],\n          '@context': ['https://www.w3.org/ns/did/v1', 'https://w3id.org/security/multikey/v1'],\n        },\n      }\n\n      expect(result).toEqual(expectedResult)\n    })\n\n    it('should resolve with 2020 suite', async () => {\n      const sigMultibase = 'zQ3shokFTS3brHcDQrn82RUDfCZESWL1ZdCEJwekUDPQiYBme'\n      const did = `did:key:${sigMultibase}`\n      const result = await resolver.resolve(did, { publicKeyFormat: 'EcdsaSecp256k1VerificationKey2020' })\n\n      const expectedResult = {\n        didDocumentMetadata: { contentType: 'application/did+ld+json' },\n        didResolutionMetadata: {},\n        didDocument: {\n          id: did,\n          verificationMethod: [\n            {\n              id: `${did}#${sigMultibase}`,\n              type: 'EcdsaSecp256k1VerificationKey2020',\n              controller: did,\n              publicKeyMultibase: sigMultibase,\n            },\n          ],\n          authentication: [`${did}#${sigMultibase}`],\n          assertionMethod: [`${did}#${sigMultibase}`],\n          capabilityDelegation: [`${did}#${sigMultibase}`],\n          capabilityInvocation: [`${did}#${sigMultibase}`],\n          '@context': ['https://www.w3.org/ns/did/v1', 'https://w3id.org/security/suites/secp256k1-2020/v1'],\n        },\n      }\n\n      expect(result).toEqual(expectedResult)\n    })\n\n    it('should resolve with 2019 suite', async () => {\n      const sigMultibase = 'zQ3shokFTS3brHcDQrn82RUDfCZESWL1ZdCEJwekUDPQiYBme'\n      const did = `did:key:${sigMultibase}`\n      const result = await resolver.resolve(did, { publicKeyFormat: 'EcdsaSecp256k1VerificationKey2019' })\n\n      const expectedResult = {\n        didDocumentMetadata: { contentType: 'application/did+ld+json' },\n        didResolutionMetadata: {},\n        didDocument: {\n          id: did,\n          verificationMethod: [\n            {\n              id: `${did}#${sigMultibase}`,\n              type: 'EcdsaSecp256k1VerificationKey2019',\n              controller: did,\n              publicKeyMultibase: sigMultibase,\n            },\n          ],\n          authentication: [`${did}#${sigMultibase}`],\n          assertionMethod: [`${did}#${sigMultibase}`],\n          capabilityDelegation: [`${did}#${sigMultibase}`],\n          capabilityInvocation: [`${did}#${sigMultibase}`],\n          '@context': ['https://www.w3.org/ns/did/v1', 'https://w3id.org/security/suites/secp256k1-2019/v1'],\n        },\n      }\n\n      expect(result).toEqual(expectedResult)\n    })\n  })\n\n  describe('P-256', () => {\n    it('should resolve with defaults', async () => {\n      const sigMultibase = 'zDnaerDaTF5BXEavCrfRZEk316dpbLsfPDZ3WJ5hRTPFU2169'\n      const did = `did:key:${sigMultibase}`\n      const result = await resolver.resolve(did)\n\n      const expectedResult = {\n        didDocumentMetadata: { contentType: 'application/did+ld+json' },\n        didResolutionMetadata: {},\n        didDocument: {\n          id: did,\n          verificationMethod: [\n            {\n              id: `${did}#${sigMultibase}`,\n              type: 'JsonWebKey2020',\n              controller: did,\n              publicKeyJwk: {\n                alg: 'ES256',\n                crv: 'P-256',\n                kty: 'EC',\n                use: 'sig',\n                x: 'fyNYMN0976ci7xqiSdag3buk-ZCwgXU4kz9XNkBlNUI',\n                y: 'hW2ojTNfH7Jbi8--CJUo3OCbH3y5n91g-IMA9MLMbTU',\n              },\n            },\n          ],\n          authentication: [`${did}#${sigMultibase}`],\n          assertionMethod: [`${did}#${sigMultibase}`],\n          capabilityDelegation: [`${did}#${sigMultibase}`],\n          capabilityInvocation: [`${did}#${sigMultibase}`],\n          '@context': ['https://www.w3.org/ns/did/v1', 'https://w3id.org/security/suites/jws-2020/v1'],\n        },\n      }\n\n      expect(result).toEqual(expectedResult)\n    })\n\n    it('should resolve with Multikey', async () => {\n      const sigMultibase = 'zDnaerDaTF5BXEavCrfRZEk316dpbLsfPDZ3WJ5hRTPFU2169'\n      const did = `did:key:${sigMultibase}`\n      const result = await resolver.resolve(did, { publicKeyFormat: 'Multikey' })\n\n      const expectedResult = {\n        didDocumentMetadata: { contentType: 'application/did+ld+json' },\n        didResolutionMetadata: {},\n        didDocument: {\n          id: did,\n          verificationMethod: [\n            {\n              id: `${did}#${sigMultibase}`,\n              type: 'Multikey',\n              controller: did,\n              publicKeyMultibase: sigMultibase,\n            },\n          ],\n          authentication: [`${did}#${sigMultibase}`],\n          assertionMethod: [`${did}#${sigMultibase}`],\n          capabilityDelegation: [`${did}#${sigMultibase}`],\n          capabilityInvocation: [`${did}#${sigMultibase}`],\n          '@context': ['https://www.w3.org/ns/did/v1', 'https://w3id.org/security/multikey/v1'],\n        },\n      }\n\n      expect(result).toEqual(expectedResult)\n    })\n\n    it('should resolve with 2019 suite', async () => {\n      const sigMultibase = 'zDnaerDaTF5BXEavCrfRZEk316dpbLsfPDZ3WJ5hRTPFU2169'\n      const did = `did:key:${sigMultibase}`\n      const result = await resolver.resolve(did, { publicKeyFormat: 'EcdsaSecp256r1VerificationKey2019' })\n\n      const expectedResult = {\n        didDocumentMetadata: { contentType: 'application/did+ld+json' },\n        didResolutionMetadata: {},\n        didDocument: {\n          id: did,\n          verificationMethod: [\n            {\n              id: `${did}#${sigMultibase}`,\n              type: 'EcdsaSecp256r1VerificationKey2019',\n              controller: did,\n              publicKeyJwk: {\n                alg: 'ES256',\n                crv: 'P-256',\n                kty: 'EC',\n                use: 'sig',\n                x: 'fyNYMN0976ci7xqiSdag3buk-ZCwgXU4kz9XNkBlNUI',\n                y: 'hW2ojTNfH7Jbi8--CJUo3OCbH3y5n91g-IMA9MLMbTU',\n              },\n            },\n          ],\n          authentication: [`${did}#${sigMultibase}`],\n          assertionMethod: [`${did}#${sigMultibase}`],\n          capabilityDelegation: [`${did}#${sigMultibase}`],\n          capabilityInvocation: [`${did}#${sigMultibase}`],\n          '@context': [\n            'https://www.w3.org/ns/did/v1',\n            {\n              EcdsaSecp256r1VerificationKey2019:\n                'https://w3id.org/security#EcdsaSecp256r1VerificationKey2019',\n              publicKeyJwk: {\n                '@id': 'https://w3id.org/security#publicKeyJwk',\n                '@type': '@json',\n              },\n            },\n          ],\n        },\n      }\n\n      expect(result).toEqual(expectedResult)\n    })\n  })\n})\n"
  },
  {
    "path": "packages/did-provider-key/src/index.ts",
    "content": "/**\n * Provides `did:key` {@link @veramo/did-provider-key#KeyDIDProvider | identifier provider } for the\n * {@link @veramo/did-manager#DIDManager}\n *\n * @packageDocumentation\n */\nexport { KeyDIDProvider } from './key-did-provider.js'\nexport { getDidKeyResolver } from './resolver.js'\n"
  },
  {
    "path": "packages/did-provider-key/src/key-did-provider.ts",
    "content": "import { IAgentContext, IIdentifier, IKey, IKeyManager, IService } from '@veramo/core-types'\nimport { AbstractIdentifierProvider } from '@veramo/did-manager'\nimport { hexToBytes, bytesToMultibase, importOrCreateKey, CreateIdentifierBaseOptions } from '@veramo/utils'\nimport { SigningKey } from 'ethers'\n\nimport Debug from 'debug'\n\nconst debug = Debug('veramo:did-key:identifier-provider')\n\ntype IContext = IAgentContext<IKeyManager>\ntype CreateKeyDidOptions = CreateIdentifierBaseOptions<keyof typeof keyCodecs> & {\n  /**\n   * @deprecated use key.type instead\n   */\n  keyType?: keyof typeof keyCodecs\n\n  /**\n   * @deprecated use key.privateKeyHex instead\n   */\n  privateKeyHex?: string\n}\n\nconst keyCodecs = {\n  Ed25519: 'ed25519-pub',\n  X25519: 'x25519-pub',\n  Secp256k1: 'secp256k1-pub',\n} as const\n\n/**\n * {@link @veramo/did-manager#DIDManager} identifier provider for `did:key` identifiers\n *\n * @beta This API may change without a BREAKING CHANGE notice.\n */\nexport class KeyDIDProvider extends AbstractIdentifierProvider {\n  private defaultKms: string\n\n  constructor(options: { defaultKms: string }) {\n    super()\n    this.defaultKms = options.defaultKms\n  }\n\n  async createIdentifier(\n    { kms, options }: { kms?: string; options?: CreateKeyDidOptions },\n    context: IContext,\n  ): Promise<Omit<IIdentifier, 'provider'>> {\n    let keyType = (options?.key?.type && keyCodecs[options?.key.type] && options.key.type) || \n                    (options?.keyType && keyCodecs[options?.keyType] && options.keyType) ||\n                    'Ed25519'\n    const privateKeyHex = options?.key?.privateKeyHex || options?.privateKeyHex\n\n    let key: IKey\n\n    if (options?.keyRef) {\n      key = await context.agent.keyManagerGet({ kid: options.keyRef })\n      if (!Object.keys(keyCodecs).includes(key.type)) {\n        throw new Error(`not_supported: Key type ${key.type} is not supported`)\n      }\n      keyType = key.type as keyof typeof keyCodecs\n    } else {\n      key = await importOrCreateKey(\n        {\n          kms: kms || this.defaultKms,\n          options: {\n            ...(options?.key ?? {}),\n            type: keyType,\n            privateKeyHex,\n          },\n        },\n        context,\n      )\n    }\n\n    const publicKeyHex = key.type === 'Secp256k1' ? SigningKey.computePublicKey('0x' + key.publicKeyHex, true) : key.publicKeyHex\n    const methodSpecificId: string = bytesToMultibase(hexToBytes(publicKeyHex), 'base58btc', keyCodecs[keyType])\n\n    const identifier: Omit<IIdentifier, 'provider'> = {\n      did: 'did:key:' + methodSpecificId,\n      controllerKeyId: key.kid,\n      keys: [key],\n      services: [],\n    }\n    debug('Created', identifier.did)\n    return identifier\n  }\n\n  async updateIdentifier(\n    args: {\n      did: string\n      kms?: string | undefined\n      alias?: string | undefined\n      options?: any\n    },\n    context: IAgentContext<IKeyManager>,\n  ): Promise<IIdentifier> {\n    throw new Error('KeyDIDProvider updateIdentifier not supported yet.')\n  }\n\n  async deleteIdentifier(identifier: IIdentifier, context: IContext): Promise<boolean> {\n    for (const { kid } of identifier.keys) {\n      await context.agent.keyManagerDelete({ kid })\n    }\n    return true\n  }\n\n  async addKey(\n    { identifier, key, options }: { identifier: IIdentifier; key: IKey; options?: any },\n    context: IContext,\n  ): Promise<any> {\n    throw Error('KeyDIDProvider addKey not supported')\n  }\n\n  async addService(\n    { identifier, service, options }: { identifier: IIdentifier; service: IService; options?: any },\n    context: IContext,\n  ): Promise<any> {\n    throw Error('KeyDIDProvider addService not supported')\n  }\n\n  async removeKey(\n    args: { identifier: IIdentifier; kid: string; options?: any },\n    context: IContext,\n  ): Promise<any> {\n    throw Error('KeyDIDProvider removeKey not supported')\n  }\n\n  async removeService(\n    args: { identifier: IIdentifier; id: string; options?: any },\n    context: IContext,\n  ): Promise<any> {\n    throw Error('KeyDIDProvider removeService not supported')\n  }\n}\n"
  },
  {
    "path": "packages/did-provider-key/src/resolver.ts",
    "content": "import {\n  DIDDocument,\n  DIDResolutionOptions,\n  DIDResolutionResult,\n  DIDResolver,\n  ParsedDID,\n  Resolvable,\n  VerificationMethod,\n} from 'did-resolver'\nimport {\n  bytesToBase58,\n  bytesToMultibase,\n  convertEd25519PublicKeyToX25519,\n  createJWK,\n  multibaseToBytes,\n} from '@veramo/utils'\n\nenum SupportedVerificationMethods {\n  'JsonWebKey2020',\n  'Multikey',\n  'EcdsaSecp256k1VerificationKey2019', // deprecated,\n  'EcdsaSecp256k1VerificationKey2020',\n  'Ed25519VerificationKey2020',\n  'Ed25519VerificationKey2018', // deprecated,\n  'X25519KeyAgreementKey2020',\n  'X25519KeyAgreementKey2019', // deprecated,\n  'EcdsaSecp256r1VerificationKey2019',\n}\n\nexport type DIDKeyResolverOptions = DIDResolutionOptions & {\n  enableEncryptionKeyDerivation?: boolean // defaults to true\n  publicKeyFormat?: keyof typeof SupportedVerificationMethods // defaults to 'JsonWebKey2020'\n  // experimentalPublicKeyFormat?: false // not supported\n  // defaultContext?: string[] // not supported\n}\n\nconst contextFromKeyFormat: Record<keyof typeof SupportedVerificationMethods, string | object> = {\n  JsonWebKey2020: 'https://w3id.org/security/suites/jws-2020/v1',\n  Multikey: 'https://w3id.org/security/multikey/v1',\n  EcdsaSecp256k1VerificationKey2020: 'https://w3id.org/security/suites/secp256k1-2020/v1',\n  EcdsaSecp256k1VerificationKey2019: 'https://w3id.org/security/suites/secp256k1-2019/v1', // deprecated\n  Ed25519VerificationKey2020: 'https://w3id.org/security/suites/ed25519-2020/v1',\n  Ed25519VerificationKey2018: 'https://w3id.org/security/suites/ed25519-2018/v1', // deprecated\n  X25519KeyAgreementKey2020: 'https://w3id.org/security/suites/x25519-2020/v1',\n  X25519KeyAgreementKey2019: 'https://w3id.org/security/suites/x25519-2019/v1', // deprecated\n  EcdsaSecp256r1VerificationKey2019: {\n    EcdsaSecp256r1VerificationKey2019: 'https://w3id.org/security#EcdsaSecp256r1VerificationKey2019',\n    publicKeyJwk: {\n      '@id': 'https://w3id.org/security#publicKeyJwk',\n      '@type': '@json',\n    },\n  },\n}\n\nfunction resolveECDSA(did: string, options: DIDKeyResolverOptions) {\n  const publicKeyFormat = options?.publicKeyFormat ?? 'JsonWebKey2020'\n  const keyMultibase = did.substring(8)\n  const { keyBytes, keyType } = multibaseToBytes(keyMultibase)\n\n  if (!keyType) {\n    throw new Error(`invalidDid: the key type cannot be deduced for ${did}`)\n  }\n\n  const jwkKeyType = keyType === 'P-256' ? 'Secp256r1' : keyType\n\n  let verificationMethod: VerificationMethod = {\n    id: `${did}#${keyMultibase}`,\n    type: publicKeyFormat,\n    controller: did,\n  }\n  switch (publicKeyFormat) {\n    case 'JsonWebKey2020':\n    case 'EcdsaSecp256r1VerificationKey2019':\n      verificationMethod.publicKeyJwk = createJWK(jwkKeyType as any, keyBytes, 'sig')\n      break\n    case 'Multikey':\n    case 'EcdsaSecp256k1VerificationKey2019':\n    case 'EcdsaSecp256k1VerificationKey2020':\n      verificationMethod.publicKeyMultibase = keyMultibase\n      break\n    default:\n      throw new Error(`invalidPublicKeyType: Unsupported public key format ${publicKeyFormat}`)\n  }\n  let ldContext = {}\n  const acceptedFormat = options.accept ?? 'application/did+ld+json'\n  if (options.accept === 'application/did+json') {\n    ldContext = {}\n  } else if (acceptedFormat === 'application/did+ld+json') {\n    ldContext = {\n      '@context': ['https://www.w3.org/ns/did/v1', contextFromKeyFormat[publicKeyFormat]],\n    }\n  } else {\n    throw new Error(\n      `unsupportedFormat: The DID resolver does not support the requested 'accept' format: ${options.accept}`,\n    )\n  }\n\n  return {\n    didResolutionMetadata: {},\n    didDocumentMetadata: { contentType: options.accept ?? 'application/did+ld+json' },\n    didDocument: {\n      ...ldContext,\n      id: did,\n      verificationMethod: [verificationMethod],\n      authentication: [verificationMethod.id],\n      assertionMethod: [verificationMethod.id],\n      capabilityDelegation: [verificationMethod.id],\n      capabilityInvocation: [verificationMethod.id],\n    },\n  }\n}\n\nfunction resolveEDDSA(did: string, options: DIDKeyResolverOptions) {\n  const publicKeyFormat = options?.publicKeyFormat ?? 'JsonWebKey2020'\n  const keyMultibase = did.substring(8)\n  const { keyBytes, keyType } = multibaseToBytes(keyMultibase)\n\n  if (!keyType || keyType !== 'Ed25519') {\n    throw new Error(`invalidDid: the key type cannot be deduced for ${did}`)\n  }\n\n  let verificationMethod: VerificationMethod = {\n    id: `${did}#${keyMultibase}`,\n    type: publicKeyFormat,\n    controller: did,\n  }\n  let keyAgreementKeyFormat: keyof typeof SupportedVerificationMethods = publicKeyFormat\n\n  switch (publicKeyFormat) {\n    case 'JsonWebKey2020':\n      verificationMethod.publicKeyJwk = createJWK(keyType as any, keyBytes, 'sig')\n      break\n    case 'Multikey':\n      verificationMethod.publicKeyMultibase = keyMultibase\n      break\n    case 'Ed25519VerificationKey2020':\n      keyAgreementKeyFormat = 'X25519KeyAgreementKey2020'\n      verificationMethod.publicKeyMultibase = keyMultibase\n      break\n    case 'Ed25519VerificationKey2018':\n      keyAgreementKeyFormat = 'X25519KeyAgreementKey2019'\n      verificationMethod.publicKeyBase58 = bytesToBase58(keyBytes)\n      break\n    default:\n      throw new Error(`invalidPublicKeyType: Unsupported public key format ${publicKeyFormat}`)\n  }\n  const ldContextArray: any[] = ['https://www.w3.org/ns/did/v1', contextFromKeyFormat[publicKeyFormat]]\n\n  const result: DIDResolutionResult = {\n    didResolutionMetadata: {},\n    didDocumentMetadata: { contentType: options.accept ?? 'application/did+ld+json' },\n    didDocument: {\n      id: did,\n      verificationMethod: [verificationMethod],\n      authentication: [verificationMethod.id],\n      assertionMethod: [verificationMethod.id],\n      capabilityDelegation: [verificationMethod.id],\n      capabilityInvocation: [verificationMethod.id],\n    },\n  }\n\n  const useEncryptionKey = options.enableEncryptionKeyDerivation ?? true\n\n  if (useEncryptionKey) {\n    const encryptionKeyBytes = convertEd25519PublicKeyToX25519(keyBytes)\n    const encryptionKeyMultibase = bytesToMultibase(encryptionKeyBytes, 'base58btc', 'x25519-pub')\n    const encryptionKey: VerificationMethod = {\n      id: `${did}#${encryptionKeyMultibase}`,\n      type: keyAgreementKeyFormat,\n      controller: did,\n    }\n    if (keyAgreementKeyFormat === 'JsonWebKey2020') {\n      encryptionKey.publicKeyJwk = createJWK('X25519', encryptionKeyBytes, 'enc')\n    } else if (keyAgreementKeyFormat === 'X25519KeyAgreementKey2019') {\n      ldContextArray.push(contextFromKeyFormat[keyAgreementKeyFormat])\n      encryptionKey.publicKeyBase58 = bytesToBase58(encryptionKeyBytes)\n    } else {\n      if (keyAgreementKeyFormat === 'X25519KeyAgreementKey2020') {\n        ldContextArray.push(contextFromKeyFormat[keyAgreementKeyFormat])\n      }\n      encryptionKey.publicKeyMultibase = encryptionKeyMultibase\n    }\n    result.didDocument?.verificationMethod?.push(encryptionKey)\n    result.didDocument!.keyAgreement = [encryptionKey.id]\n  }\n\n  let ldContext = {}\n  const acceptedFormat = options.accept ?? 'application/did+ld+json'\n  if (options.accept === 'application/did+json') {\n    ldContext = {}\n  } else if (acceptedFormat === 'application/did+ld+json') {\n    ldContext = {\n      '@context': ldContextArray,\n    }\n  } else {\n    throw new Error(\n      `unsupportedFormat: The DID resolver does not support the requested 'accept' format: ${options.accept}`,\n    )\n  }\n\n  result.didDocument = { ...result.didDocument, ...ldContext } as DIDDocument\n\n  return result\n}\n\nfunction resolveX25519(did: string, options: DIDKeyResolverOptions) {\n  const publicKeyFormat = options?.publicKeyFormat ?? 'JsonWebKey2020'\n  const keyMultibase = did.substring(8)\n  const { keyBytes, keyType } = multibaseToBytes(keyMultibase)\n\n  if (!keyType || keyType !== 'X25519') {\n    throw new Error(`invalidDid: the key type cannot be deduced for ${did}`)\n  }\n\n  let verificationMethod: VerificationMethod = {\n    id: `${did}#${keyMultibase}`,\n    type: publicKeyFormat,\n    controller: did,\n  }\n\n  switch (publicKeyFormat) {\n    case 'JsonWebKey2020':\n      verificationMethod.publicKeyJwk = createJWK(keyType as any, keyBytes, 'enc')\n      break\n    case 'Multikey':\n    case 'X25519KeyAgreementKey2020':\n      verificationMethod.publicKeyMultibase = keyMultibase\n      break\n    case 'X25519KeyAgreementKey2019':\n      verificationMethod.publicKeyBase58 = bytesToBase58(keyBytes)\n      break\n    default:\n      throw new Error(`invalidPublicKeyType: Unsupported public key format ${publicKeyFormat}`)\n  }\n  const ldContextArray = ['https://www.w3.org/ns/did/v1', contextFromKeyFormat[publicKeyFormat]]\n\n  const result = {\n    didResolutionMetadata: {},\n    didDocumentMetadata: { contentType: options.accept ?? 'application/did+ld+json' },\n    didDocument: {\n      id: did,\n      verificationMethod: [verificationMethod],\n      keyAgreement: [verificationMethod.id],\n    },\n  }\n\n  let ldContext = {}\n  const acceptedFormat = options.accept ?? 'application/did+ld+json'\n  if (options.accept === 'application/did+json') {\n    ldContext = {}\n  } else if (acceptedFormat === 'application/did+ld+json') {\n    ldContext = {\n      '@context': ldContextArray,\n    }\n  } else {\n    throw new Error(\n      `unsupportedFormat: The DID resolver does not support the requested 'accept' format: ${options.accept}`,\n    )\n  }\n\n  result.didDocument = { ...result.didDocument, ...ldContext }\n\n  return result\n}\n\nexport const didPrefixMap: Record<string, Function> = {\n  'did:key:z6Mk': resolveEDDSA,\n  'did:key:z6LS': resolveX25519,\n  'did:key:zQ3s': resolveECDSA, // compressed Secp256k1 keys\n  'did:key:z7r8': resolveECDSA, // uncompressed Secp256k1 keys\n  'did:key:zDn': resolveECDSA, // compressed P-256 keys\n  // 'did:key:z82': resolveP384, // compressed P-384 keys - not supported yet\n  // 'did:key:zUC7': resolveBLS12381, // BLS12381 keys - not supported yet\n}\n\nconst resolveDidKey: DIDResolver = async (\n  didUrl: string,\n  _parsed: ParsedDID,\n  _resolver: Resolvable,\n  options: DIDKeyResolverOptions,\n): Promise<DIDResolutionResult> => {\n  try {\n    const matchedResolver = Object.keys(didPrefixMap)\n      .filter((prefix) => didUrl.startsWith(prefix))\n      .shift()\n    if (matchedResolver) {\n      const didResolution = await didPrefixMap[matchedResolver](didUrl, options)\n      return {\n        didDocumentMetadata: {},\n        didResolutionMetadata: {},\n        ...didResolution,\n      }\n    } else {\n      return {\n        didDocumentMetadata: {},\n        didResolutionMetadata: { error: 'invalidDid', message: 'unsupported key type for did:key' },\n        didDocument: null,\n      }\n    }\n  } catch (err: any) {\n    return {\n      didDocumentMetadata: {},\n      didResolutionMetadata: { error: 'invalidDid', message: err.toString() },\n      didDocument: null,\n    }\n  }\n}\n\n/**\n * Provides a mapping to a did:key resolver, usable by {@link did-resolver#Resolver}.\n *\n * @public\n */\nexport function getDidKeyResolver() {\n  return { key: resolveDidKey }\n}\n"
  },
  {
    "path": "packages/did-provider-key/tsconfig.json",
    "content": "{\n  \"extends\": \"../tsconfig.settings.json\",\n  \"compilerOptions\": {\n    \"rootDir\": \"src\",\n    \"outDir\": \"build\",\n    \"declarationDir\": \"build\",\n    \"skipLibCheck\": true\n  },\n  \"references\": [\n    {\"path\": \"../core-types\"},\n    {\"path\": \"../did-manager\"},\n    {\"path\": \"../utils\"}\n  ]\n}\n"
  },
  {
    "path": "packages/did-provider-peer/CHANGELOG.md",
    "content": "# Change Log\n\nAll notable changes to this project will be documented in this file.\nSee [Conventional Commits](https://conventionalcommits.org) for commit guidelines.\n\n# [7.0.0](https://github.com/decentralized-identity/veramo/compare/v6.0.2...v7.0.0) (2026-02-11)\n\n\n### Bug Fixes\n\n* **deps:** update devdeps and bump typeorm to 0.3.20 ([#1272](https://github.com/decentralized-identity/veramo/issues/1272)) ([7d17f37](https://github.com/decentralized-identity/veramo/commit/7d17f37ea7cc4e73a8cdae028681ae1be5c4d11c))\n\n\n### Features\n\n* improve key creation/import options when creating identifiers ([#1423](https://github.com/decentralized-identity/veramo/issues/1423)) ([12aa854](https://github.com/decentralized-identity/veramo/commit/12aa854baa384805f4cae6360720f2e9a5a484aa))\n\n\n\n\n\n## [6.0.2](https://github.com/decentralized-identity/veramo/compare/v6.0.1...v6.0.2) (2026-01-16)\n\n**Note:** Version bump only for package @veramo/did-provider-peer\n\n\n\n\n\n## [6.0.1](https://github.com/decentralized-identity/veramo/compare/v6.0.0...v6.0.1) (2026-01-16)\n\n**Note:** Version bump only for package @veramo/did-provider-peer\n\n\n\n\n\n# [6.0.0](https://github.com/decentralized-identity/veramo/compare/v5.6.0...v6.0.0) (2024-04-02)\n\n\n### Bug Fixes\n\n* **did-provider-key:** align did:key resolver to spec ([#1332](https://github.com/decentralized-identity/veramo/issues/1332)) ([8e3b94c](https://github.com/decentralized-identity/veramo/commit/8e3b94cf997619d7adcb5cb8827e0f55ff88cdb5)), closes [#1330](https://github.com/decentralized-identity/veramo/issues/1330)\n\n\n### Features\n\n* add Multikey support ([#1316](https://github.com/decentralized-identity/veramo/issues/1316)) ([165de35](https://github.com/decentralized-identity/veramo/commit/165de3549ccfd3d7c84514608ac3ea9e56a7b807))\n* **cli:** add support for did:jwk and did:peer to CLI ([#1320](https://github.com/decentralized-identity/veramo/issues/1320)) ([3ac343e](https://github.com/decentralized-identity/veramo/commit/3ac343e52dbd744c137bbe610cba9f5409a6100c))\n* **did-comm:** Improve DIDComm Service compatibility ([#1340](https://github.com/decentralized-identity/veramo/issues/1340)) ([6df704c](https://github.com/decentralized-identity/veramo/commit/6df704c769d49fb399f515f102a41736a678070d))\n\n\n### BREAKING CHANGES\n\n* **did-comm:** the DIDComm Message structure has changed. The message can now specify multiple recipients in the `to` property.\n\n\n\n\n\n# [5.6.0](https://github.com/decentralized-identity/veramo/compare/v5.5.3...v5.6.0) (2024-01-16)\n\n\n### Features\n\n* **remote-client:** allow dynamic headers param for AgentRestClient constructor ([#1314](https://github.com/decentralized-identity/veramo/issues/1314)) ([1b8a0a2](https://github.com/decentralized-identity/veramo/commit/1b8a0a2718dd63492ad3a312a6ebe5f6e7849935)), closes [#1313](https://github.com/decentralized-identity/veramo/issues/1313)\n\n\n\n\n\n## [5.5.3](https://github.com/decentralized-identity/veramo/compare/v5.5.2...v5.5.3) (2023-10-09)\n\n\n### Bug Fixes\n\n* use DIF URLs in packages ([#1271](https://github.com/decentralized-identity/veramo/issues/1271)) ([3dfc601](https://github.com/decentralized-identity/veramo/commit/3dfc6014cdee7902c59d8db76b4c8507b870f227))\n\n\n\n\n\n# [5.5.0](https://github.com/uport-project/veramo/compare/v5.4.1...v5.5.0) (2023-09-19)\n\n\n### Bug Fixes\n\n* **did-provider-key:** use compressed keys for creating Secp256k1 did:key ([#1217](https://github.com/uport-project/veramo/issues/1217)) ([ba8f6f5](https://github.com/uport-project/veramo/commit/ba8f6f5b9b701e57af86491504ecd209ca0c1c1d)), closes [#1213](https://github.com/uport-project/veramo/issues/1213)\n\n\n\n\n\n## [5.4.1](https://github.com/uport-project/veramo/compare/v5.4.0...v5.4.1) (2023-08-04)\n\n\n### Bug Fixes\n\n* **ci:** benign change meant to tag all packages for another patch release ([#1211](https://github.com/uport-project/veramo/issues/1211)) ([41b5c90](https://github.com/uport-project/veramo/commit/41b5c90277171b7b38c5cf49ca01db5cf75b6300))\n* **deps:** Update did-vc-libraries to v6 ([3cadd56](https://github.com/uport-project/veramo/commit/3cadd56356a23463acc04f9a8a58239a9475b1c1))\n\n\n\n\n\n# [5.4.0](https://github.com/uport-project/veramo/compare/v5.3.0...v5.4.0) (2023-08-01)\n\n\n### Bug Fixes\n\n* **deps:** Update dependency @aviarytech/did-peer to ^0.0.21 ([1f84ae7](https://github.com/uport-project/veramo/commit/1f84ae7140d3e58e9117ec6969ad118ad2f1d9e5))\n\n\n\n\n\n# [5.3.0](https://github.com/uport-project/veramo/compare/v5.2.0...v5.3.0) (2023-07-27)\n\n\n### Bug Fixes\n\n* **deps:** update dependency multiformats to v12 ([11fa7c3](https://github.com/uport-project/veramo/commit/11fa7c340da78101ea5e974e8ae0f90193933976))\n\n\n\n\n\n# [5.2.0](https://github.com/uport-project/veramo/compare/v5.1.4...v5.2.0) (2023-05-02)\n\n\n### Features\n\n* add did-peer provider and resolver ([#1156](https://github.com/uport-project/veramo/issues/1156)) ([9502063](https://github.com/uport-project/veramo/commit/95020632f741bd4640b3496b7b1bf19f5e6641d0))\n"
  },
  {
    "path": "packages/did-provider-peer/LICENSE",
    "content": "                                 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 2019 Consensys AG\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"
  },
  {
    "path": "packages/did-provider-peer/README.md",
    "content": "# Veramo did:peer provider\n\nThis package contains an implementation of `AbstractIdentifierProvider` for the `did:peer` method.\nThis enables creation and control of `did:peer` entities.\n"
  },
  {
    "path": "packages/did-provider-peer/api-extractor.json",
    "content": "{\n  \"$schema\": \"https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json\",\n  \"apiReport\": {\n    \"enabled\": true,\n    \"reportFolder\": \"./api\",\n    \"reportTempFolder\": \"./api\"\n  },\n\n  \"docModel\": {\n    \"enabled\": true,\n    \"apiJsonFilePath\": \"./api/<unscopedPackageName>.api.json\"\n  },\n\n  \"dtsRollup\": {\n    \"enabled\": false\n  },\n  \"mainEntryPointFilePath\": \"<projectFolder>/build/index.d.ts\"\n}\n"
  },
  {
    "path": "packages/did-provider-peer/package.json",
    "content": "{\n  \"name\": \"@veramo/did-provider-peer\",\n  \"description\": \"Veramo plugin that can enable creation and control of did:peer identifiers.\",\n  \"version\": \"7.0.0\",\n  \"main\": \"build/index.js\",\n  \"exports\": \"./build/index.js\",\n  \"types\": \"build/index.d.ts\",\n  \"scripts\": {\n    \"build\": \"tsc\",\n    \"extract-api\": \"node ../cli/bin/veramo.js dev extract-api\"\n  },\n  \"dependencies\": {\n    \"@aviarytech/did-peer\": \"^0.0.22\",\n    \"@veramo/core-types\": \"workspace:^\",\n    \"@veramo/did-manager\": \"workspace:^\",\n    \"@veramo/utils\": \"workspace:^\",\n    \"debug\": \"^4.3.3\",\n    \"did-resolver\": \"^4.1.0\"\n  },\n  \"devDependencies\": {\n    \"@types/debug\": \"4.1.8\",\n    \"typescript\": \"5.7.3\"\n  },\n  \"resolutions\": {\n    \"jsonld\": \"npm:@digitalcredentials/jsonld@^6.0.0\"\n  },\n  \"files\": [\n    \"build/**/*\",\n    \"src/**/*\",\n    \"README.md\",\n    \"LICENSE\"\n  ],\n  \"publishConfig\": {\n    \"access\": \"public\"\n  },\n  \"repository\": {\n    \"type\": \"git\",\n    \"url\": \"https://github.com/decentralized-identity/veramo.git\",\n    \"directory\": \"packages/did-provider-key\"\n  },\n  \"author\": \"Consensys Mesh R&D <hello@veramo.io>\",\n  \"contributors\": [\n    \"Nick Reynolds <nick.reynolds@mesh.xyz>\",\n    \"Alex Andrei <alex.andrei@rootsid.com>\",\n    \"Mircea Nistor <mircea.nistor@mesh.xyz>\"\n  ],\n  \"keywords\": [\n    \"Veramo\",\n    \"DID\",\n    \"Verifiable Credential\",\n    \"veramo-plugin\",\n    \"did:peer\",\n    \"num_algo\",\n    \"DIDComm\",\n    \"ServiceEndpoint\"\n  ],\n  \"license\": \"Apache-2.0\",\n  \"type\": \"module\",\n  \"moduleDirectories\": [\n    \"node_modules\",\n    \"src\"\n  ]\n}\n"
  },
  {
    "path": "packages/did-provider-peer/src/index.ts",
    "content": "/**\n * Provides `did:key` {@link @veramo/did-provider-peer#PeerDIDProvider | identifier provider } for the\n * {@link @veramo/did-manager#DIDManager}\n *\n * @packageDocumentation\n */\nexport { PeerDIDProvider } from './peer-did-provider.js'\nexport { getResolver } from './resolver.js'\n"
  },
  {
    "path": "packages/did-provider-peer/src/peer-did-provider.ts",
    "content": "import { IAgentContext, IIdentifier, IKey, IKeyManager, IService } from '@veramo/core-types'\nimport { AbstractIdentifierProvider } from '@veramo/did-manager'\nimport { bytesToBase64url, bytesToMultibase, hexToBytes, stringToUtf8Bytes, importOrCreateKey, CreateIdentifierBaseOptions, ImportOrCreateKeyOptions } from '@veramo/utils'\n\nimport Debug from 'debug'\n\nconst debug = Debug('veramo:did-peer:identifier-provider')\n\ntype IContext = IAgentContext<IKeyManager>\n\nconst ServiceReplacements = {\n  type: 't',\n  DIDCommMessaging: 'dm',\n  serviceEndpoint: 's',\n  routingKeys: 'r',\n  accept: 'a',\n}\n\nconst encodeService = (service: IService): string => {\n  let encoded = JSON.stringify(service)\n  Object.values(ServiceReplacements).forEach((v: string, idx: number) => {\n    encoded = encoded.replace(Object.keys(ServiceReplacements)[idx], v)\n  })\n  return bytesToBase64url(stringToUtf8Bytes(encoded))\n}\n\ntype CreatePeerDidOptions = CreateIdentifierBaseOptions<'Ed25519'> & {\n  num_algo: number\n  // keyType?: keyof typeof keyCodecs // defaulting to Ed25519 keys only in this implementation\n  \n  /**\n   * @deprecated use key.privateKeyHex instead\n   */\n  authPrivateKeyHex?: string\n\n  /**\n   * @deprecated use agreementKey.privateKeyHex instead\n   */\n  agreementPrivateKeyHex?: string\n\n  service?: IService\n\n  agreementKeyRef?: string;\n  agreementKey?: ImportOrCreateKeyOptions<'X25519'>\n}\n\n/**\n * {@link @veramo/did-manager#DIDManager} identifier provider for `did:key` identifiers\n *\n * @beta This API may change without a BREAKING CHANGE notice.\n */\nexport class PeerDIDProvider extends AbstractIdentifierProvider {\n  private defaultKms: string\n\n  constructor(options: { defaultKms: string }) {\n    super()\n    this.defaultKms = options.defaultKms\n  }\n\n  async createIdentifier(\n    { kms, options }: { kms?: string; options?: CreatePeerDidOptions },\n    context: IContext,\n  ): Promise<Omit<IIdentifier, 'provider'>> {\n    options = options ?? { num_algo: 0 }\n    if (options.service) {\n      options.num_algo = 2\n    }\n\n    const authPrivateKeyHex = options?.key?.privateKeyHex || options?.authPrivateKeyHex\n    const agreementPrivateKeyHex = options?.agreementKey?.privateKeyHex || options?.agreementPrivateKeyHex\n    \n    let key: IKey\n    let agreementKey: IKey | undefined\n\n    // Exit early so we don't create a key if we can't continue\n    if (![0, 2].includes(options.num_algo)) {\n      throw new Error(`not_supported: PeerDIDProvider num algo ${options.num_algo} not supported yet.`)\n    }\n\n    if (options.agreementKeyRef) {\n      agreementKey = await context.agent.keyManagerGet({ kid: options.agreementKeyRef })\n      if (agreementKey.type !== 'X25519') {\n        throw new Error('not_supported: Key type must be X25519')\n      }\n    }\n\n    if (options.keyRef) {\n      key = await context.agent.keyManagerGet({ kid: options.keyRef })\n      if (key.type !== 'Ed25519') {\n        throw new Error('not_supported: Key type must be Ed25519')\n      }\n    } else {\n      key = await importOrCreateKey({\n        kms: kms || this.defaultKms,\n        options: {\n          ...(options?.key ?? {}),\n          type: 'Ed25519',\n          privateKeyHex: authPrivateKeyHex,\n        }\n      }, context)\n    }\n\n    switch (options.num_algo) {\n      case 0: {\n        const methodSpecificId = bytesToMultibase(hexToBytes(key.publicKeyHex), 'base58btc', 'ed25519-pub')\n        const identifier: Omit<IIdentifier, 'provider'> = {\n          did: 'did:peer:0' + methodSpecificId,\n          controllerKeyId: key.kid,\n          keys: [key],\n          services: [],\n        }\n        debug('Created', identifier.did)\n        return identifier\n      }\n\n      case 2: {\n        if (!agreementKey) {\n          agreementKey = await importOrCreateKey({\n            kms: kms || this.defaultKms,\n            options: {\n              ...(options?.agreementKey ?? {}),\n              type: 'X25519',\n              privateKeyHex: agreementPrivateKeyHex,\n            }\n          }, context)\n        }\n\n        const authKeyText = bytesToMultibase(hexToBytes(key.publicKeyHex), 'base58btc', 'ed25519-pub')\n\n        const agreementKeyText = bytesToMultibase(\n          hexToBytes(agreementKey.publicKeyHex),\n          'base58btc',\n          'x25519-pub',\n        )\n\n        let serviceString = ''\n\n        if (options.service) {\n          serviceString = `.S${encodeService(options.service)}`\n        }\n\n        const identifier: Omit<IIdentifier, 'provider'> = {\n          did: `did:peer:2.E${agreementKeyText}.V${authKeyText}${serviceString}`,\n          controllerKeyId: key.kid,\n          keys: [key, agreementKey],\n          services: options.service ? [options.service] : [],\n        }\n        debug('Created', identifier.did)\n        return identifier\n      }\n\n      default:\n        throw new Error(`'not_supported: PeerDIDProvider num algo ${options.num_algo} not supported yet.'`)\n    }\n  }\n\n  async updateIdentifier(\n    args: { did: string; kms?: string | undefined; alias?: string | undefined; options?: any },\n    context: IAgentContext<IKeyManager>,\n  ): Promise<IIdentifier> {\n    throw new Error('not_supported: PeerDIDProvider updateIdentifier not supported yet.')\n  }\n\n  async deleteIdentifier(identifier: IIdentifier, context: IContext): Promise<boolean> {\n    for (const { kid } of identifier.keys) {\n      await context.agent.keyManagerDelete({ kid })\n    }\n    return true\n  }\n\n  async addKey(\n    { identifier, key, options }: { identifier: IIdentifier; key: IKey; options?: any },\n    context: IContext,\n  ): Promise<any> {\n    throw Error('not_supported: PeerDIDProvider addKey not supported')\n  }\n\n  async addService(\n    { identifier, service, options }: { identifier: IIdentifier; service: IService; options?: any },\n    context: IContext,\n  ): Promise<any> {\n    throw Error('not_supported: PeerDIDProvider addService not supported')\n  }\n\n  async removeKey(\n    args: { identifier: IIdentifier; kid: string; options?: any },\n    context: IContext,\n  ): Promise<any> {\n    throw Error('not_supported: PeerDIDProvider removeKey not supported')\n  }\n\n  async removeService(\n    args: { identifier: IIdentifier; id: string; options?: any },\n    context: IContext,\n  ): Promise<any> {\n    throw Error('not_supported: PeerDIDProvider removeService not supported')\n  }\n}\n"
  },
  {
    "path": "packages/did-provider-peer/src/resolver.ts",
    "content": "import { DIDDocument, DIDResolutionResult, DIDResolver, ParsedDID, Service } from 'did-resolver'\nimport { resolve } from '@aviarytech/did-peer'\n\n/**\n * Creates a DID Resolver that can resolve Peer DIDs (for the 0 and 2 num_algo values)\n *\n * @public\n */\nexport function getResolver(): Record<string, DIDResolver> {\n  async function resolveInner(did: string, parsed: ParsedDID): Promise<DIDResolutionResult> {\n    const didDocumentMetadata = {}\n    let didDocument: DIDDocument | null = null\n    let err = ''\n    do {\n      try {\n        const doc = await resolve(did)\n        didDocument = {\n          '@context': doc['@context'],\n          id: doc.id,\n          verificationMethod: doc.verificationMethod,\n          keyAgreement: doc.keyAgreement,\n          authentication: doc.authentication,\n          assertionMethod: doc.assertionMethod,\n          capabilityInvocation: doc.capabilityInvocation,\n          capabilityDelegation: doc.capabilityDelegation,\n          service: doc.service as Service[],\n        }\n        if (doc.alsoKnownAs) {\n          didDocument.alsoKnownAs = [doc.alsoKnownAs]\n        }\n        if (doc.controller) {\n          didDocument.controller = doc.controller\n        }\n      } catch (error) {\n        err = `resolver_error: DID must resolve to a valid https URL containing a JSON document: ${error}`\n        break\n      }\n\n      // TODO: this excludes the use of query params\n      const docIdMatchesDid = didDocument?.id === did\n      if (!docIdMatchesDid) {\n        err = 'resolver_error: DID document id does not match requested did'\n        // break // uncomment this when adding more checks\n      }\n      // eslint-disable-next-line no-constant-condition\n    } while (false)\n\n    const contentType =\n      typeof didDocument?.['@context'] !== 'undefined' ? 'application/did+ld+json' : 'application/did+json'\n\n    if (err) {\n      return {\n        didDocument,\n        didDocumentMetadata,\n        didResolutionMetadata: {\n          error: 'notFound',\n          message: err,\n        },\n      }\n    } else {\n      return {\n        didDocument,\n        didDocumentMetadata,\n        didResolutionMetadata: { contentType },\n      }\n    }\n  }\n\n  return { peer: resolveInner }\n}\n"
  },
  {
    "path": "packages/did-provider-peer/tsconfig.json",
    "content": "{\n  \"extends\": \"../tsconfig.settings.json\",\n  \"compilerOptions\": {\n    \"rootDir\": \"src\",\n    \"outDir\": \"build\",\n    \"declarationDir\": \"build\",\n    \"skipLibCheck\": true\n  },\n  \"references\": [\n    {\"path\": \"../core-types\"},\n    {\"path\": \"../did-manager\"},\n    {\"path\": \"../utils\"}\n  ]\n}\n"
  },
  {
    "path": "packages/did-provider-pkh/CHANGELOG.md",
    "content": "# Change Log\n\nAll notable changes to this project will be documented in this file.\nSee [Conventional Commits](https://conventionalcommits.org) for commit guidelines.\n\n# [7.0.0](https://github.com/decentralized-identity/veramo/compare/v6.0.2...v7.0.0) (2026-02-11)\n\n\n### Bug Fixes\n\n* **deps:** update devdeps and bump typeorm to 0.3.20 ([#1272](https://github.com/decentralized-identity/veramo/issues/1272)) ([7d17f37](https://github.com/decentralized-identity/veramo/commit/7d17f37ea7cc4e73a8cdae028681ae1be5c4d11c))\n* **key-manager:** handling of `kid` param when creating keys ([#1492](https://github.com/decentralized-identity/veramo/issues/1492)) ([4c52549](https://github.com/decentralized-identity/veramo/commit/4c52549daa215fe3b791d56a156f88144d11733e))\n\n\n### Features\n\n* improve key creation/import options when creating identifiers ([#1423](https://github.com/decentralized-identity/veramo/issues/1423)) ([12aa854](https://github.com/decentralized-identity/veramo/commit/12aa854baa384805f4cae6360720f2e9a5a484aa))\n\n\n\n\n\n## [6.0.2](https://github.com/decentralized-identity/veramo/compare/v6.0.1...v6.0.2) (2026-01-16)\n\n**Note:** Version bump only for package @veramo/did-provider-pkh\n\n\n\n\n\n## [6.0.1](https://github.com/decentralized-identity/veramo/compare/v6.0.0...v6.0.1) (2026-01-16)\n\n**Note:** Version bump only for package @veramo/did-provider-pkh\n\n\n\n\n\n# [6.0.0](https://github.com/decentralized-identity/veramo/compare/v5.6.0...v6.0.0) (2024-04-02)\n\n**Note:** Version bump only for package @veramo/did-provider-pkh\n\n\n\n\n\n# [5.6.0](https://github.com/decentralized-identity/veramo/compare/v5.5.3...v5.6.0) (2024-01-16)\n\n\n### Features\n\n* **remote-client:** allow dynamic headers param for AgentRestClient constructor ([#1314](https://github.com/decentralized-identity/veramo/issues/1314)) ([1b8a0a2](https://github.com/decentralized-identity/veramo/commit/1b8a0a2718dd63492ad3a312a6ebe5f6e7849935)), closes [#1313](https://github.com/decentralized-identity/veramo/issues/1313)\n\n\n\n\n\n## [5.5.3](https://github.com/decentralized-identity/veramo/compare/v5.5.2...v5.5.3) (2023-10-09)\n\n\n### Bug Fixes\n\n* use DIF URLs in packages ([#1271](https://github.com/decentralized-identity/veramo/issues/1271)) ([3dfc601](https://github.com/decentralized-identity/veramo/commit/3dfc6014cdee7902c59d8db76b4c8507b870f227))\n\n\n\n\n\n# [5.5.0](https://github.com/uport-project/veramo/compare/v5.4.1...v5.5.0) (2023-09-19)\n\n\n### Bug Fixes\n\n* **did-provider-key:** use compressed keys for creating Secp256k1 did:key ([#1217](https://github.com/uport-project/veramo/issues/1217)) ([ba8f6f5](https://github.com/uport-project/veramo/commit/ba8f6f5b9b701e57af86491504ecd209ca0c1c1d)), closes [#1213](https://github.com/uport-project/veramo/issues/1213)\n\n\n\n\n\n## [5.4.1](https://github.com/uport-project/veramo/compare/v5.4.0...v5.4.1) (2023-08-04)\n\n\n### Bug Fixes\n\n* **ci:** benign change meant to tag all packages for another patch release ([#1211](https://github.com/uport-project/veramo/issues/1211)) ([41b5c90](https://github.com/uport-project/veramo/commit/41b5c90277171b7b38c5cf49ca01db5cf75b6300))\n\n\n\n\n\n# [5.4.0](https://github.com/uport-project/veramo/compare/v5.3.0...v5.4.0) (2023-08-01)\n\n\n### Features\n\n* **did-comm:** add support for the AES based content and key encryption algorithms ([#1180](https://github.com/uport-project/veramo/issues/1180)) ([5294a81](https://github.com/uport-project/veramo/commit/5294a812ee578c0712b54f216416c3ef78c848da))\n\n\n\n\n\n# [5.3.0](https://github.com/uport-project/veramo/compare/v5.2.0...v5.3.0) (2023-07-27)\n\n**Note:** Version bump only for package @veramo/did-provider-pkh\n\n\n\n\n\n## [5.1.2](https://github.com/uport-project/veramo/compare/v5.1.1...v5.1.2) (2023-02-25)\n\n**Note:** Version bump only for package @veramo/did-provider-pkh\n\n\n\n\n\n# [5.1.0](https://github.com/uport-project/veramo/compare/v5.0.0...v5.1.0) (2023-02-24)\n\n\n### Bug Fixes\n\n* add missing `.js` file extension for ESM import ([#1123](https://github.com/uport-project/veramo/issues/1123)) ([6c850ac](https://github.com/uport-project/veramo/commit/6c850ac40f7dd0104c61851eee20551b1bb69ff6)), closes [#1122](https://github.com/uport-project/veramo/issues/1122)\n\n\n\n\n\n# [5.0.0](https://github.com/uport-project/veramo/compare/v4.3.0...v5.0.0) (2023-02-09)\n\n\n### Bug Fixes\n\n* **did-provider-pkh:** add missing caip dependency ([#1112](https://github.com/uport-project/veramo/issues/1112)) ([60bc5fd](https://github.com/uport-project/veramo/commit/60bc5fd6f654236c072f7943494b3e27bd045ce8)), closes [#1111](https://github.com/uport-project/veramo/issues/1111)\n* **did-provider-pkh:** refactor and simplify did:pkh plugin ([#1113](https://github.com/uport-project/veramo/issues/1113)) ([42be48f](https://github.com/uport-project/veramo/commit/42be48ffe2251510f7bd5e10b43362e816655eb9))\n\n\n### Build System\n\n* convert veramo modules to ESM instead of CommonJS ([#1103](https://github.com/uport-project/veramo/issues/1103)) ([b5cea3c](https://github.com/uport-project/veramo/commit/b5cea3c0d80d900a47bd1d9eea68f84b70a35e7b)), closes [#1099](https://github.com/uport-project/veramo/issues/1099)\n\n\n### Features\n\n* isolate `core-types` package from `core` ([#1116](https://github.com/uport-project/veramo/issues/1116)) ([ba7a303](https://github.com/uport-project/veramo/commit/ba7a303de91cf4cc568a3af1ddf8ca98ed022e9f))\n\n\n### BREAKING CHANGES\n\n* this is a breaking change as modules will have to be imported differently: \n* https://www.typescriptlang.org/docs/handbook/esm-node.html\n* https://nodejs.org/api/esm.html\n* https://caniuse.com/?search=modules\n\ntest(did-provider-ion): skip a couple of tests that fail with unreasonable errors\nchore: use ubuntu-latest on CI\nfix: temporarily remove puppeteer tests\nfix: use craco for test-react-app to enable babel config\ntest: fix unit and integration tests (browser tests still broken)\nfix: fix some build issues that prevented tests from working\nfix: missing deps flagged by pnpm\n\n\n\n\n\n# [4.3.0](https://github.com/uport-project/veramo/compare/v4.2.0...v4.3.0) (2023-01-27)\n\n**Note:** Version bump only for package @veramo/did-provider-pkh\n\n\n\n\n\n# [4.2.0](https://github.com/uport-project/veramo/compare/v4.1.2...v4.2.0) (2022-12-05)\n\n\n### Features\n\n* **did-provider-pkh:** implement did:pkh support. ([#1052](https://github.com/uport-project/veramo/issues/1052)) ([5ad0bfb](https://github.com/uport-project/veramo/commit/5ad0bfb713dca8fd24b99ddf053335340a39e7b3)), closes [#1024](https://github.com/uport-project/veramo/issues/1024)\n"
  },
  {
    "path": "packages/did-provider-pkh/LICENSE",
    "content": "                                 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 2019 Consensys AG\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"
  },
  {
    "path": "packages/did-provider-pkh/README.md",
    "content": "# Veramo did:pkh provider\n\nThis package contains an implementation of `AbstractIdentifierProvider` for the `did:pkh` method.\nThis enables creation and control of `did:pkh` entities.\n"
  },
  {
    "path": "packages/did-provider-pkh/api-extractor.json",
    "content": "{\n  \"$schema\": \"https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json\",\n  \"apiReport\": {\n    \"enabled\": true,\n    \"reportFolder\": \"./api\",\n    \"reportTempFolder\": \"./api\"\n  },\n\n  \"docModel\": {\n    \"enabled\": true,\n    \"apiJsonFilePath\": \"./api/<unscopedPackageName>.api.json\"\n  },\n\n  \"dtsRollup\": {\n    \"enabled\": false\n  },\n  \"mainEntryPointFilePath\": \"<projectFolder>/build/index.d.ts\"\n}\n"
  },
  {
    "path": "packages/did-provider-pkh/package.json",
    "content": "{\n  \"name\": \"@veramo/did-provider-pkh\",\n  \"description\": \"Veramo plugin that can enable creation and control of did:pkh identifiers.\",\n  \"version\": \"7.0.0\",\n  \"main\": \"build/index.js\",\n  \"exports\": \"./build/index.js\",\n  \"types\": \"build/index.d.ts\",\n  \"scripts\": {\n    \"build\": \"tsc\",\n    \"extract-api\": \"node ../cli/bin/veramo.js dev extract-api\"\n  },\n  \"dependencies\": {\n    \"@veramo/core-types\": \"workspace:^\",\n    \"@veramo/did-manager\": \"workspace:^\",\n    \"@veramo/utils\": \"workspace:^\",\n    \"caip\": \"^1.1.0\",\n    \"debug\": \"^4.3.3\",\n    \"did-resolver\": \"^4.1.0\",\n    \"ethers\": \"^6.13.4\"\n  },\n  \"devDependencies\": {\n    \"@types/debug\": \"4.1.8\",\n    \"typescript\": \"5.7.3\"\n  },\n  \"files\": [\n    \"build/**/*\",\n    \"src/**/*\",\n    \"README.md\",\n    \"LICENSE\"\n  ],\n  \"publishConfig\": {\n    \"access\": \"public\"\n  },\n  \"repository\": {\n    \"type\": \"git\",\n    \"url\": \"https://github.com/decentralized-identity/veramo.git\",\n    \"directory\": \"packages/did-provider-pkh\"\n  },\n  \"author\": \"Diego Chagastelles <dchagastelles@gmail.com>\",\n  \"contributors\": [\n    \"Consensys Mesh R&D <hello@veramo.io>\",\n    \"Mircea Nistor <mircea.nistor@mesh.xyz>\",\n    \"Simonas Karuzas <simonas.karuzas@mesh.xyz>\"\n  ],\n  \"keywords\": [\n    \"Veramo\",\n    \"DID\",\n    \"Verifiable Credential\",\n    \"veramo-plugin\",\n    \"did:pkh\",\n    \"public key\",\n    \"hash\",\n    \"blockchainAccountId\",\n    \"ethereum\",\n    \"cosmos\"\n  ],\n  \"license\": \"Apache-2.0\",\n  \"type\": \"module\",\n  \"moduleDirectories\": [\n    \"node_modules\",\n    \"src\"\n  ]\n}\n"
  },
  {
    "path": "packages/did-provider-pkh/src/index.ts",
    "content": "/**\n * Provides `did:pkh` {@link @veramo/did-provider-pkh#PkhDIDProvider | identifier provider } for the\n * {@link @veramo/did-manager#DIDManager}\n *\n * @packageDocumentation\n */\nexport { PkhDIDProvider } from './pkh-did-provider.js'\nexport { getResolver as getDidPkhResolver } from './resolver.js'\n"
  },
  {
    "path": "packages/did-provider-pkh/src/pkh-did-provider.ts",
    "content": "import { computeAddress } from 'ethers'\nimport { IAgentContext, IIdentifier, IKey, IKeyManager, IService } from '@veramo/core-types'\n\nimport { AbstractIdentifierProvider } from '@veramo/did-manager'\nimport { importOrCreateKey, CreateIdentifierBaseOptions } from '@veramo/utils'\nimport Debug from 'debug'\n\nconst debug = Debug('veramo:pkh-did-provider')\n\ntype IContext = IAgentContext<IKeyManager>\n\nconst isIn = <T>(values: readonly T[], value: any): value is T => {\n  return values.includes(value)\n}\n\nexport const SECPK1_NAMESPACES = ['eip155'] as const\nexport const isValidNamespace = (x: string) => isIn(SECPK1_NAMESPACES, x)\n\n/**\n * Options for creating a did:pkh\n * @beta\n */\nexport type CreateDidPkhOptions = CreateIdentifierBaseOptions<'Secp256k1'> & {\n  namespace: string\n  /**\n   * @deprecated use key.privateKeyHex instead\n   */\n  privateKey: string\n  /**\n   * This can be hex encoded chain ID (string) or a chainId number\n   *\n   * If this is not specified, `1` is assumed.\n   */\n  chainId?: string | number\n}\n\n/**\n * Helper method that can computes the ethereumAddress corresponding to a Secp256k1 public key.\n * @param hexPublicKey A hex encoded public key, optionally prefixed with `0x`\n */\nexport function toEthereumAddress(hexPublicKey: string): string {\n  const publicKey = hexPublicKey.startsWith('0x') ? hexPublicKey : '0x' + hexPublicKey\n  return computeAddress(publicKey)\n}\n\n/**\n * {@link @veramo/did-manager#DIDManager} identifier provider for `did:pkh` identifiers\n *\n * @beta This API may change without a BREAKING CHANGE notice.\n */\nexport class PkhDIDProvider extends AbstractIdentifierProvider {\n  private defaultKms: string\n  private chainId: string\n\n  constructor(options: { defaultKms: string; chainId?: string }) {\n    super()\n    this.defaultKms = options.defaultKms\n    this.chainId = options?.chainId ? options.chainId : '1'\n  }\n\n  async createIdentifier(\n    { kms, options }: { kms?: string; options?: CreateDidPkhOptions },\n    context: IContext,\n  ): Promise<Omit<IIdentifier, 'provider'>> {\n    const namespace = options?.namespace ? options.namespace : 'eip155'\n\n    if (!isValidNamespace(namespace)) {\n      debug(`invalid_namespace: '${namespace}'. valid namespaces are: ${SECPK1_NAMESPACES}`)\n      throw new Error(`invalid_namespace: '${namespace}'. valid namespaces are: ${SECPK1_NAMESPACES}`)\n    }\n\n    const privateKeyHex = options?.key?.privateKeyHex || options?.privateKey\n    let key: IKey\n\n    if (options?.keyRef) {\n      key = await context.agent.keyManagerGet({ kid: options.keyRef })\n\n      if (key.type !== 'Secp256k1') {\n        throw new Error(`not_supported: Key type must be Secp256k1`)\n      }\n    } else {\n      key = await importOrCreateKey(\n        {\n          kms: kms || this.defaultKms,\n          options: {\n            ...(options?.key ?? {}),\n            type: 'Secp256k1',\n            privateKeyHex,\n          },\n        },\n        context,\n      )\n    }\n\n    const evmAddress: string = toEthereumAddress(key.publicKeyHex)\n\n    if (key !== null) {\n      const identifier: Omit<IIdentifier, 'provider'> = {\n        did: 'did:pkh:' + namespace + ':' + this.chainId + ':' + evmAddress,\n        controllerKeyId: key.kid,\n        keys: [key],\n        services: [],\n      }\n      return identifier\n    } else {\n      debug('Could not create identifier due to some errors')\n      throw new Error('unknown_error: could not create identifier due to errors creating or importing keys')\n    }\n  }\n\n  async updateIdentifier(\n    args: {\n      did: string\n      kms?: string | undefined\n      alias?: string | undefined\n      options?: any\n    },\n    context: IAgentContext<IKeyManager>,\n  ): Promise<IIdentifier> {\n    throw new Error('illegal_operation: did:pkh update is not possible.')\n  }\n\n  async deleteIdentifier(identifier: IIdentifier, context: IContext): Promise<boolean> {\n    for (const { kid } of identifier.keys) {\n      await context.agent.keyManagerDelete({ kid })\n    }\n    return true\n  }\n\n  async addKey(\n    { identifier, key, options }: { identifier: IIdentifier; key: IKey; options?: any },\n    context: IContext,\n  ): Promise<any> {\n    throw Error('illegal_operation: did:pkh addKey is not possible.')\n  }\n\n  async addService(\n    { identifier, service, options }: { identifier: IIdentifier; service: IService; options?: any },\n    context: IContext,\n  ): Promise<any> {\n    throw Error('illegal_operation: did:pkh addService is not possible.')\n  }\n\n  async removeKey(\n    args: { identifier: IIdentifier; kid: string; options?: any },\n    context: IContext,\n  ): Promise<any> {\n    throw Error('illegal_operation: did:pkh removeKey is not possible.')\n  }\n\n  async removeService(\n    args: { identifier: IIdentifier; id: string; options?: any },\n    context: IContext,\n  ): Promise<any> {\n    throw Error('illegal_operation: did:pkh removeService is not possible.')\n  }\n}\n"
  },
  {
    "path": "packages/did-provider-pkh/src/resolver.ts",
    "content": "import { AccountId, ChainIdParams } from 'caip';\nimport type {\n  DIDResolutionOptions,\n  DIDResolutionResult,\n  ParsedDID,\n  Resolvable,\n  ResolverRegistry,\n} from 'did-resolver';\nimport { isValidNamespace, SECPK1_NAMESPACES } from './pkh-did-provider.js';\nimport Debug from 'debug'\n\nconst debug = Debug('veramo:pkh-did-resolver')\nconst DID_LD_JSON = 'application/did+ld+json';\nconst DID_JSON = 'application/did+json';\n\nfunction toDidDoc(did: string, blockchainAccountId: string): any {\n  const { namespace } = AccountId.parse(blockchainAccountId)\n    .chainId as ChainIdParams;\n  const vmId = did + '#blockchainAccountId';\n  const doc = {\n    '@context': [\n      'https://www.w3.org/ns/did/v1',\n      {\n        blockchainAccountId: 'https://w3id.org/security#blockchainAccountId',\n        EcdsaSecp256k1RecoveryMethod2020:\n          'https://identity.foundation/EcdsaSecp256k1RecoverySignature2020#EcdsaSecp256k1RecoveryMethod2020',\n      },\n    ],\n    id: did,\n    verificationMethod: [\n      {\n        id: vmId,\n        type: 'EcdsaSecp256k1RecoveryMethod2020',\n        controller: did,\n        blockchainAccountId,\n      },\n    ],\n    authentication: [vmId],\n    assertionMethod: [vmId],\n  };\n  if (!isValidNamespace(namespace)) {\n    debug(\n      `Invalid namespace '${namespace}'. Valid namespaces are: ${SECPK1_NAMESPACES}`\n    );\n    throw new Error(\n      `illegal_argument: namespace '${namespace}' not supported. Valid namespaces are: ${SECPK1_NAMESPACES}`\n    );\n  }\n  return doc;\n}\n\n/**\n * Creates a DID resolver that resolves PKH DIDs\n *\n * @public\n */\nexport function getResolver(): ResolverRegistry {\n  return {\n    pkh: async (\n      did: string,\n      parsed: ParsedDID,\n      r: Resolvable,\n      options: DIDResolutionOptions\n    ): Promise<DIDResolutionResult> => {\n      const contentType = options.accept || DID_JSON;\n      const response: DIDResolutionResult = {\n        didResolutionMetadata: { contentType },\n        didDocument: null,\n        didDocumentMetadata: {},\n      };\n      try {\n        const doc = toDidDoc(did, parsed.id);\n        if (contentType === DID_LD_JSON) {\n          response.didDocument = doc;\n        } else if (contentType === DID_JSON) {\n          delete doc['@context'];\n          response.didDocument = doc;\n        } else {\n          delete response.didResolutionMetadata.contentType;\n          response.didResolutionMetadata.error = 'representationNotSupported';\n        }\n      } catch (e) {\n        response.didResolutionMetadata.error = 'invalidDid';\n        response.didResolutionMetadata.message = (e as Error).message;\n      }\n      return response;\n    },\n  };\n}\n"
  },
  {
    "path": "packages/did-provider-pkh/tsconfig.json",
    "content": "{\n  \"extends\": \"../tsconfig.settings.json\",\n  \"compilerOptions\": {\n    \"rootDir\": \"src\",\n    \"outDir\": \"build\",\n    \"declarationDir\": \"build\",\n    \"skipLibCheck\": true\n  },\n  \"references\": [\n    { \"path\": \"../core-types\" },\n    { \"path\": \"../did-manager\" },\n    { \"path\": \"../utils\" }\n  ]\n}\n"
  },
  {
    "path": "packages/did-provider-web/CHANGELOG.md",
    "content": "# Change Log\n\nAll notable changes to this project will be documented in this file.\nSee [Conventional Commits](https://conventionalcommits.org) for commit guidelines.\n\n# [7.0.0](https://github.com/decentralized-identity/veramo/compare/v6.0.2...v7.0.0) (2026-02-11)\n\n\n### Bug Fixes\n\n* **deps:** update devdeps and bump typeorm to 0.3.20 ([#1272](https://github.com/decentralized-identity/veramo/issues/1272)) ([7d17f37](https://github.com/decentralized-identity/veramo/commit/7d17f37ea7cc4e73a8cdae028681ae1be5c4d11c))\n* **key-manager:** handling of `kid` param when creating keys ([#1492](https://github.com/decentralized-identity/veramo/issues/1492)) ([4c52549](https://github.com/decentralized-identity/veramo/commit/4c52549daa215fe3b791d56a156f88144d11733e))\n\n\n### Features\n\n* improve key creation/import options when creating identifiers ([#1423](https://github.com/decentralized-identity/veramo/issues/1423)) ([12aa854](https://github.com/decentralized-identity/veramo/commit/12aa854baa384805f4cae6360720f2e9a5a484aa))\n\n\n\n\n\n## [6.0.2](https://github.com/decentralized-identity/veramo/compare/v6.0.1...v6.0.2) (2026-01-16)\n\n**Note:** Version bump only for package @veramo/did-provider-web\n\n\n\n\n\n## [6.0.1](https://github.com/decentralized-identity/veramo/compare/v6.0.0...v6.0.1) (2026-01-16)\n\n**Note:** Version bump only for package @veramo/did-provider-web\n\n\n\n\n\n# [6.0.0](https://github.com/decentralized-identity/veramo/compare/v5.6.0...v6.0.0) (2024-04-02)\n\n**Note:** Version bump only for package @veramo/did-provider-web\n\n\n\n\n\n# [5.6.0](https://github.com/decentralized-identity/veramo/compare/v5.5.3...v5.6.0) (2024-01-16)\n\n**Note:** Version bump only for package @veramo/did-provider-web\n\n\n\n\n\n## [5.5.3](https://github.com/decentralized-identity/veramo/compare/v5.5.2...v5.5.3) (2023-10-09)\n\n\n### Bug Fixes\n\n* use DIF URLs in packages ([#1271](https://github.com/decentralized-identity/veramo/issues/1271)) ([3dfc601](https://github.com/decentralized-identity/veramo/commit/3dfc6014cdee7902c59d8db76b4c8507b870f227))\n\n\n\n\n\n# [5.5.0](https://github.com/uport-project/veramo/compare/v5.4.1...v5.5.0) (2023-09-19)\n\n\n### Bug Fixes\n\n* **did-provider-key:** use compressed keys for creating Secp256k1 did:key ([#1217](https://github.com/uport-project/veramo/issues/1217)) ([ba8f6f5](https://github.com/uport-project/veramo/commit/ba8f6f5b9b701e57af86491504ecd209ca0c1c1d)), closes [#1213](https://github.com/uport-project/veramo/issues/1213)\n\n\n\n\n\n## [5.4.1](https://github.com/uport-project/veramo/compare/v5.4.0...v5.4.1) (2023-08-04)\n\n\n### Bug Fixes\n\n* **ci:** benign change meant to tag all packages for another patch release ([#1211](https://github.com/uport-project/veramo/issues/1211)) ([41b5c90](https://github.com/uport-project/veramo/commit/41b5c90277171b7b38c5cf49ca01db5cf75b6300))\n\n\n\n\n\n# [5.4.0](https://github.com/uport-project/veramo/compare/v5.3.0...v5.4.0) (2023-08-01)\n\n**Note:** Version bump only for package @veramo/did-provider-web\n\n\n\n\n\n# [5.3.0](https://github.com/uport-project/veramo/compare/v5.2.0...v5.3.0) (2023-07-27)\n\n**Note:** Version bump only for package @veramo/did-provider-web\n\n\n\n\n\n## [5.1.2](https://github.com/uport-project/veramo/compare/v5.1.1...v5.1.2) (2023-02-25)\n\n\n### Bug Fixes\n\n* **ci:** minor changes to trigger release alignment ([9db312f](https://github.com/uport-project/veramo/commit/9db312f8f049ec13ef394dc77fe6e2759143790d))\n\n\n\n\n\n# [5.1.0](https://github.com/uport-project/veramo/compare/v5.0.0...v5.1.0) (2023-02-24)\n\n**Note:** Version bump only for package @veramo/did-provider-web\n\n\n\n\n\n# [5.0.0](https://github.com/uport-project/veramo/compare/v4.3.0...v5.0.0) (2023-02-09)\n\n\n### Build System\n\n* convert veramo modules to ESM instead of CommonJS ([#1103](https://github.com/uport-project/veramo/issues/1103)) ([b5cea3c](https://github.com/uport-project/veramo/commit/b5cea3c0d80d900a47bd1d9eea68f84b70a35e7b)), closes [#1099](https://github.com/uport-project/veramo/issues/1099)\n\n\n### Features\n\n* isolate `core-types` package from `core` ([#1116](https://github.com/uport-project/veramo/issues/1116)) ([ba7a303](https://github.com/uport-project/veramo/commit/ba7a303de91cf4cc568a3af1ddf8ca98ed022e9f))\n\n\n### BREAKING CHANGES\n\n* this is a breaking change as modules will have to be imported differently: \n* https://www.typescriptlang.org/docs/handbook/esm-node.html\n* https://nodejs.org/api/esm.html\n* https://caniuse.com/?search=modules\n\ntest(did-provider-ion): skip a couple of tests that fail with unreasonable errors\nchore: use ubuntu-latest on CI\nfix: temporarily remove puppeteer tests\nfix: use craco for test-react-app to enable babel config\ntest: fix unit and integration tests (browser tests still broken)\nfix: fix some build issues that prevented tests from working\nfix: missing deps flagged by pnpm\n\n\n\n\n\n# [4.3.0](https://github.com/uport-project/veramo/compare/v4.2.0...v4.3.0) (2023-01-27)\n\n**Note:** Version bump only for package @veramo/did-provider-web\n\n\n\n\n\n# [4.2.0](https://github.com/uport-project/veramo/compare/v4.1.2...v4.2.0) (2022-12-05)\n\n\n### Bug Fixes\n\n* **deps:** bump dependencies ([701b8ed](https://github.com/uport-project/veramo/commit/701b8edf981ea11c7ddb6a81d2817dbbdbb022f3))\n\n\n\n\n\n## [4.1.1](https://github.com/uport-project/veramo/compare/v4.1.0...v4.1.1) (2022-11-01)\n\n**Note:** Version bump only for package @veramo/did-provider-web\n\n\n\n\n\n# [4.1.0](https://github.com/uport-project/veramo/compare/v4.0.2...v4.1.0) (2022-10-31)\n\n**Note:** Version bump only for package @veramo/did-provider-web\n\n\n\n\n\n# [4.0.0](https://github.com/uport-project/veramo/compare/v3.1.5...v4.0.0) (2022-09-22)\n\n\n### Bug Fixes\n\n* **did-resolver:** use interface `Resolvable` instead of the `Resolver` class ([9c2e59f](https://github.com/uport-project/veramo/commit/9c2e59f3f23f808511c6c0e8e440b4d53ba5cb00))\n\n\n### Features\n\n* **did-manager:** add`didManagerUpdate` method for full DID document updates ([#974](https://github.com/uport-project/veramo/issues/974)) ([5682b25](https://github.com/uport-project/veramo/commit/5682b2566b7c4f8f9bfda10e8d06a8d2624c2a1b)), closes [#971](https://github.com/uport-project/veramo/issues/971) [#960](https://github.com/uport-project/veramo/issues/960) [#948](https://github.com/uport-project/veramo/issues/948)\n\n\n\n\n\n## [3.1.3](https://github.com/uport-project/veramo/compare/v3.1.2...v3.1.3) (2022-06-01)\n\n**Note:** Version bump only for package @veramo/did-provider-web\n\n\n\n\n\n# [3.1.0](https://github.com/uport-project/veramo/compare/v3.0.0...v3.1.0) (2021-11-12)\n\n**Note:** Version bump only for package @veramo/did-provider-web\n\n\n\n\n\n# [3.0.0](https://github.com/uport-project/veramo/compare/v2.1.3...v3.0.0) (2021-09-20)\n\n**Note:** Version bump only for package @veramo/did-provider-web\n\n\n\n\n\n# [2.1.0](https://github.com/uport-project/veramo/compare/v2.0.1...v2.1.0) (2021-08-11)\n\n**Note:** Version bump only for package @veramo/did-provider-web\n\n\n\n\n\n# [2.0.0](https://github.com/uport-project/veramo/compare/v1.2.2...v2.0.0) (2021-07-14)\n\n\n### Bug Fixes\n\n* **remote-server:** create an Ed25519 key for the default did:web ([a2f7f8c](https://github.com/uport-project/veramo/commit/a2f7f8c3fc6ab6cc276f6853104386bf9d923424))\n\n\n\n\n\n# [1.2.0](https://github.com/uport-project/veramo/compare/v1.1.2...v1.2.0) (2021-04-27)\n\n**Note:** Version bump only for package @veramo/did-provider-web\n\n\n\n\n\n# [1.1.0](https://github.com/uport-project/veramo/compare/v1.0.1...v1.1.0) (2021-01-26)\n\n**Note:** Version bump only for package @veramo/did-provider-web\n\n\n\n\n\n## 1.0.1 (2020-12-18)\n\n**Note:** Version bump only for package @veramo/did-provider-web\n"
  },
  {
    "path": "packages/did-provider-web/LICENSE",
    "content": "                                 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 2019 Consensys AG\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"
  },
  {
    "path": "packages/did-provider-web/README.md",
    "content": "# Veramo did:web provider\n\nThis package contains an implementation of `AbstractIdentifierProvider` for the `did:web` method.\nThis enables creation and control of `did:web` entities.\n"
  },
  {
    "path": "packages/did-provider-web/api-extractor.json",
    "content": "{\n  \"$schema\": \"https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json\",\n  \"apiReport\": {\n    \"enabled\": true,\n    \"reportFolder\": \"./api\",\n    \"reportTempFolder\": \"./api\"\n  },\n\n  \"docModel\": {\n    \"enabled\": true,\n    \"apiJsonFilePath\": \"./api/<unscopedPackageName>.api.json\"\n  },\n\n  \"dtsRollup\": {\n    \"enabled\": false\n  },\n  \"mainEntryPointFilePath\": \"<projectFolder>/build/index.d.ts\"\n}\n"
  },
  {
    "path": "packages/did-provider-web/package.json",
    "content": "{\n  \"name\": \"@veramo/did-provider-web\",\n  \"description\": \"Veramo plugin that can enable creation and control of did:web identifiers.\",\n  \"version\": \"7.0.0\",\n  \"main\": \"build/index.js\",\n  \"exports\": \"./build/index.js\",\n  \"types\": \"build/index.d.ts\",\n  \"scripts\": {\n    \"build\": \"tsc\",\n    \"extract-api\": \"node ../cli/bin/veramo.js dev extract-api\"\n  },\n  \"dependencies\": {\n    \"@veramo/core-types\": \"workspace:^\",\n    \"@veramo/did-manager\": \"workspace:^\",\n    \"@veramo/utils\": \"workspace:^\",\n    \"debug\": \"^4.3.3\"\n  },\n  \"devDependencies\": {\n    \"@types/debug\": \"4.1.8\",\n    \"typescript\": \"5.7.3\"\n  },\n  \"files\": [\n    \"build/**/*\",\n    \"src/**/*\",\n    \"README.md\",\n    \"LICENSE\"\n  ],\n  \"publishConfig\": {\n    \"access\": \"public\"\n  },\n  \"repository\": {\n    \"type\": \"git\",\n    \"url\": \"https://github.com/decentralized-identity/veramo.git\",\n    \"directory\": \"packages/did-provider-web\"\n  },\n  \"author\": \"Consensys Mesh R&D <hello@veramo.io>\",\n  \"contributors\": [\n    \"Simonas Karuzas <simonas.karuzas@mesh.xyz>\",\n    \"Mircea Nistor <mircea.nistor@mesh.xyz>\"\n  ],\n  \"keywords\": [\n    \"Veramo\",\n    \"DID\",\n    \"Verifiable Credential\",\n    \"veramo-plugin\",\n    \"did:web\"\n  ],\n  \"license\": \"Apache-2.0\",\n  \"type\": \"module\",\n  \"moduleDirectories\": [\n    \"node_modules\",\n    \"src\"\n  ]\n}\n"
  },
  {
    "path": "packages/did-provider-web/src/index.ts",
    "content": "/**\n * Provides `did:web` {@link @veramo/did-provider-web#WebDIDProvider | identifier provider } for the\n * {@link @veramo/did-manager#DIDManager}\n *\n * @packageDocumentation\n */\nexport { WebDIDProvider } from './web-did-provider.js'\n"
  },
  {
    "path": "packages/did-provider-web/src/web-did-provider.ts",
    "content": "import { IIdentifier, IKey, IService, IAgentContext, IKeyManager, TKeyType } from '@veramo/core-types'\nimport { AbstractIdentifierProvider } from '@veramo/did-manager'\nimport { importOrCreateKey, CreateIdentifierBaseOptions } from '@veramo/utils'\n\nimport Debug from 'debug'\nconst debug = Debug('veramo:web-did:identifier-provider')\n\ntype IContext = IAgentContext<IKeyManager>\n\ntype CreateWebDidOptions = CreateIdentifierBaseOptions & {\n  /**\n   * @deprecated use key.type instead\n   */\n  keyType?: TKeyType\n}\n\n/**\n * {@link @veramo/did-manager#DIDManager} identifier provider for `did:web` identifiers\n * @public\n */\nexport class WebDIDProvider extends AbstractIdentifierProvider {\n  private defaultKms: string\n\n  constructor(options: { defaultKms: string }) {\n    super()\n    this.defaultKms = options.defaultKms\n  }\n\n  async createIdentifier(\n    { kms, alias, options }: { kms?: string; alias?: string; options: CreateWebDidOptions },\n    context: IContext,\n  ): Promise<Omit<IIdentifier, 'provider'>> {\n    let keyType = options?.key?.type || options?.keyType || 'Secp256k1'\n    const privateKeyHex = options?.key?.privateKeyHex\n\n    let key: IKey\n\n    if (options?.keyRef) {\n      key = await context.agent.keyManagerGet({ kid: options.keyRef })\n    } else {\n      key = await importOrCreateKey(\n        {\n          kms: kms || this.defaultKms,\n          options: {\n            ...(options?.key ?? {}),\n            type: keyType,\n            privateKeyHex,\n          },\n        },\n        context,\n      )\n    }\n\n    const identifier: Omit<IIdentifier, 'provider'> = {\n      did: 'did:web:' + alias,\n      controllerKeyId: key.kid,\n      keys: [key],\n      services: [],\n    }\n    debug('Created', identifier.did)\n    return identifier\n  }\n\n  async updateIdentifier(args: { did: string; kms?: string | undefined; alias?: string | undefined; options?: any }, context: IAgentContext<IKeyManager>): Promise<IIdentifier> {\n    throw new Error('WebDIDProvider updateIdentifier not supported yet.')\n  }\n\n  async deleteIdentifier(identifier: IIdentifier, context: IContext): Promise<boolean> {\n    for (const { kid } of identifier.keys) {\n      await context.agent.keyManagerDelete({ kid })\n    }\n    return true\n  }\n\n  async addKey(\n    { identifier, key, options }: { identifier: IIdentifier; key: IKey; options?: any },\n    context: IContext,\n  ): Promise<any> {\n    return { success: true }\n  }\n\n  async addService(\n    { identifier, service, options }: { identifier: IIdentifier; service: IService; options?: any },\n    context: IContext,\n  ): Promise<any> {\n    return { success: true }\n  }\n\n  async removeKey(\n    args: { identifier: IIdentifier; kid: string; options?: any },\n    context: IContext,\n  ): Promise<any> {\n    return { success: true }\n  }\n\n  async removeService(\n    args: { identifier: IIdentifier; id: string; options?: any },\n    context: IContext,\n  ): Promise<any> {\n    return { success: true }\n  }\n}\n"
  },
  {
    "path": "packages/did-provider-web/tsconfig.json",
    "content": "{\n  \"extends\": \"../tsconfig.settings.json\",\n  \"compilerOptions\": {\n    \"rootDir\": \"src\",\n    \"outDir\": \"build\",\n    \"declarationDir\": \"build\"\n  },\n  \"references\": [\n    { \"path\": \"../core-types\" },\n    { \"path\": \"../did-manager\" },\n    { \"path\": \"../utils\" }\n  ]\n}\n"
  },
  {
    "path": "packages/did-resolver/CHANGELOG.md",
    "content": "# Change Log\n\nAll notable changes to this project will be documented in this file.\nSee [Conventional Commits](https://conventionalcommits.org) for commit guidelines.\n\n# [7.0.0](https://github.com/decentralized-identity/veramo/compare/v6.0.2...v7.0.0) (2026-02-11)\n\n\n### Bug Fixes\n\n* **deps:** bump ethr-did-resolver to v11 ([#1422](https://github.com/decentralized-identity/veramo/issues/1422)) ([2f0b06d](https://github.com/decentralized-identity/veramo/commit/2f0b06ddcce87dfeea1d5ab843eb33276dac071d))\n* **deps:** update devdeps and bump typeorm to 0.3.20 ([#1272](https://github.com/decentralized-identity/veramo/issues/1272)) ([7d17f37](https://github.com/decentralized-identity/veramo/commit/7d17f37ea7cc4e73a8cdae028681ae1be5c4d11c))\n* **deps:** Update did-vc-libraries ([cf45ff8](https://github.com/decentralized-identity/veramo/commit/cf45ff8c7e017bf1c1d3a223faded851fde2ae30))\n* **deps:** Update did-vc-libraries ([#1439](https://github.com/decentralized-identity/veramo/issues/1439)) ([0056388](https://github.com/decentralized-identity/veramo/commit/00563885b5086787d69ff6d289e93d5556f0c989))\n\n\n\n\n\n## [6.0.2](https://github.com/decentralized-identity/veramo/compare/v6.0.1...v6.0.2) (2026-01-16)\n\n**Note:** Version bump only for package @veramo/did-resolver\n\n\n\n\n\n## [6.0.1](https://github.com/decentralized-identity/veramo/compare/v6.0.0...v6.0.1) (2026-01-16)\n\n**Note:** Version bump only for package @veramo/did-resolver\n\n\n\n\n\n# [6.0.0](https://github.com/decentralized-identity/veramo/compare/v5.6.0...v6.0.0) (2024-04-02)\n\n\n### Bug Fixes\n\n* address edge case when getting DIDDoc component ([#1365](https://github.com/decentralized-identity/veramo/issues/1365)) ([1694de1](https://github.com/decentralized-identity/veramo/commit/1694de11ba2f84a5d396f0a1256c4b18ab66b41a))\n* **deps:** bump ethr-did-resolver ([#1278](https://github.com/decentralized-identity/veramo/issues/1278)) ([b6c54cd](https://github.com/decentralized-identity/veramo/commit/b6c54cd988ce0cf2e1604e8dc5379db59013579a))\n* **deps:** Update dependency ethr-did-resolver to v10.1.5 ([07c982f](https://github.com/decentralized-identity/veramo/commit/07c982f6f63a1d6e1f51a1be358d7a86100790dc))\n* export const plugin schemas instead of defaults ([#1327](https://github.com/decentralized-identity/veramo/issues/1327)) ([7896cea](https://github.com/decentralized-identity/veramo/commit/7896ceaf2c79993eee44e46950814bea74bfe647)), closes [#1318](https://github.com/decentralized-identity/veramo/issues/1318) [#1317](https://github.com/decentralized-identity/veramo/issues/1317) [#1315](https://github.com/decentralized-identity/veramo/issues/1315)\n\n\n### Code Refactoring\n\n* generate plugin schemas as TS instead of JSON ([#1315](https://github.com/decentralized-identity/veramo/issues/1315)) ([65c2d4b](https://github.com/decentralized-identity/veramo/commit/65c2d4bc814daa9a3a89f4f7b8e8c6973b8ce2f0)), closes [#1254](https://github.com/decentralized-identity/veramo/issues/1254)\n\n\n### BREAKING CHANGES\n\n* The `plugin.schema.json` files are now generated as `plugin.schema.ts`.\n\n\n\n\n\n# [5.6.0](https://github.com/decentralized-identity/veramo/compare/v5.5.3...v5.6.0) (2024-01-16)\n\n\n### Features\n\n* **remote-client:** allow dynamic headers param for AgentRestClient constructor ([#1314](https://github.com/decentralized-identity/veramo/issues/1314)) ([1b8a0a2](https://github.com/decentralized-identity/veramo/commit/1b8a0a2718dd63492ad3a312a6ebe5f6e7849935)), closes [#1313](https://github.com/decentralized-identity/veramo/issues/1313)\n\n\n\n\n\n## [5.5.3](https://github.com/decentralized-identity/veramo/compare/v5.5.2...v5.5.3) (2023-10-09)\n\n\n### Bug Fixes\n\n* use DIF URLs in packages ([#1271](https://github.com/decentralized-identity/veramo/issues/1271)) ([3dfc601](https://github.com/decentralized-identity/veramo/commit/3dfc6014cdee7902c59d8db76b4c8507b870f227))\n\n\n\n\n\n# [5.5.0](https://github.com/uport-project/veramo/compare/v5.4.1...v5.5.0) (2023-09-19)\n\n\n### Bug Fixes\n\n* **deps:** update dependency cross-fetch to v4 ([1c14d34](https://github.com/uport-project/veramo/commit/1c14d34f48a51bef373541e84ed89f2f44711406))\n* **did-provider-key:** use compressed keys for creating Secp256k1 did:key ([#1217](https://github.com/uport-project/veramo/issues/1217)) ([ba8f6f5](https://github.com/uport-project/veramo/commit/ba8f6f5b9b701e57af86491504ecd209ca0c1c1d)), closes [#1213](https://github.com/uport-project/veramo/issues/1213)\n\n\n\n\n\n## [5.4.1](https://github.com/uport-project/veramo/compare/v5.4.0...v5.4.1) (2023-08-04)\n\n\n### Bug Fixes\n\n* **ci:** benign change meant to tag all packages for another patch release ([#1211](https://github.com/uport-project/veramo/issues/1211)) ([41b5c90](https://github.com/uport-project/veramo/commit/41b5c90277171b7b38c5cf49ca01db5cf75b6300))\n* **deps:** Update did-vc-libraries ([08d0c39](https://github.com/uport-project/veramo/commit/08d0c39ec179dc7c7f9c5005a6f3eb183849f3e5))\n\n\n\n\n\n# [5.4.0](https://github.com/uport-project/veramo/compare/v5.3.0...v5.4.0) (2023-08-01)\n\n\n### Features\n\n* **did-comm:** add support for the AES based content and key encryption algorithms ([#1180](https://github.com/uport-project/veramo/issues/1180)) ([5294a81](https://github.com/uport-project/veramo/commit/5294a812ee578c0712b54f216416c3ef78c848da))\n\n\n\n\n\n# [5.3.0](https://github.com/uport-project/veramo/compare/v5.2.0...v5.3.0) (2023-07-27)\n\n\n### Bug Fixes\n\n* **did-resolver:** send `Accept` header to universal resolver. ([#1203](https://github.com/uport-project/veramo/issues/1203)) ([c86d918](https://github.com/uport-project/veramo/commit/c86d918e05585b10c501e7cbfa495d548c04ca3e))\n\n\n\n\n\n# [5.2.0](https://github.com/uport-project/veramo/compare/v5.1.4...v5.2.0) (2023-05-02)\n\n**Note:** Version bump only for package @veramo/did-resolver\n\n\n\n\n\n## [5.1.2](https://github.com/uport-project/veramo/compare/v5.1.1...v5.1.2) (2023-02-25)\n\n**Note:** Version bump only for package @veramo/did-resolver\n\n\n\n\n\n# [5.1.0](https://github.com/uport-project/veramo/compare/v5.0.0...v5.1.0) (2023-02-24)\n\n**Note:** Version bump only for package @veramo/did-resolver\n\n\n\n\n\n# [5.0.0](https://github.com/uport-project/veramo/compare/v4.3.0...v5.0.0) (2023-02-09)\n\n\n### Build System\n\n* convert veramo modules to ESM instead of CommonJS ([#1103](https://github.com/uport-project/veramo/issues/1103)) ([b5cea3c](https://github.com/uport-project/veramo/commit/b5cea3c0d80d900a47bd1d9eea68f84b70a35e7b)), closes [#1099](https://github.com/uport-project/veramo/issues/1099)\n\n\n### Features\n\n* isolate `core-types` package from `core` ([#1116](https://github.com/uport-project/veramo/issues/1116)) ([ba7a303](https://github.com/uport-project/veramo/commit/ba7a303de91cf4cc568a3af1ddf8ca98ed022e9f))\n\n\n### BREAKING CHANGES\n\n* this is a breaking change as modules will have to be imported differently: \n* https://www.typescriptlang.org/docs/handbook/esm-node.html\n* https://nodejs.org/api/esm.html\n* https://caniuse.com/?search=modules\n\ntest(did-provider-ion): skip a couple of tests that fail with unreasonable errors\nchore: use ubuntu-latest on CI\nfix: temporarily remove puppeteer tests\nfix: use craco for test-react-app to enable babel config\ntest: fix unit and integration tests (browser tests still broken)\nfix: fix some build issues that prevented tests from working\nfix: missing deps flagged by pnpm\n\n\n\n\n\n# [4.3.0](https://github.com/uport-project/veramo/compare/v4.2.0...v4.3.0) (2023-01-27)\n\n**Note:** Version bump only for package @veramo/did-resolver\n\n\n\n\n\n# [4.2.0](https://github.com/uport-project/veramo/compare/v4.1.2...v4.2.0) (2022-12-05)\n\n\n### Bug Fixes\n\n* **deps:** bump dependencies ([701b8ed](https://github.com/uport-project/veramo/commit/701b8edf981ea11c7ddb6a81d2817dbbdbb022f3))\n\n\n\n\n\n## [4.1.1](https://github.com/uport-project/veramo/compare/v4.1.0...v4.1.1) (2022-11-01)\n\n**Note:** Version bump only for package @veramo/did-resolver\n\n\n\n\n\n# [4.1.0](https://github.com/uport-project/veramo/compare/v4.0.2...v4.1.0) (2022-10-31)\n\n\n### Bug Fixes\n\n* **deps:** Update dependency ethr-did-resolver to v7 ([#1038](https://github.com/uport-project/veramo/issues/1038)) ([d421c0f](https://github.com/uport-project/veramo/commit/d421c0f9f5934829df2930e58e98bcfce813ce84))\n* **deps:** Update did-vc-libraries ([6fa13ab](https://github.com/uport-project/veramo/commit/6fa13ab7fbab979db2d41e84e445a52cf9319003))\n* remove deprecated testnets ([#1028](https://github.com/uport-project/veramo/issues/1028)) ([2823738](https://github.com/uport-project/veramo/commit/28237383d0cc2eb20bcf8e10562221ea2ab32f94)), closes [#1025](https://github.com/uport-project/veramo/issues/1025)\n\n\n\n\n\n## [4.0.2](https://github.com/uport-project/veramo/compare/v4.0.1...v4.0.2) (2022-10-04)\n\n**Note:** Version bump only for package @veramo/did-resolver\n\n\n\n\n\n# [4.0.0](https://github.com/uport-project/veramo/compare/v3.1.5...v4.0.0) (2022-09-22)\n\n\n### Bug Fixes\n\n* **credential-ld:** fix EcdsaSecp256k1RecoverySignature2020 suite context ([#909](https://github.com/uport-project/veramo/issues/909)) ([48fbee3](https://github.com/uport-project/veramo/commit/48fbee3e62eab3df4225ae0bdb3a92f5665eb171))\n* **deps:** Update dependency ethr-did-resolver to v6.0.2 ([#964](https://github.com/uport-project/veramo/issues/964)) ([48b937e](https://github.com/uport-project/veramo/commit/48b937ee13045736fdc495472847b0b0ee615814))\n* **deps:** Update dependency web-did-resolver to v2.0.19 ([aec6bea](https://github.com/uport-project/veramo/commit/aec6bea5ed6a9cda0f8d78660750bea719e929f7))\n* **deps:** use did-jwt v6 and ethr-did-resolver v6 ([#925](https://github.com/uport-project/veramo/issues/925)) ([0c77d03](https://github.com/uport-project/veramo/commit/0c77d03ec5ec9e2091de3f74f67ab86a22cde197)), closes [#923](https://github.com/uport-project/veramo/issues/923) [#848](https://github.com/uport-project/veramo/issues/848)\n* **did-resolver:** use interface `Resolvable` instead of the `Resolver` class ([9c2e59f](https://github.com/uport-project/veramo/commit/9c2e59f3f23f808511c6c0e8e440b4d53ba5cb00))\n* update and fix inline documentation of all exported types ([#921](https://github.com/uport-project/veramo/issues/921)) ([63e64e0](https://github.com/uport-project/veramo/commit/63e64e0e2693808c4704dca8cc511dc0bab3f3b1))\n\n\n### Features\n\n* add support for serviceEndpoint property as defined in latest DID Spec ([#988](https://github.com/uport-project/veramo/issues/988)) ([9bed70b](https://github.com/uport-project/veramo/commit/9bed70ba658aed34a97944e0dee27bca6c81d700))\n* **credential-ld:** add support for browser environments ([#916](https://github.com/uport-project/veramo/issues/916)) ([435e4d2](https://github.com/uport-project/veramo/commit/435e4d260b1774f96b182c1a75ab2f1c993f2291))\n* **credential-w3c:** align verification API between formats ([#996](https://github.com/uport-project/veramo/issues/996)) ([b987fc0](https://github.com/uport-project/veramo/commit/b987fc0903a31d3bbffb43fef872be4d6c62c2ad)), closes [#935](https://github.com/uport-project/veramo/issues/935) [#954](https://github.com/uport-project/veramo/issues/954) [#375](https://github.com/uport-project/veramo/issues/375) [#989](https://github.com/uport-project/veramo/issues/989)\n* **did-resolver:** simplify DIDResolverPlugin constructor ([#986](https://github.com/uport-project/veramo/issues/986)) ([3a7eb0c](https://github.com/uport-project/veramo/commit/3a7eb0cccb1ed51dde19ae31602971ac930f24ae)), closes [#976](https://github.com/uport-project/veramo/issues/976)\n\n\n### BREAKING CHANGES\n\n* the `did-resolver` and connected libraries change the data-type for `ServiceEndpoint` to `Service` and the previous semantic has changed. Services can have multiple endpoints, not just a single string.\n\n\n\n\n\n## [3.1.3](https://github.com/uport-project/veramo/compare/v3.1.2...v3.1.3) (2022-06-01)\n\n**Note:** Version bump only for package @veramo/did-resolver\n\n\n\n\n\n# [3.1.0](https://github.com/uport-project/veramo/compare/v3.0.0...v3.1.0) (2021-11-12)\n\n\n### Features\n\n* **did-comm:** didcomm messaging using did:ethr ([#744](https://github.com/uport-project/veramo/issues/744)) ([1be5e04](https://github.com/uport-project/veramo/commit/1be5e04e09112c0823d776fe2d55117d71a7b448)), closes [#743](https://github.com/uport-project/veramo/issues/743)\n\n\n\n\n\n# [3.0.0](https://github.com/uport-project/veramo/compare/v2.1.3...v3.0.0) (2021-09-20)\n\n\n### Bug Fixes\n\n* **did-resolver:** always include didResolutionMetadata in result ([#682](https://github.com/uport-project/veramo/issues/682)) ([aabddb4](https://github.com/uport-project/veramo/commit/aabddb436b8b4dd78378da4704ba00147d074cdb)), closes [#681](https://github.com/uport-project/veramo/issues/681)\n\n\n\n\n\n# [2.1.0](https://github.com/uport-project/veramo/compare/v2.0.1...v2.1.0) (2021-08-11)\n\n**Note:** Version bump only for package @veramo/did-resolver\n\n\n\n\n\n# [2.0.0](https://github.com/uport-project/veramo/compare/v1.2.2...v2.0.0) (2021-07-14)\n\n\n### Bug Fixes\n\n* **deps:** bump did-jwt to 5.4.0 ([#528](https://github.com/uport-project/veramo/issues/528)) ([65f22cf](https://github.com/uport-project/veramo/commit/65f22cf6dcca48b5bb35331894536a2a567a1189))\n\n\n### Features\n\n* add support for did-comm over simple HTTP-based transports ([#610](https://github.com/uport-project/veramo/issues/610)) ([78836a4](https://github.com/uport-project/veramo/commit/78836a46d3ce71b568acaa98558b64f9c2b98167)), closes [#552](https://github.com/uport-project/veramo/issues/552) [#469](https://github.com/uport-project/veramo/issues/469)\n* **cli:** export new agent methods and request LD DIDDocument by default ([#617](https://github.com/uport-project/veramo/issues/617)) ([26d088b](https://github.com/uport-project/veramo/commit/26d088b86ecfd66a00cdef7c7bb926148f46fbc9))\n* implement didcomm v2 packing/unpacking ([#575](https://github.com/uport-project/veramo/issues/575)) ([249b07e](https://github.com/uport-project/veramo/commit/249b07eca8d2de9eb5252d71683d5f1fba319d60)), closes [#559](https://github.com/uport-project/veramo/issues/559) [#558](https://github.com/uport-project/veramo/issues/558)\n* **key-manager:** add generic signing capabilities ([#529](https://github.com/uport-project/veramo/issues/529)) ([5f10a1b](https://github.com/uport-project/veramo/commit/5f10a1bcea214cb593de12fa6ec3a91b3cb712bb)), closes [#522](https://github.com/uport-project/veramo/issues/522)\n\n\n\n\n\n# [1.2.0](https://github.com/uport-project/veramo/compare/v1.1.2...v1.2.0) (2021-04-27)\n\n\n### Bug Fixes\n\n* **deps:** update all non-major dependencies ([#462](https://github.com/uport-project/veramo/issues/462)) ([4a2b206](https://github.com/uport-project/veramo/commit/4a2b20633810b45a155bf2149cbff57d157bda3c))\n\n\n### Features\n\n* adapt to did core spec ([#430](https://github.com/uport-project/veramo/issues/430)) ([9712db0](https://github.com/uport-project/veramo/commit/9712db0eea1a3f48cf0665d66ae715ea0c23cd4a)), closes [#418](https://github.com/uport-project/veramo/issues/418) [#428](https://github.com/uport-project/veramo/issues/428) [#417](https://github.com/uport-project/veramo/issues/417) [#416](https://github.com/uport-project/veramo/issues/416) [#412](https://github.com/uport-project/veramo/issues/412) [#397](https://github.com/uport-project/veramo/issues/397) [#384](https://github.com/uport-project/veramo/issues/384) [#394](https://github.com/uport-project/veramo/issues/394)\n\n\n\n\n\n# [1.1.0](https://github.com/uport-project/veramo/compare/v1.0.1...v1.1.0) (2021-01-26)\n\n**Note:** Version bump only for package @veramo/did-resolver\n\n\n\n\n\n## 1.0.1 (2020-12-18)\n\n**Note:** Version bump only for package @veramo/did-resolver\n"
  },
  {
    "path": "packages/did-resolver/LICENSE",
    "content": "                                 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 2019 Consensys AG\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"
  },
  {
    "path": "packages/did-resolver/README.md",
    "content": "# Veramo DID Document resolver plugin\n\nThis plugin exposes a DID resolver API to the rest of the agent.\nThis is used to obtain DID documents that are used for verification and communication.\n"
  },
  {
    "path": "packages/did-resolver/api-extractor.json",
    "content": "{\n  \"$schema\": \"https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json\",\n  \"apiReport\": {\n    \"enabled\": true,\n    \"reportFolder\": \"./api\",\n    \"reportTempFolder\": \"./api\"\n  },\n\n  \"docModel\": {\n    \"enabled\": true,\n    \"apiJsonFilePath\": \"./api/<unscopedPackageName>.api.json\"\n  },\n\n  \"dtsRollup\": {\n    \"enabled\": false\n  },\n  \"mainEntryPointFilePath\": \"<projectFolder>/build/index.d.ts\"\n}\n"
  },
  {
    "path": "packages/did-resolver/package.json",
    "content": "{\n  \"name\": \"@veramo/did-resolver\",\n  \"description\": \"A DID resolver plugin for Veramo\",\n  \"version\": \"7.0.0\",\n  \"main\": \"build/index.js\",\n  \"exports\": \"./build/index.js\",\n  \"types\": \"build/index.d.ts\",\n  \"scripts\": {\n    \"build\": \"tsc\",\n    \"extract-api\": \"node ../cli/bin/veramo.js dev extract-api\"\n  },\n  \"dependencies\": {\n    \"@veramo/core-types\": \"workspace:^\",\n    \"@veramo/utils\": \"workspace:^\",\n    \"cross-fetch\": \"^4.0.0\",\n    \"debug\": \"^4.3.3\",\n    \"did-resolver\": \"^4.1.0\"\n  },\n  \"devDependencies\": {\n    \"@types/debug\": \"4.1.8\",\n    \"ethr-did-resolver\": \"11.0.3\",\n    \"typescript\": \"5.7.3\",\n    \"web-did-resolver\": \"2.0.29\"\n  },\n  \"files\": [\n    \"build/**/*\",\n    \"src/**/*\",\n    \"README.md\",\n    \"LICENSE\"\n  ],\n  \"publishConfig\": {\n    \"access\": \"public\"\n  },\n  \"repository\": {\n    \"type\": \"git\",\n    \"url\": \"https://github.com/decentralized-identity/veramo.git\",\n    \"directory\": \"packages/did-resolver\"\n  },\n  \"author\": \"Consensys Mesh R&D <hello@veramo.io>\",\n  \"contributors\": [\n    \"Simonas Karuzas <simonas.karuzas@mesh.xyz>\",\n    \"Mircea Nistor <mircea.nistor@mesh.xyz>\"\n  ],\n  \"keywords\": [\n    \"Veramo\",\n    \"DID\",\n    \"Verifiable Credential\",\n    \"veramo-plugin\",\n    \"did-resolver\",\n    \"aggregator\"\n  ],\n  \"license\": \"Apache-2.0\",\n  \"type\": \"module\",\n  \"moduleDirectories\": [\n    \"node_modules\",\n    \"src\"\n  ]\n}\n"
  },
  {
    "path": "packages/did-resolver/src/__tests__/integration.test.ts",
    "content": "import { DIDResolverPlugin } from '../resolver.js'\nimport { Resolver } from 'did-resolver'\nimport { getResolver as getEthrResolver } from 'ethr-did-resolver'\nimport { getResolver as getWebDidResolver } from 'web-did-resolver'\nimport { getUniversalResolverFor } from '../universal-resolver.js'\nimport { jest } from '@jest/globals'\nimport { createGanacheProvider } from '../../../test-react-app/src/test-utils/ganache-provider'\n\njest.setTimeout(60000)\n\ndescribe('@veramo/did-resolver', () => {\n  let resolverPluginDirect: DIDResolverPlugin\n  let resolverPlugin: DIDResolverPlugin\n\n  beforeAll(async () => {\n    const { provider, registry } = await createGanacheProvider()\n\n    const providerConfig = {\n      networks: [\n        {\n          chainId: 1337,\n          name: 'ganache',\n          provider: provider as any, // different versions of ethers complain about a type mismatch here\n          registry,\n        },\n        { name: 'development', rpcUrl: 'http://localhost:7545' },\n        // FIXME: add this example\n        // { name: 'test', provider: TBD_add_example_of_custom_provider_usage },\n      ],\n    }\n\n    let resolverMap = {\n      // resolve did:ethr using the embedded ethr-did-resolver\n      ...getEthrResolver(providerConfig),\n      // resolve did:web using the embedded web-did-resolver\n      ...getWebDidResolver(),\n      // resolve some other DID methods using the centralized `uniresolver.io` service\n      ...getUniversalResolverFor(['key', 'elem']),\n    }\n\n    /** This creates a resolver that supports the [ethr, web, key, elem] DID methods */\n    let resolver = new Resolver(resolverMap)\n    resolverPlugin = new DIDResolverPlugin({ resolver })\n    resolverPluginDirect = new DIDResolverPlugin(resolverMap)\n  })\n\n  // it('should resolve web DID', async () => {\n  //   expect.assertions(1)\n  //   await expect(resolverPlugin.resolveDid({ didUrl: 'did:web:did.actor:alice' })).resolves.toEqual({\n  //     didDocument: {\n  //       '@context': ['https://w3.org/ns/did/v1', 'https://w3id.org/security/suites/ed25519-2018/v1'],\n  //       id: 'did:web:did.actor:alice',\n  //       publicKey: [\n  //         {\n  //           id: 'did:web:did.actor:alice#z6MkrmNwty5ajKtFqc1U48oL2MMLjWjartwc5sf2AihZwXDN',\n  //           controller: 'did:web:did.actor:alice',\n  //           type: 'Ed25519VerificationKey2018',\n  //           publicKeyBase58: 'DK7uJiq9PnPnj7AmNZqVBFoLuwTjT1hFPrk6LSjZ2JRz',\n  //         },\n  //       ],\n  //       authentication: ['did:web:did.actor:alice#z6MkrmNwty5ajKtFqc1U48oL2MMLjWjartwc5sf2AihZwXDN'],\n  //       assertionMethod: ['did:web:did.actor:alice#z6MkrmNwty5ajKtFqc1U48oL2MMLjWjartwc5sf2AihZwXDN'],\n  //       capabilityDelegation: ['did:web:did.actor:alice#z6MkrmNwty5ajKtFqc1U48oL2MMLjWjartwc5sf2AihZwXDN'],\n  //       capabilityInvocation: ['did:web:did.actor:alice#z6MkrmNwty5ajKtFqc1U48oL2MMLjWjartwc5sf2AihZwXDN'],\n  //       keyAgreement: [\n  //         {\n  //           id: 'did:web:did.actor:alice#zC8GybikEfyNaausDA4mkT4egP7SNLx2T1d1kujLQbcP6h',\n  //           type: 'X25519KeyAgreementKey2019',\n  //           controller: 'did:web:did.actor:alice',\n  //           publicKeyBase58: 'CaSHXEvLKS6SfN9aBfkVGBpp15jSnaHazqHgLHp8KZ3Y',\n  //         },\n  //       ],\n  //     },\n  //     didDocumentMetadata: {},\n  //     didResolutionMetadata: { contentType: 'application/did+ld+json' },\n  //   })\n  // })\n\n  it('should resolve ethr-did with RPC URL', async () => {\n    expect.assertions(1)\n    await expect(\n      resolverPlugin.resolveDid({ didUrl: 'did:ethr:ganache:0xaafe788d8ca214a080b0f6ac7f48480b2aefa9bb' }),\n    ).resolves.toEqual({\n      didDocument: {\n        '@context': expect.anything(),\n        id: 'did:ethr:ganache:0xaafe788d8ca214a080b0f6ac7f48480b2aefa9bb',\n        verificationMethod: [\n          {\n            id: 'did:ethr:ganache:0xaafe788d8ca214a080b0f6ac7f48480b2aefa9bb#controller',\n            type: 'EcdsaSecp256k1RecoveryMethod2020',\n            controller: 'did:ethr:ganache:0xaafe788d8ca214a080b0f6ac7f48480b2aefa9bb',\n            blockchainAccountId: 'eip155:1337:0xaafE788D8cA214A080B0F6aC7f48480B2aEFa9bb',\n          },\n        ],\n        authentication: ['did:ethr:ganache:0xaafe788d8ca214a080b0f6ac7f48480b2aefa9bb#controller'],\n        assertionMethod: ['did:ethr:ganache:0xaafe788d8ca214a080b0f6ac7f48480b2aefa9bb#controller'],\n      },\n      didDocumentMetadata: {},\n      didResolutionMetadata: { contentType: 'application/did+ld+json' },\n    })\n  })\n\n  // it('should resolve web DID using direct constructor', async () => {\n  //   expect.assertions(1)\n  //   const result = await resolverPluginDirect.resolveDid({ didUrl: 'did:web:did.actor:alice' })\n  //   expect(result?.didDocument?.id).toEqual('did:web:did.actor:alice')\n  // })\n\n  it('should resolve ethr-did with RPC URL using direct constructor', async () => {\n    expect.assertions(1)\n    const result = await resolverPluginDirect.resolveDid({\n      didUrl: 'did:ethr:ganache:0xaafe788d8ca214a080b0f6ac7f48480b2aefa9bb',\n    })\n    expect(result?.didDocument?.id).toEqual('did:ethr:ganache:0xaafe788d8ca214a080b0f6ac7f48480b2aefa9bb')\n  })\n\n  it('should fail predictably when unsupported method is resolved', async () => {\n    expect.assertions(1)\n    await expect(resolverPlugin.resolveDid({ didUrl: 'did:unsupported:lorem.ipsum' })).resolves.toEqual({\n      didDocument: null,\n      didDocumentMetadata: {},\n      didResolutionMetadata: { error: 'unsupportedDidMethod' },\n    })\n  })\n})\n"
  },
  {
    "path": "packages/did-resolver/src/__tests__/resolver.test.ts",
    "content": "import { DIDResolverPlugin } from '../resolver.js'\nimport { Resolver, VerificationMethod } from 'did-resolver'\n\ndescribe('@veramo/did-resolver', () => {\n  it('should throw error when misconfigured', () => {\n    expect(() => {\n      new DIDResolverPlugin({\n        // @ts-ignore\n        resolver: undefined,\n      })\n    }).toThrow()\n  })\n\n  it('should have resolve method', () => {\n    const resolver = new DIDResolverPlugin({ resolver: new Resolver() })\n    expect(resolver).toHaveProperty('resolveDid')\n  })\n\n  const didDoc1 = {\n    '@context':[\"https://www.w3.org/ns/did/v1\",\"https://w3id.org/security/multikey/v1\",\n      // line below causes TS issue but isn't used in getDIDComponentById\n      // {\"@base\":\"did:peer:2.Ez6LSiNkZ4hS9ivnKXcEf1GGfXxqcWSCCXaFC775JZjVfwkoA.Vz6Mkr6TpZKXqdt4Kx28GSrLt4VysTWof6Npm4HNaGMcVPTff.SeyJpZCI6IjEiLCJ0IjoiZG0iLCJzIjoiZGlkOndlYjpkZXYtZGlkY29tbS1tZWRpYXRvci5oZXJva3VhcHAuY29tIiwiZGVzY3JpcHRpb24iOiJhIERJRENvbW0gZW5kcG9pbnQifQ\"}\n    ],\n    \"id\":\"did:peer:2.Ez6LSiNkZ4hS9ivnKXcEf1GGfXxqcWSCCXaFC775JZjVfwkoA.Vz6Mkr6TpZKXqdt4Kx28GSrLt4VysTWof6Npm4HNaGMcVPTff.SeyJpZCI6IjEiLCJ0IjoiZG0iLCJzIjoiZGlkOndlYjpkZXYtZGlkY29tbS1tZWRpYXRvci5oZXJva3VhcHAuY29tIiwiZGVzY3JpcHRpb24iOiJhIERJRENvbW0gZW5kcG9pbnQifQ\",\n    \"verificationMethod\":[\n      {\"id\":\"#key-2\",\"type\":\"Multikey\",\"controller\":\"did:peer:2.Ez6LSiNkZ4hS9ivnKXcEf1GGfXxqcWSCCXaFC775JZjVfwkoA.Vz6Mkr6TpZKXqdt4Kx28GSrLt4VysTWof6Npm4HNaGMcVPTff.SeyJpZCI6IjEiLCJ0IjoiZG0iLCJzIjoiZGlkOndlYjpkZXYtZGlkY29tbS1tZWRpYXRvci5oZXJva3VhcHAuY29tIiwiZGVzY3JpcHRpb24iOiJhIERJRENvbW0gZW5kcG9pbnQifQ\",\"publicKeyMultibase\":\"z6Mkr6TpZKXqdt4Kx28GSrLt4VysTWof6Npm4HNaGMcVPTff\"},\n      {\"id\":\"#key-1\",\"type\":\"Multikey\",\"controller\":\"did:peer:2.Ez6LSiNkZ4hS9ivnKXcEf1GGfXxqcWSCCXaFC775JZjVfwkoA.Vz6Mkr6TpZKXqdt4Kx28GSrLt4VysTWof6Npm4HNaGMcVPTff.SeyJpZCI6IjEiLCJ0IjoiZG0iLCJzIjoiZGlkOndlYjpkZXYtZGlkY29tbS1tZWRpYXRvci5oZXJva3VhcHAuY29tIiwiZGVzY3JpcHRpb24iOiJhIERJRENvbW0gZW5kcG9pbnQifQ\",\"publicKeyMultibase\":\"z6LSiNkZ4hS9ivnKXcEf1GGfXxqcWSCCXaFC775JZjVfwkoA\"}\n    ],\n    \"keyAgreement\":[\"#key-1\"],\n    \"authentication\":[\"#key-2\"],\n    \"assertionMethod\":[\"#key-2\"],\n    \"service\":[{\"id\":\"1\",\"description\":\"a DIDComm endpoint\",\"serviceEndpoint\":\"did:web:dev-didcomm-mediator.herokuapp.com\",\"type\":\"DIDCommMessaging\"}]\n  }\n  \n  it('should correctly get component by key suffix with key in verificationMethod as suffix only', async () => {\n    const resolver = new DIDResolverPlugin({ resolver: new Resolver() })\n    const result = await resolver.getDIDComponentById({ didDocument: didDoc1, section: 'keyAgreement', didUrl: '#key-1'})\n    expect((result.valueOf()as VerificationMethod).id).toEqual(\"did:peer:2.Ez6LSiNkZ4hS9ivnKXcEf1GGfXxqcWSCCXaFC775JZjVfwkoA.Vz6Mkr6TpZKXqdt4Kx28GSrLt4VysTWof6Npm4HNaGMcVPTff.SeyJpZCI6IjEiLCJ0IjoiZG0iLCJzIjoiZGlkOndlYjpkZXYtZGlkY29tbS1tZWRpYXRvci5oZXJva3VhcHAuY29tIiwiZGVzY3JpcHRpb24iOiJhIERJRENvbW0gZW5kcG9pbnQifQ#key-1\")\n  })\n  \n  const didDoc2 = {\n    \"@context\":[\"https://www.w3.org/ns/did/v1\",\"https://w3id.org/security/multikey/v1\",\n      // {\"@base\":\"did:peer:2.Ez6LSiNkZ4hS9ivnKXcEf1GGfXxqcWSCCXaFC775JZjVfwkoA.Vz6Mkr6TpZKXqdt4Kx28GSrLt4VysTWof6Npm4HNaGMcVPTff.SeyJpZCI6IjEiLCJ0IjoiZG0iLCJzIjoiZGlkOndlYjpkZXYtZGlkY29tbS1tZWRpYXRvci5oZXJva3VhcHAuY29tIiwiZGVzY3JpcHRpb24iOiJhIERJRENvbW0gZW5kcG9pbnQifQ\"}\n    ],\n    \"id\":\"did:peer:2.Ez6LSiNkZ4hS9ivnKXcEf1GGfXxqcWSCCXaFC775JZjVfwkoA.Vz6Mkr6TpZKXqdt4Kx28GSrLt4VysTWof6Npm4HNaGMcVPTff.SeyJpZCI6IjEiLCJ0IjoiZG0iLCJzIjoiZGlkOndlYjpkZXYtZGlkY29tbS1tZWRpYXRvci5oZXJva3VhcHAuY29tIiwiZGVzY3JpcHRpb24iOiJhIERJRENvbW0gZW5kcG9pbnQifQ\",\n    \"verificationMethod\":[\n      {\"id\":\"#key-2\",\"type\":\"Multikey\",\"controller\":\"did:peer:2.Ez6LSiNkZ4hS9ivnKXcEf1GGfXxqcWSCCXaFC775JZjVfwkoA.Vz6Mkr6TpZKXqdt4Kx28GSrLt4VysTWof6Npm4HNaGMcVPTff.SeyJpZCI6IjEiLCJ0IjoiZG0iLCJzIjoiZGlkOndlYjpkZXYtZGlkY29tbS1tZWRpYXRvci5oZXJva3VhcHAuY29tIiwiZGVzY3JpcHRpb24iOiJhIERJRENvbW0gZW5kcG9pbnQifQ\",\"publicKeyMultibase\":\"z6Mkr6TpZKXqdt4Kx28GSrLt4VysTWof6Npm4HNaGMcVPTff\"},\n      {\"id\":\"did:peer:2.Ez6LSiNkZ4hS9ivnKXcEf1GGfXxqcWSCCXaFC775JZjVfwkoA.Vz6Mkr6TpZKXqdt4Kx28GSrLt4VysTWof6Npm4HNaGMcVPTff.SeyJpZCI6IjEiLCJ0IjoiZG0iLCJzIjoiZGlkOndlYjpkZXYtZGlkY29tbS1tZWRpYXRvci5oZXJva3VhcHAuY29tIiwiZGVzY3JpcHRpb24iOiJhIERJRENvbW0gZW5kcG9pbnQifQ#key-1\",\"type\":\"Multikey\",\"controller\":\"did:peer:2.Ez6LSiNkZ4hS9ivnKXcEf1GGfXxqcWSCCXaFC775JZjVfwkoA.Vz6Mkr6TpZKXqdt4Kx28GSrLt4VysTWof6Npm4HNaGMcVPTff.SeyJpZCI6IjEiLCJ0IjoiZG0iLCJzIjoiZGlkOndlYjpkZXYtZGlkY29tbS1tZWRpYXRvci5oZXJva3VhcHAuY29tIiwiZGVzY3JpcHRpb24iOiJhIERJRENvbW0gZW5kcG9pbnQifQ\",\"publicKeyMultibase\":\"z6LSiNkZ4hS9ivnKXcEf1GGfXxqcWSCCXaFC775JZjVfwkoA\"}\n    ],\n    \"keyAgreement\":[\"#key-1\"],\n    \"authentication\":[\"#key-2\"],\n    \"assertionMethod\":[\"#key-2\"],\n    \"service\":[{\"id\":\"1\",\"description\":\"a DIDComm endpoint\",\"serviceEndpoint\":\"did:web:dev-didcomm-mediator.herokuapp.com\",\"type\":\"DIDCommMessaging\"}]\n  }  \n\n  it('should correctly get component by key suffix with key in verificationMethod as DID + suffix', async () => {\n    const resolver = new DIDResolverPlugin({ resolver: new Resolver() })\n    const result = await resolver.getDIDComponentById({ didDocument: didDoc2, section: 'keyAgreement', didUrl: '#key-1'})\n    expect((result.valueOf()as VerificationMethod).id).toEqual(\"did:peer:2.Ez6LSiNkZ4hS9ivnKXcEf1GGfXxqcWSCCXaFC775JZjVfwkoA.Vz6Mkr6TpZKXqdt4Kx28GSrLt4VysTWof6Npm4HNaGMcVPTff.SeyJpZCI6IjEiLCJ0IjoiZG0iLCJzIjoiZGlkOndlYjpkZXYtZGlkY29tbS1tZWRpYXRvci5oZXJva3VhcHAuY29tIiwiZGVzY3JpcHRpb24iOiJhIERJRENvbW0gZW5kcG9pbnQifQ#key-1\")\n  })\n\n  const didDoc3 = {\n    \"@context\":[\"https://www.w3.org/ns/did/v1\",\"https://w3id.org/security/multikey/v1\",\n      // {\"@base\":\"did:peer:2.Ez6LSiNkZ4hS9ivnKXcEf1GGfXxqcWSCCXaFC775JZjVfwkoA.Vz6Mkr6TpZKXqdt4Kx28GSrLt4VysTWof6Npm4HNaGMcVPTff.SeyJpZCI6IjEiLCJ0IjoiZG0iLCJzIjoiZGlkOndlYjpkZXYtZGlkY29tbS1tZWRpYXRvci5oZXJva3VhcHAuY29tIiwiZGVzY3JpcHRpb24iOiJhIERJRENvbW0gZW5kcG9pbnQifQ\"}\n    ],\n    \"id\":\"did:peer:2.Ez6LSiNkZ4hS9ivnKXcEf1GGfXxqcWSCCXaFC775JZjVfwkoA.Vz6Mkr6TpZKXqdt4Kx28GSrLt4VysTWof6Npm4HNaGMcVPTff.SeyJpZCI6IjEiLCJ0IjoiZG0iLCJzIjoiZGlkOndlYjpkZXYtZGlkY29tbS1tZWRpYXRvci5oZXJva3VhcHAuY29tIiwiZGVzY3JpcHRpb24iOiJhIERJRENvbW0gZW5kcG9pbnQifQ\",\n    \"verificationMethod\":[\n      {\"id\":\"#key-2\",\"type\":\"Multikey\",\"controller\":\"did:peer:2.Ez6LSiNkZ4hS9ivnKXcEf1GGfXxqcWSCCXaFC775JZjVfwkoA.Vz6Mkr6TpZKXqdt4Kx28GSrLt4VysTWof6Npm4HNaGMcVPTff.SeyJpZCI6IjEiLCJ0IjoiZG0iLCJzIjoiZGlkOndlYjpkZXYtZGlkY29tbS1tZWRpYXRvci5oZXJva3VhcHAuY29tIiwiZGVzY3JpcHRpb24iOiJhIERJRENvbW0gZW5kcG9pbnQifQ\",\"publicKeyMultibase\":\"z6Mkr6TpZKXqdt4Kx28GSrLt4VysTWof6Npm4HNaGMcVPTff\"},\n      {\"id\":\"did:peer:2.Ez6LSiNkZ4hS9ivnKXcEf1GGfXxqcWSCCXaFC775JZjVfwkoA.Vz6Mkr6TpZKXqdt4Kx28GSrLt4VysTWof6Npm4HNaGMcVPTff.SeyJpZCI6IjEiLCJ0IjoiZG0iLCJzIjoiZGlkOndlYjpkZXYtZGlkY29tbS1tZWRpYXRvci5oZXJva3VhcHAuY29tIiwiZGVzY3JpcHRpb24iOiJhIERJRENvbW0gZW5kcG9pbnQifQ#key-1\",\"type\":\"Multikey\",\"controller\":\"did:peer:2.Ez6LSiNkZ4hS9ivnKXcEf1GGfXxqcWSCCXaFC775JZjVfwkoA.Vz6Mkr6TpZKXqdt4Kx28GSrLt4VysTWof6Npm4HNaGMcVPTff.SeyJpZCI6IjEiLCJ0IjoiZG0iLCJzIjoiZGlkOndlYjpkZXYtZGlkY29tbS1tZWRpYXRvci5oZXJva3VhcHAuY29tIiwiZGVzY3JpcHRpb24iOiJhIERJRENvbW0gZW5kcG9pbnQifQ\",\"publicKeyMultibase\":\"z6LSiNkZ4hS9ivnKXcEf1GGfXxqcWSCCXaFC775JZjVfwkoA\"}\n    ],\n    \"keyAgreement\":[\"#key-1\"],\n    \"authentication\":[\"#key-2\"],\n    \"assertionMethod\":[\"#key-2\"],\n    \"service\":[{\"id\":\"1\",\"description\":\"a DIDComm endpoint\",\"serviceEndpoint\":\"did:web:dev-didcomm-mediator.herokuapp.com\",\"type\":\"DIDCommMessaging\"}]\n  }  \n\n  it('should correctly get component by DID + key suffix with key in verificationMethod as DID + suffix', async () => {\n    const resolver = new DIDResolverPlugin({ resolver: new Resolver() })\n    const result = await resolver.getDIDComponentById({ didDocument: didDoc3, section: 'keyAgreement', didUrl: 'did:peer:2.Ez6LSiNkZ4hS9ivnKXcEf1GGfXxqcWSCCXaFC775JZjVfwkoA.Vz6Mkr6TpZKXqdt4Kx28GSrLt4VysTWof6Npm4HNaGMcVPTff.SeyJpZCI6IjEiLCJ0IjoiZG0iLCJzIjoiZGlkOndlYjpkZXYtZGlkY29tbS1tZWRpYXRvci5oZXJva3VhcHAuY29tIiwiZGVzY3JpcHRpb24iOiJhIERJRENvbW0gZW5kcG9pbnQifQ#key-1'})\n    expect((result.valueOf()as VerificationMethod).id).toEqual(\"did:peer:2.Ez6LSiNkZ4hS9ivnKXcEf1GGfXxqcWSCCXaFC775JZjVfwkoA.Vz6Mkr6TpZKXqdt4Kx28GSrLt4VysTWof6Npm4HNaGMcVPTff.SeyJpZCI6IjEiLCJ0IjoiZG0iLCJzIjoiZGlkOndlYjpkZXYtZGlkY29tbS1tZWRpYXRvci5oZXJva3VhcHAuY29tIiwiZGVzY3JpcHRpb24iOiJhIERJRENvbW0gZW5kcG9pbnQifQ#key-1\")\n  })\n\n  \n  const didDoc4 = {\n    \"@context\":[\"https://www.w3.org/ns/did/v1\",\"https://w3id.org/security/multikey/v1\",\n      // {\"@base\":\"did:peer:2.Ez6LSiNkZ4hS9ivnKXcEf1GGfXxqcWSCCXaFC775JZjVfwkoA.Vz6Mkr6TpZKXqdt4Kx28GSrLt4VysTWof6Npm4HNaGMcVPTff.SeyJpZCI6IjEiLCJ0IjoiZG0iLCJzIjoiZGlkOndlYjpkZXYtZGlkY29tbS1tZWRpYXRvci5oZXJva3VhcHAuY29tIiwiZGVzY3JpcHRpb24iOiJhIERJRENvbW0gZW5kcG9pbnQifQ\"}\n    ],\n    \"id\":\"did:peer:2.Ez6LSiNkZ4hS9ivnKXcEf1GGfXxqcWSCCXaFC775JZjVfwkoA.Vz6Mkr6TpZKXqdt4Kx28GSrLt4VysTWof6Npm4HNaGMcVPTff.SeyJpZCI6IjEiLCJ0IjoiZG0iLCJzIjoiZGlkOndlYjpkZXYtZGlkY29tbS1tZWRpYXRvci5oZXJva3VhcHAuY29tIiwiZGVzY3JpcHRpb24iOiJhIERJRENvbW0gZW5kcG9pbnQifQ\",\n    \"verificationMethod\":[\n      {\"id\":\"#key-2\",\"type\":\"Multikey\",\"controller\":\"did:peer:2.Ez6LSiNkZ4hS9ivnKXcEf1GGfXxqcWSCCXaFC775JZjVfwkoA.Vz6Mkr6TpZKXqdt4Kx28GSrLt4VysTWof6Npm4HNaGMcVPTff.SeyJpZCI6IjEiLCJ0IjoiZG0iLCJzIjoiZGlkOndlYjpkZXYtZGlkY29tbS1tZWRpYXRvci5oZXJva3VhcHAuY29tIiwiZGVzY3JpcHRpb24iOiJhIERJRENvbW0gZW5kcG9pbnQifQ\",\"publicKeyMultibase\":\"z6Mkr6TpZKXqdt4Kx28GSrLt4VysTWof6Npm4HNaGMcVPTff\"},\n      {\"id\":\"#key-1\",\"type\":\"Multikey\",\"controller\":\"did:peer:2.Ez6LSiNkZ4hS9ivnKXcEf1GGfXxqcWSCCXaFC775JZjVfwkoA.Vz6Mkr6TpZKXqdt4Kx28GSrLt4VysTWof6Npm4HNaGMcVPTff.SeyJpZCI6IjEiLCJ0IjoiZG0iLCJzIjoiZGlkOndlYjpkZXYtZGlkY29tbS1tZWRpYXRvci5oZXJva3VhcHAuY29tIiwiZGVzY3JpcHRpb24iOiJhIERJRENvbW0gZW5kcG9pbnQifQ\",\"publicKeyMultibase\":\"z6LSiNkZ4hS9ivnKXcEf1GGfXxqcWSCCXaFC775JZjVfwkoA\"}\n    ],\n    \"keyAgreement\":[\"#key-1\"],\n    \"authentication\":[\"#key-2\"],\n    \"assertionMethod\":[\"#key-2\"],\n    \"service\":[{\"id\":\"1\",\"description\":\"a DIDComm endpoint\",\"serviceEndpoint\":\"did:web:dev-didcomm-mediator.herokuapp.com\",\"type\":\"DIDCommMessaging\"}]\n  }  \n\n  it('should correctly get component by DID + key suffix with key in verificationMethod as suffix only', async () => {\n    const resolver = new DIDResolverPlugin({ resolver: new Resolver() })\n    const result = await resolver.getDIDComponentById({ didDocument: didDoc4, section: 'keyAgreement', didUrl: 'did:peer:2.Ez6LSiNkZ4hS9ivnKXcEf1GGfXxqcWSCCXaFC775JZjVfwkoA.Vz6Mkr6TpZKXqdt4Kx28GSrLt4VysTWof6Npm4HNaGMcVPTff.SeyJpZCI6IjEiLCJ0IjoiZG0iLCJzIjoiZGlkOndlYjpkZXYtZGlkY29tbS1tZWRpYXRvci5oZXJva3VhcHAuY29tIiwiZGVzY3JpcHRpb24iOiJhIERJRENvbW0gZW5kcG9pbnQifQ#key-1'})\n    expect((result.valueOf()as VerificationMethod).id).toEqual(\"did:peer:2.Ez6LSiNkZ4hS9ivnKXcEf1GGfXxqcWSCCXaFC775JZjVfwkoA.Vz6Mkr6TpZKXqdt4Kx28GSrLt4VysTWof6Npm4HNaGMcVPTff.SeyJpZCI6IjEiLCJ0IjoiZG0iLCJzIjoiZGlkOndlYjpkZXYtZGlkY29tbS1tZWRpYXRvci5oZXJva3VhcHAuY29tIiwiZGVzY3JpcHRpb24iOiJhIERJRENvbW0gZW5kcG9pbnQifQ#key-1\")\n  })\n})\n"
  },
  {
    "path": "packages/did-resolver/src/index.ts",
    "content": "/**\n * Provides a {@link @veramo/did-resolver#DIDResolverPlugin | plugin} for the {@link @veramo/core#Agent}\n * that implements {@link @veramo/core-types#IResolver } interface.\n *\n * @packageDocumentation\n */\nexport { DIDResolverPlugin } from './resolver.js'\nexport { UniversalResolver, getUniversalResolver, getUniversalResolverFor } from './universal-resolver.js'\n"
  },
  {
    "path": "packages/did-resolver/src/resolver.ts",
    "content": "import { DIDDocumentSection, IAgentPlugin, IResolver } from '@veramo/core-types'\nimport { schema } from '@veramo/core-types'\nimport { isDefined } from '@veramo/utils'\nimport {\n  DIDDocument,\n  DIDResolutionOptions,\n  DIDResolutionResult,\n  DIDResolver,\n  parse as parseDID,\n  Resolvable,\n  Resolver,\n  ServiceEndpoint,\n  VerificationMethod,\n} from 'did-resolver'\nimport Debug from 'debug'\n\nconst debug = Debug('veramo:resolver')\n\n/**\n * A Veramo Plugin that enables users to resolve DID documents.\n *\n * This plugin is used automatically by plugins that create or verify Verifiable Credentials or Presentations or when\n * working with DIDComm\n *\n * @public\n */\nexport class DIDResolverPlugin implements IAgentPlugin {\n  readonly methods: IResolver\n  readonly schema = schema.IResolver\n  private didResolver: Resolvable\n\n  constructor(options: { resolver?: Resolvable } | { [didMethod: string]: DIDResolver }) {\n    const { resolver, ...resolverMap } = options\n    if (isDefined(resolver)) {\n      this.didResolver = resolver as Resolvable\n    } else if (Object.keys(resolverMap).length > 0) {\n      this.didResolver = new Resolver(resolverMap as Record<string, DIDResolver>)\n    } else {\n      throw Error(\n        'invalid_setup: The DIDResolverPlugin must be initialized with a Resolvable or a map of methods to DIDResolver implementations',\n      )\n    }\n\n    this.methods = {\n      resolveDid: this.resolveDid.bind(this),\n      getDIDComponentById: this.getDIDComponentById.bind(this),\n    }\n  }\n\n  /** {@inheritDoc @veramo/core-types#IResolver.resolveDid} */\n  async resolveDid({\n    didUrl,\n    options,\n  }: {\n    didUrl: string\n    options?: DIDResolutionOptions\n  }): Promise<DIDResolutionResult> {\n    debug('Resolving %s', didUrl)\n    const resolverOptions = {\n      accept: 'application/did+ld+json',\n      ...options,\n    }\n\n    // ensure the required fields are present, even if the resolver is not compliant\n    const cannedResponse: DIDResolutionResult = {\n      didDocumentMetadata: {},\n      didResolutionMetadata: {},\n      didDocument: null,\n    }\n\n    const resolution = await this.didResolver.resolve(didUrl, resolverOptions)\n\n    return {\n      ...cannedResponse,\n      ...resolution,\n    }\n  }\n\n  /** {@inheritDoc @veramo/core-types#IResolver.getDIDComponentById} */\n  async getDIDComponentById({\n    didDocument,\n    didUrl,\n    section,\n  }: {\n    didDocument: DIDDocument\n    didUrl: string\n    section?: DIDDocumentSection\n  }): Promise<VerificationMethod | ServiceEndpoint> {\n    debug('Resolving %s', didUrl)\n    const did = parseDID(didUrl)?.did || didDocument.id\n    const doc = didDocument\n    const mainSections = [...(doc.verificationMethod || []), ...(doc.publicKey || []), ...(doc.service || [])]\n    const subsection = section ? [...(doc[section] || [])] : mainSections\n\n    let result = subsection.find((item) => {\n      if (typeof item === 'string') {\n        return item === didUrl || `${did}${item}` === didUrl\n      } else {\n        return item.id === didUrl || `${did}${item.id}` === didUrl\n      }\n    })\n    if (typeof result === 'string') {\n      result = mainSections.find((item) => item.id === didUrl || `${did}${item.id}` === didUrl || item.id === `${did}${didUrl}`);\n    }\n\n    if (!result) {\n      const err = `not_found: DID document fragment (${didUrl}) could not be located.`\n      debug(err)\n      throw new Error(err)\n    } else if (result.id.startsWith('#')) {\n      // fix did documents that use only the fragment part as key ID\n      result.id = `${did}${result.id}`\n    }\n    return result\n  }\n}\n"
  },
  {
    "path": "packages/did-resolver/src/universal-resolver.ts",
    "content": "import { DIDResolutionResult, DIDResolver } from 'did-resolver'\nimport fetch from 'cross-fetch'\n\ninterface Options {\n  url: string\n}\n\n/**\n * @deprecated please use `getUniresolver(url)` or `getUniresolverFor(methods, url)` instead\n *\n * @internal\n */\nexport class UniversalResolver {\n  constructor(options: Options) {\n    return getUniversalResolver(options.url)\n  }\n}\n\n/**\n * Creates a DIDResolver instance that can be used with `did-resolver`\n *\n * @example\n * ```typescript\n * const uniResolver = getUniversalResolver()\n * const resolver = new Resolver({\n *   web: uniResolver,\n *   key: uniResolver,\n *   elem: uniResolver\n * })\n * ```\n *\n * @param url - the URL for the universal resolver instance (See https://uniresolver.io )\n * @returns `DIDResolver`\n *\n * @public\n */\nexport function getUniversalResolver(\n  url: string = 'https://dev.uniresolver.io/1.0/identifiers/',\n): DIDResolver {\n  if (!url) {\n    throw Error('[did-resolver] Universal: url required')\n  }\n\n  const resolve: DIDResolver = async (didUrl: string): Promise<DIDResolutionResult> => {\n    try {\n      const headers = { 'Accept': 'application/ld+json;profile=\"https://w3id.org/did-resolution\"' }\n      const result = await fetch(url + didUrl, { headers })\n      const ddo = await result.json()\n      return ddo\n    } catch (e) {\n      return Promise.reject(e)\n    }\n  }\n\n  return resolve\n}\n\n/**\n * Creates a mapping of DID methods to a DIDResolver instance that can be used with `did-resolver`\n *\n * @example\n * ```typescript\n * const uniResolver = getUniversalResolverFor(['web', 'key', 'elem'])\n * const resolver = new Resolver({\n *   ...uniResolver,\n *   // other resolvers\n * })\n * ```\n *\n * @param methods - an array of DID methods that should be resolved by this universal resolver\n * @param url - the URL for the universal resolver instance (See https://uniresolver.io )\n * @returns `Record<string, DIDResolver>` a mapping of the given methods to an instance of `DIDResolver`\n *\n * @public\n */\nexport function getUniversalResolverFor(\n  methods: string[],\n  url: string = 'https://dev.uniresolver.io/1.0/identifiers/',\n): Record<string, DIDResolver> {\n  const uniResolver = getUniversalResolver(url)\n  const mapping: Record<string, DIDResolver> = {}\n  for (const method of methods) {\n    mapping[method] = uniResolver\n  }\n  return mapping\n}\n"
  },
  {
    "path": "packages/did-resolver/tsconfig.json",
    "content": "{\n  \"extends\": \"../tsconfig.settings.json\",\n  \"compilerOptions\": {\n    \"rootDir\": \"src\",\n    \"outDir\": \"build\",\n    \"declarationDir\": \"build\"\n  },\n  \"references\": [\n    {\n      \"path\": \"../core-types\"\n    },\n    {\n      \"path\": \"../utils\"\n    }\n  ]\n}\n"
  },
  {
    "path": "packages/key-manager/CHANGELOG.md",
    "content": "# Change Log\n\nAll notable changes to this project will be documented in this file.\nSee [Conventional Commits](https://conventionalcommits.org) for commit guidelines.\n\n# [7.0.0](https://github.com/decentralized-identity/veramo/compare/v6.0.2...v7.0.0) (2026-02-11)\n\n\n### Bug Fixes\n\n* **deps:** update dependency uuid to v11 ([#1431](https://github.com/decentralized-identity/veramo/issues/1431)) ([6ad84d9](https://github.com/decentralized-identity/veramo/commit/6ad84d91f02794e741e4b770e29e1ee9a93edcfb))\n* **deps:** update devdeps and bump typeorm to 0.3.20 ([#1272](https://github.com/decentralized-identity/veramo/issues/1272)) ([7d17f37](https://github.com/decentralized-identity/veramo/commit/7d17f37ea7cc4e73a8cdae028681ae1be5c4d11c))\n* **did-comm:** remove isomorphic-webcrypto dependency ([#1401](https://github.com/decentralized-identity/veramo/issues/1401)) ([85cc1ce](https://github.com/decentralized-identity/veramo/commit/85cc1ce1d567afcbc42e0fd89eb2515505044c83)), closes [#1381](https://github.com/decentralized-identity/veramo/issues/1381) [#1387](https://github.com/decentralized-identity/veramo/issues/1387)\n* **key-manager:** handling of `kid` param when creating keys ([#1492](https://github.com/decentralized-identity/veramo/issues/1492)) ([4c52549](https://github.com/decentralized-identity/veramo/commit/4c52549daa215fe3b791d56a156f88144d11733e))\n\n\n### Features\n\n* **key-manager:** allow user defined kid on keyManagerCreate ([#1426](https://github.com/decentralized-identity/veramo/issues/1426)) ([0784df0](https://github.com/decentralized-identity/veramo/commit/0784df09a38a10cd66a83485e047770b427d8648)), closes [#1353](https://github.com/decentralized-identity/veramo/issues/1353)\n\n\n\n\n\n## [6.0.2](https://github.com/decentralized-identity/veramo/compare/v6.0.1...v6.0.2) (2026-01-16)\n\n**Note:** Version bump only for package @veramo/key-manager\n\n\n\n\n\n## [6.0.1](https://github.com/decentralized-identity/veramo/compare/v6.0.0...v6.0.1) (2026-01-16)\n\n**Note:** Version bump only for package @veramo/key-manager\n\n\n\n\n\n# [6.0.0](https://github.com/decentralized-identity/veramo/compare/v5.6.0...v6.0.0) (2024-04-02)\n\n\n### Bug Fixes\n\n* export const plugin schemas instead of defaults ([#1327](https://github.com/decentralized-identity/veramo/issues/1327)) ([7896cea](https://github.com/decentralized-identity/veramo/commit/7896ceaf2c79993eee44e46950814bea74bfe647)), closes [#1318](https://github.com/decentralized-identity/veramo/issues/1318) [#1317](https://github.com/decentralized-identity/veramo/issues/1317) [#1315](https://github.com/decentralized-identity/veramo/issues/1315)\n\n\n### Code Refactoring\n\n* generate plugin schemas as TS instead of JSON ([#1315](https://github.com/decentralized-identity/veramo/issues/1315)) ([65c2d4b](https://github.com/decentralized-identity/veramo/commit/65c2d4bc814daa9a3a89f4f7b8e8c6973b8ce2f0)), closes [#1254](https://github.com/decentralized-identity/veramo/issues/1254)\n\n\n### Features\n\n* add Multikey support ([#1316](https://github.com/decentralized-identity/veramo/issues/1316)) ([165de35](https://github.com/decentralized-identity/veramo/commit/165de3549ccfd3d7c84514608ac3ea9e56a7b807))\n\n\n### BREAKING CHANGES\n\n* The `plugin.schema.json` files are now generated as `plugin.schema.ts`.\n\n\n\n\n\n# [5.6.0](https://github.com/decentralized-identity/veramo/compare/v5.5.3...v5.6.0) (2024-01-16)\n\n\n### Features\n\n* **remote-client:** allow dynamic headers param for AgentRestClient constructor ([#1314](https://github.com/decentralized-identity/veramo/issues/1314)) ([1b8a0a2](https://github.com/decentralized-identity/veramo/commit/1b8a0a2718dd63492ad3a312a6ebe5f6e7849935)), closes [#1313](https://github.com/decentralized-identity/veramo/issues/1313)\n\n\n\n\n\n## [5.5.3](https://github.com/decentralized-identity/veramo/compare/v5.5.2...v5.5.3) (2023-10-09)\n\n\n### Bug Fixes\n\n* use DIF URLs in packages ([#1271](https://github.com/decentralized-identity/veramo/issues/1271)) ([3dfc601](https://github.com/decentralized-identity/veramo/commit/3dfc6014cdee7902c59d8db76b4c8507b870f227))\n\n\n\n\n\n# [5.5.0](https://github.com/uport-project/veramo/compare/v5.4.1...v5.5.0) (2023-09-19)\n\n\n### Bug Fixes\n\n* **did-provider-key:** use compressed keys for creating Secp256k1 did:key ([#1217](https://github.com/uport-project/veramo/issues/1217)) ([ba8f6f5](https://github.com/uport-project/veramo/commit/ba8f6f5b9b701e57af86491504ecd209ca0c1c1d)), closes [#1213](https://github.com/uport-project/veramo/issues/1213)\n\n\n\n\n\n## [5.4.1](https://github.com/uport-project/veramo/compare/v5.4.0...v5.4.1) (2023-08-04)\n\n\n### Bug Fixes\n\n* **ci:** benign change meant to tag all packages for another patch release ([#1211](https://github.com/uport-project/veramo/issues/1211)) ([41b5c90](https://github.com/uport-project/veramo/commit/41b5c90277171b7b38c5cf49ca01db5cf75b6300))\n\n\n\n\n\n# [5.4.0](https://github.com/uport-project/veramo/compare/v5.3.0...v5.4.0) (2023-08-01)\n\n\n### Features\n\n* **did-comm:** add support for the AES based content and key encryption algorithms ([#1180](https://github.com/uport-project/veramo/issues/1180)) ([5294a81](https://github.com/uport-project/veramo/commit/5294a812ee578c0712b54f216416c3ef78c848da))\n\n\n\n\n\n# [5.3.0](https://github.com/uport-project/veramo/compare/v5.2.0...v5.3.0) (2023-07-27)\n\n**Note:** Version bump only for package @veramo/key-manager\n\n\n\n\n\n## [5.1.2](https://github.com/uport-project/veramo/compare/v5.1.1...v5.1.2) (2023-02-25)\n\n**Note:** Version bump only for package @veramo/key-manager\n\n\n\n\n\n# [5.1.0](https://github.com/uport-project/veramo/compare/v5.0.0...v5.1.0) (2023-02-24)\n\n**Note:** Version bump only for package @veramo/key-manager\n\n\n\n\n\n# [5.0.0](https://github.com/uport-project/veramo/compare/v4.3.0...v5.0.0) (2023-02-09)\n\n\n### Bug Fixes\n\n* **key-manager:** rename Abstract[Private]KeyStore methods for SES compatibility ([91631b6](https://github.com/uport-project/veramo/commit/91631b6d2a09d46accff6509f44792d88209b801)), closes [#1090](https://github.com/uport-project/veramo/issues/1090)\n\n\n### Build System\n\n* convert veramo modules to ESM instead of CommonJS ([#1103](https://github.com/uport-project/veramo/issues/1103)) ([b5cea3c](https://github.com/uport-project/veramo/commit/b5cea3c0d80d900a47bd1d9eea68f84b70a35e7b)), closes [#1099](https://github.com/uport-project/veramo/issues/1099)\n\n\n### Features\n\n* isolate `core-types` package from `core` ([#1116](https://github.com/uport-project/veramo/issues/1116)) ([ba7a303](https://github.com/uport-project/veramo/commit/ba7a303de91cf4cc568a3af1ddf8ca98ed022e9f))\n\n\n### BREAKING CHANGES\n\n* **key-manager:** implementations of AbstractKeyStore and AbstractPrivateKeyStore need to rename their methods to conform to the new API. Functionality remains the same.\n* this is a breaking change as modules will have to be imported differently: \n* https://www.typescriptlang.org/docs/handbook/esm-node.html\n* https://nodejs.org/api/esm.html\n* https://caniuse.com/?search=modules\n\ntest(did-provider-ion): skip a couple of tests that fail with unreasonable errors\nchore: use ubuntu-latest on CI\nfix: temporarily remove puppeteer tests\nfix: use craco for test-react-app to enable babel config\ntest: fix unit and integration tests (browser tests still broken)\nfix: fix some build issues that prevented tests from working\nfix: missing deps flagged by pnpm\n\n\n\n\n\n# [4.3.0](https://github.com/uport-project/veramo/compare/v4.2.0...v4.3.0) (2023-01-27)\n\n**Note:** Version bump only for package @veramo/key-manager\n\n\n\n\n\n# [4.2.0](https://github.com/uport-project/veramo/compare/v4.1.2...v4.2.0) (2022-12-05)\n\n\n### Bug Fixes\n\n* **deps:** bump dependencies ([701b8ed](https://github.com/uport-project/veramo/commit/701b8edf981ea11c7ddb6a81d2817dbbdbb022f3))\n\n\n\n\n\n## [4.1.1](https://github.com/uport-project/veramo/compare/v4.1.0...v4.1.1) (2022-11-01)\n\n**Note:** Version bump only for package @veramo/key-manager\n\n\n\n\n\n# [4.1.0](https://github.com/uport-project/veramo/compare/v4.0.2...v4.1.0) (2022-10-31)\n\n\n### Bug Fixes\n\n* **deps:** Update dependency ethr-did-resolver to v7 ([#1038](https://github.com/uport-project/veramo/issues/1038)) ([d421c0f](https://github.com/uport-project/veramo/commit/d421c0f9f5934829df2930e58e98bcfce813ce84))\n\n\n\n\n\n## [4.0.2](https://github.com/uport-project/veramo/compare/v4.0.1...v4.0.2) (2022-10-04)\n\n\n### Bug Fixes\n\n* **deps:** update dependency uuid to v9 ([4ff90a5](https://github.com/uport-project/veramo/commit/4ff90a58f5993880635f2b39c73edadaf3149066))\n\n\n\n\n\n# [4.0.0](https://github.com/uport-project/veramo/compare/v3.1.5...v4.0.0) (2022-09-22)\n\n\n### Bug Fixes\n\n* **deps:** Bump `did-jwt`, `did-jwt-vc` as direct package deps ([#955](https://github.com/uport-project/veramo/issues/955)) ([e57edb3](https://github.com/uport-project/veramo/commit/e57edb34cfbaee6bba1d944497d688104f32c698))\n* **deps:** update all non-major dependencies ([b537187](https://github.com/uport-project/veramo/commit/b537187ba04ba41cd45c18dfb58c92725b65b084))\n* **deps:** update dependency did-jwt to v5.12.0 ([5b414d7](https://github.com/uport-project/veramo/commit/5b414d7d720e7c59cf3f56c35da5fe247e21bf26))\n* **deps:** use did-jwt v6 and ethr-did-resolver v6 ([#925](https://github.com/uport-project/veramo/issues/925)) ([0c77d03](https://github.com/uport-project/veramo/commit/0c77d03ec5ec9e2091de3f74f67ab86a22cde197)), closes [#923](https://github.com/uport-project/veramo/issues/923) [#848](https://github.com/uport-project/veramo/issues/848)\n* **did-resolver:** use interface `Resolvable` instead of the `Resolver` class ([9c2e59f](https://github.com/uport-project/veramo/commit/9c2e59f3f23f808511c6c0e8e440b4d53ba5cb00))\n* **docs:** fix relevant errors and warnings in TSDoc to enable proper docs generation on `[@next](https://github.com/next)` branch ([79c3872](https://github.com/uport-project/veramo/commit/79c387230219c92c1951d19b8ddf716308a46c5b))\n* **key-manager:** add missing uuid dependency ([#807](https://github.com/uport-project/veramo/issues/807)) ([b6d9738](https://github.com/uport-project/veramo/commit/b6d973848c0cc3f61eaf4fa9e572d7fe2d522fda))\n* update and fix inline documentation of all exported types ([#921](https://github.com/uport-project/veramo/issues/921)) ([63e64e0](https://github.com/uport-project/veramo/commit/63e64e0e2693808c4704dca8cc511dc0bab3f3b1))\n\n\n### Features\n\n* add support for serviceEndpoint property as defined in latest DID Spec ([#988](https://github.com/uport-project/veramo/issues/988)) ([9bed70b](https://github.com/uport-project/veramo/commit/9bed70ba658aed34a97944e0dee27bca6c81d700))\n* **credential-status:** rename plugin interfaces and methods ([a5adaba](https://github.com/uport-project/veramo/commit/a5adaba21a97f525bf69d156df991afc234896ab)), closes [#981](https://github.com/uport-project/veramo/issues/981)\n* **credential-w3c:** add ICredentialPlugin interface in core package ([#1001](https://github.com/uport-project/veramo/issues/1001)) ([7b6d195](https://github.com/uport-project/veramo/commit/7b6d1950364c8b741dd958d29e506b95fa5b1cec)), closes [#941](https://github.com/uport-project/veramo/issues/941)\n* **credential-w3c:** align verification API between formats ([#996](https://github.com/uport-project/veramo/issues/996)) ([b987fc0](https://github.com/uport-project/veramo/commit/b987fc0903a31d3bbffb43fef872be4d6c62c2ad)), closes [#935](https://github.com/uport-project/veramo/issues/935) [#954](https://github.com/uport-project/veramo/issues/954) [#375](https://github.com/uport-project/veramo/issues/375) [#989](https://github.com/uport-project/veramo/issues/989)\n* **kms-web3:** add a KMS implementation backed by a web3 provider ([#924](https://github.com/uport-project/veramo/issues/924)) ([14f71af](https://github.com/uport-project/veramo/commit/14f71afbb72dca8274790d3b20b518ddfe4f2585)), closes [#688](https://github.com/uport-project/veramo/issues/688)\n\n\n### BREAKING CHANGES\n\n* the `did-resolver` and connected libraries change the data-type for `ServiceEndpoint` to `Service` and the previous semantic has changed. Services can have multiple endpoints, not just a single string.\n\n\n\n\n\n## [3.1.3](https://github.com/uport-project/veramo/compare/v3.1.2...v3.1.3) (2022-06-01)\n\n**Note:** Version bump only for package @veramo/key-manager\n\n\n\n\n\n# [3.1.0](https://github.com/uport-project/veramo/compare/v3.0.0...v3.1.0) (2021-11-12)\n\n\n### Features\n\n* **did-comm:** didcomm messaging using did:ethr ([#744](https://github.com/uport-project/veramo/issues/744)) ([1be5e04](https://github.com/uport-project/veramo/commit/1be5e04e09112c0823d776fe2d55117d71a7b448)), closes [#743](https://github.com/uport-project/veramo/issues/743)\n\n\n\n\n\n# [3.0.0](https://github.com/uport-project/veramo/compare/v2.1.3...v3.0.0) (2021-09-20)\n\n\n### Bug Fixes\n\n* **deps:** update all non-major dependencies ([8fc5312](https://github.com/uport-project/veramo/commit/8fc53120498ce2982e8ec640e00bbb03f6f4204e))\n* **key-manager:** handle eth_signTransaction with from field ([#675](https://github.com/uport-project/veramo/issues/675)) ([50f074d](https://github.com/uport-project/veramo/commit/50f074ddcab5dbafe5bad0ebcbfde8a9f91826e4)), closes [#674](https://github.com/uport-project/veramo/issues/674)\n\n\n### Features\n\n* **key-manager:** move private key storage to kms-local ([#661](https://github.com/uport-project/veramo/issues/661)) ([6b1d135](https://github.com/uport-project/veramo/commit/6b1d135eedb1c58b715be8941d34312da39facb2)), closes [#539](https://github.com/uport-project/veramo/issues/539) [#540](https://github.com/uport-project/veramo/issues/540) [#680](https://github.com/uport-project/veramo/issues/680)\n\n\n### BREAKING CHANGES\n\n* **key-manager:** `keyManagetGet` no longer returns private key data\n* **key-manager:** `KeyStore` no longer requires a `SecretBox`\n* **key-manager:** `KeyManagementSystem` needs a `PrivateKeyStore`\n* **key-manager:** @veramo/cli configuration version update to 3.0\n\nIf you're already working with Veramo and wish to upgrade existing agents to veramo 3.0, you'll have to make some changes to your configuration, depending on how you're using the framework.\n\nIt boils down to these 3 steps:\n\n1. Update your database connection to use migrations\n2. Remove the `SecretBox` parameter from `KeyManager`\n3. Add a `PrivateKeyStore` parameter to `KeyManagementSystem` with a `SecretBox` that you were using before with `KeyManager` (and keep the same encryption key)\n\n* feat(key-manager): move private key storage to kms-local\n\n\n\n\n\n# [2.1.0](https://github.com/uport-project/veramo/compare/v2.0.1...v2.1.0) (2021-08-11)\n\n**Note:** Version bump only for package @veramo/key-manager\n\n\n\n\n\n# [2.0.0](https://github.com/uport-project/veramo/compare/v1.2.2...v2.0.0) (2021-07-14)\n\n\n### Bug Fixes\n\n* **kms-local:** replace buggy didcomm clone with did jwt implementation ([#548](https://github.com/uport-project/veramo/issues/548)) ([9dea353](https://github.com/uport-project/veramo/commit/9dea3533c1936d53c1d5674c358679b17d623af2)), closes [#538](https://github.com/uport-project/veramo/issues/538)\n\n\n### Features\n\n* implement didcomm v2 packing/unpacking ([#575](https://github.com/uport-project/veramo/issues/575)) ([249b07e](https://github.com/uport-project/veramo/commit/249b07eca8d2de9eb5252d71683d5f1fba319d60)), closes [#559](https://github.com/uport-project/veramo/issues/559) [#558](https://github.com/uport-project/veramo/issues/558)\n* **key-manager:** add generic signing capabilities ([#529](https://github.com/uport-project/veramo/issues/529)) ([5f10a1b](https://github.com/uport-project/veramo/commit/5f10a1bcea214cb593de12fa6ec3a91b3cb712bb)), closes [#522](https://github.com/uport-project/veramo/issues/522)\n* **key-manager:** add method to compute a shared secret ([#555](https://github.com/uport-project/veramo/issues/555)) ([393c316](https://github.com/uport-project/veramo/commit/393c316e27fb31b3c7fa63aae039b8fc6ae963ce)), closes [#541](https://github.com/uport-project/veramo/issues/541)\n* **key-manager:** implement JWE functionality directly in `key-manager` ([#557](https://github.com/uport-project/veramo/issues/557)) ([a030f0a](https://github.com/uport-project/veramo/commit/a030f0a9779e5158d9369d2f81107158fbaeac70)), closes [#556](https://github.com/uport-project/veramo/issues/556)\n\n\n### BREAKING CHANGES\n\n* **kms-local:** `@veramo/kms-local-react-native` is no more. On react-native, please use `@veramo/kms-local` instead, combined with `@ethersproject/shims`\n\n\n\n\n\n# [1.2.0](https://github.com/uport-project/veramo/compare/v1.1.2...v1.2.0) (2021-04-27)\n\n\n### Features\n\n* adapt to did core spec ([#430](https://github.com/uport-project/veramo/issues/430)) ([9712db0](https://github.com/uport-project/veramo/commit/9712db0eea1a3f48cf0665d66ae715ea0c23cd4a)), closes [#418](https://github.com/uport-project/veramo/issues/418) [#428](https://github.com/uport-project/veramo/issues/428) [#417](https://github.com/uport-project/veramo/issues/417) [#416](https://github.com/uport-project/veramo/issues/416) [#412](https://github.com/uport-project/veramo/issues/412) [#397](https://github.com/uport-project/veramo/issues/397) [#384](https://github.com/uport-project/veramo/issues/384) [#394](https://github.com/uport-project/veramo/issues/394)\n* add MemoryDIDStore and MemoryKeyStore ([#447](https://github.com/uport-project/veramo/issues/447)) ([5ab1792](https://github.com/uport-project/veramo/commit/5ab1792f080cc319a9899e39dc9b634a05aa4f7c))\n* **did-provider-key:** add did:key provider; fixes [#335](https://github.com/uport-project/veramo/issues/335) ([#351](https://github.com/uport-project/veramo/issues/351)) ([42cd2b0](https://github.com/uport-project/veramo/commit/42cd2b08a2fd21b5b5d7bdfa57dd00ccc7184dc7)), closes [decentralized-identity/did-jwt#78](https://github.com/decentralized-identity/did-jwt/issues/78)\n\n\n\n\n\n# [1.1.0](https://github.com/uport-project/veramo/compare/v1.0.1...v1.1.0) (2021-01-26)\n\n**Note:** Version bump only for package @veramo/key-manager\n\n\n\n\n\n## 1.0.1 (2020-12-18)\n\n**Note:** Version bump only for package @veramo/key-manager\n"
  },
  {
    "path": "packages/key-manager/LICENSE",
    "content": "                                 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 2019 Consensys AG\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"
  },
  {
    "path": "packages/key-manager/README.md",
    "content": "# Veramo Key Manager plugin\n\nThis plugin combines multiple Key management systems and exposes a unified API to the DID manager\nand other plugins that require crypto functionality.\n\n"
  },
  {
    "path": "packages/key-manager/api-extractor.json",
    "content": "{\n  \"$schema\": \"https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json\",\n  \"apiReport\": {\n    \"enabled\": true,\n    \"reportFolder\": \"./api\",\n    \"reportTempFolder\": \"./api\"\n  },\n\n  \"docModel\": {\n    \"enabled\": true,\n    \"apiJsonFilePath\": \"./api/<unscopedPackageName>.api.json\"\n  },\n\n  \"dtsRollup\": {\n    \"enabled\": false\n  },\n  \"mainEntryPointFilePath\": \"<projectFolder>/build/index.d.ts\"\n}\n"
  },
  {
    "path": "packages/key-manager/package.json",
    "content": "{\n  \"name\": \"@veramo/key-manager\",\n  \"description\": \"Key Manager plugin for Veramo\",\n  \"version\": \"7.0.0\",\n  \"main\": \"build/index.js\",\n  \"exports\": \"./build/index.js\",\n  \"types\": \"build/index.d.ts\",\n  \"scripts\": {\n    \"build\": \"tsc\",\n    \"extract-api\": \"node ../cli/bin/veramo.js dev extract-api\"\n  },\n  \"dependencies\": {\n    \"@noble/curves\": \"^1.4.2\",\n    \"@veramo/core-types\": \"workspace:^\",\n    \"@veramo/utils\": \"workspace:^\",\n    \"debug\": \"^4.3.4\",\n    \"did-jwt\": \"^8.0.0\",\n    \"ethers\": \"^6.13.4\",\n    \"uint8arrays\": \"^4.0.6\",\n    \"uuid\": \"^11.0.0\"\n  },\n  \"devDependencies\": {\n    \"@types/debug\": \"4.1.8\",\n    \"@types/uuid\": \"9.0.2\",\n    \"typescript\": \"5.7.3\"\n  },\n  \"files\": [\n    \"build/**/*\",\n    \"src/**/*\",\n    \"README.md\",\n    \"LICENSE\"\n  ],\n  \"publishConfig\": {\n    \"access\": \"public\"\n  },\n  \"repository\": {\n    \"type\": \"git\",\n    \"url\": \"https://github.com/decentralized-identity/veramo.git\",\n    \"directory\": \"packages/key-manager\"\n  },\n  \"author\": \"Consensys Mesh R&D <hello@veramo.io>\",\n  \"contributors\": [\n    \"Simonas Karuzas <simonas.karuzas@mesh.xyz>\",\n    \"Mircea Nistor <mircea.nistor@mesh.xyz>\"\n  ],\n  \"keywords\": [\n    \"Veramo\",\n    \"DID\",\n    \"Verifiable Credential\",\n    \"veramo-plugin\",\n    \"aggregator\",\n    \"key-manager\",\n    \"KMS\"\n  ],\n  \"license\": \"Apache-2.0\",\n  \"type\": \"module\",\n  \"moduleDirectories\": [\n    \"node_modules\",\n    \"src\"\n  ]\n}\n"
  },
  {
    "path": "packages/key-manager/src/__tests__/abstract-key-store.test.ts",
    "content": "import { AbstractKeyStore } from '../abstract-key-store.js'\nimport { IKey, ManagedKeyInfo } from '@veramo/core-types'\n\nclass MockKeyStore extends AbstractKeyStore {\n  async listKeys(args: {}): Promise<ManagedKeyInfo[]> {\n    return [\n      {\n        kid: '',\n        kms: '',\n        type: 'Ed25519',\n        publicKeyHex: '',\n      },\n    ]\n  }\n  async getKey({ kid }: { kid: string }): Promise<IKey> {\n    return {\n      kid: '',\n      kms: '',\n      type: 'Ed25519',\n      publicKeyHex: '',\n    }\n  }\n\n  async deleteKey({ kid }: { kid: string }) {\n    return true\n  }\n\n  async importKey(args: IKey): Promise<boolean> {\n    return true\n  }\n}\n\ndescribe('core AbstractKeyStore compile time error checking', () => {\n  it.todo('call mock methods')\n})\n"
  },
  {
    "path": "packages/key-manager/src/__tests__/default.test.ts",
    "content": "import { AbstractKeyManagementSystem, KeyManager, MemoryKeyStore } from '../index.js'\nimport { IKey, ManagedKeyInfo, MinimalImportableKey, TKeyType } from '../../../core-types/src'\n\nconst TEST_KEY_TYPE = 'TEST_KEY_TYPE'\nconst TEST_ALG = 'TEST_ALG'\n\nclass DummyKMS extends AbstractKeyManagementSystem {\n  private keys: Map<string, ManagedKeyInfo> = new Map()\n\n  async importKey(args: Exclude<MinimalImportableKey, 'kms'>): Promise<ManagedKeyInfo> {\n    if (args.type && args.type !== TEST_KEY_TYPE) {\n      throw new Error('not_supported: Only TEST_KEY_TYPE is supported')\n    }\n    const key: ManagedKeyInfo = {\n      type: args.type ?? TEST_KEY_TYPE,\n      kid: args.kid || 'dummy-kid',\n      publicKeyHex: '0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef',\n      kms: 'dummy',\n      meta: { algorithms: [TEST_ALG] },\n    }\n    this.keys.set(key.kid, key)\n    return key\n  }\n\n  async listKeys(): Promise<ManagedKeyInfo[]> {\n    return Array.from(this.keys.values())\n  }\n\n  async createKey({ type, kid }: { type: TKeyType; kid?: string }): Promise<ManagedKeyInfo> {\n    if (type && type !== TEST_KEY_TYPE) {\n      throw new Error('not_supported: Only TEST_KEY_TYPE is supported')\n    }\n    const key: ManagedKeyInfo = {\n      type: type ?? TEST_KEY_TYPE,\n      kid: kid ? `${kid}-but-changed-by-the-kms` : 'dummy-key-' + Math.random(),\n      publicKeyHex: '0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef',\n      kms: 'dummy',\n      meta: { algorithms: [TEST_ALG] },\n    }\n    this.keys.set(key.kid, key)\n    return key\n  }\n\n  async deleteKey({ kid }: { kid: string }): Promise<boolean> {\n    return this.keys.delete(kid)\n  }\n\n  async sign({\n    keyRef,\n    algorithm,\n    data,\n  }: {\n    keyRef: Pick<IKey, 'kid'>\n    algorithm?: string\n    data: Uint8Array\n  }): Promise<string> {\n    if (algorithm && algorithm !== TEST_ALG) {\n      throw new Error('not_supported: Only TEST_ALG is supported')\n    }\n    if (!this.keys.has(keyRef.kid)) {\n      throw new Error(`key_not_found: Key with kid ${keyRef.kid} not found`)\n    }\n    return 'dummy-signature-' + data.length\n  }\n\n  async sharedSecret({\n    myKeyRef,\n    theirKey,\n  }: {\n    myKeyRef: Pick<IKey, 'kid'>\n    theirKey: Pick<IKey, 'publicKeyHex' | 'type'>\n  }): Promise<string> {\n    if (!this.keys.has(myKeyRef.kid)) {\n      throw new Error(`key_not_found: Key with kid ${myKeyRef.kid} not found`)\n    }\n    return '0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef'\n  }\n}\n\ndescribe('key-manager', () => {\n  it('creates a key and signs with it', async () => {\n    const kms = new DummyKMS()\n    const keyManager = new KeyManager({\n      store: new MemoryKeyStore(),\n      kms: { dummy: kms },\n    })\n\n    const key = await keyManager.keyManagerCreate({ type: TEST_KEY_TYPE, kms: 'dummy', kid: 'test-key' })\n    expect(key.type).toEqual(TEST_KEY_TYPE)\n    expect(key.kid).toEqual('test-key-but-changed-by-the-kms')\n    expect(key.kms).toEqual('dummy')\n\n    const data = 'test data for signing'\n    const signature = await keyManager.keyManagerSign({ keyRef: key.kid, data, algorithm: TEST_ALG })\n    expect(signature).toBeDefined()\n    expect(typeof signature).toBe('string')\n  })\n\n  it('imports a key and signs with it', async () => {\n    const kms = new DummyKMS()\n    const keyManager = new KeyManager({\n      store: new MemoryKeyStore(),\n      kms: { dummy: kms },\n    })\n\n    const privateKeyHex = 'dummy-private-key-hex'\n    const key = await keyManager.keyManagerImport({\n      kid: 'imported-key',\n      type: TEST_KEY_TYPE,\n      privateKeyHex,\n      kms: 'dummy',\n    })\n    expect(key.type).toEqual(TEST_KEY_TYPE)\n    expect(key.kid).toEqual('imported-key')\n    expect(key.kms).toEqual('dummy')\n\n    const data = 'test data for signing'\n    const signature = await keyManager.keyManagerSign({ keyRef: 'imported-key', data, algorithm: TEST_ALG })\n    expect(signature).toBeDefined()\n    expect(typeof signature).toBe('string')\n  })\n\n  it('gets key management systems', async () => {\n    const kms = new DummyKMS()\n    const keyManager = new KeyManager({\n      store: new MemoryKeyStore(),\n      kms: { local: kms, dummy: kms },\n    })\n\n    const systems = await keyManager.keyManagerGetKeyManagementSystems()\n    expect(systems).toEqual(['local', 'dummy'])\n  })\n\n  it('gets a key', async () => {\n    const kms = new DummyKMS()\n    const keyManager = new KeyManager({\n      store: new MemoryKeyStore(),\n      kms: { dummy: kms },\n    })\n\n    const createdKey = await keyManager.keyManagerCreate({\n      type: TEST_KEY_TYPE,\n      kms: 'dummy',\n      kid: 'get-test-key',\n    })\n    const key = await keyManager.keyManagerGet({ kid: createdKey.kid })\n    expect(key.type).toEqual(TEST_KEY_TYPE)\n    expect(key.kms).toEqual('dummy')\n  })\n\n  it('deletes a key', async () => {\n    const kms = new DummyKMS()\n    const keyManager = new KeyManager({\n      store: new MemoryKeyStore(),\n      kms: { dummy: kms },\n    })\n\n    const key = await keyManager.keyManagerCreate({\n      type: TEST_KEY_TYPE,\n      kms: 'dummy',\n      kid: 'delete-test-key',\n    })\n    const result = await keyManager.keyManagerDelete({ kid: key.kid })\n    expect(result).toBe(true)\n\n    await expect(keyManager.keyManagerGet({ kid: key.kid })).rejects.toThrow()\n  })\n\n  it('fails to encrypt and decrypts JWE because of unsupported algorithms', async () => {\n    const kms = new DummyKMS()\n    const keyManager = new KeyManager({\n      store: new MemoryKeyStore(),\n      kms: { dummy: kms },\n    })\n\n    const senderKey = await keyManager.keyManagerCreate({ type: TEST_KEY_TYPE, kms: 'dummy', kid: 'sender' })\n    const recipientKey = {\n      type: TEST_KEY_TYPE,\n      publicKeyHex: 'dummy',\n      kid: 'recipient',\n    }\n\n    const data = 'secret message'\n    await expect(\n      keyManager.keyManagerEncryptJWE({ kid: senderKey.kid, to: recipientKey, data }),\n    ).rejects.toThrow('not_supported: The recipient public key type is not supported')\n  })\n\n  it('computes shared secret', async () => {\n    const kms = new DummyKMS()\n    const keyManager = new KeyManager({\n      store: new MemoryKeyStore(),\n      kms: { dummy: kms },\n    })\n\n    const myKey = await keyManager.keyManagerCreate({ type: TEST_KEY_TYPE, kms: 'dummy', kid: 'my-key' })\n    const theirKey = {\n      type: TEST_KEY_TYPE,\n      publicKeyHex: 'really doesnt matter for the dummy kms',\n    }\n\n    const secret = await keyManager.keyManagerSharedSecret({ secretKeyRef: myKey.kid, publicKey: theirKey })\n    expect(secret).toEqual('0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef')\n  })\n\n  it('signs JWT', async () => {\n    const kms = new DummyKMS()\n    const keyManager = new KeyManager({\n      store: new MemoryKeyStore(),\n      kms: { dummy: kms },\n    })\n\n    const key = await keyManager.keyManagerCreate({ type: TEST_KEY_TYPE, kms: 'dummy', kid: 'jwt-key' })\n    const data = 'test jwt data'\n    const signature = await keyManager.keyManagerSignJWT({ kid: key.kid, data })\n    expect(signature).toEqual('dummy-signature-13')\n  })\n})\n"
  },
  {
    "path": "packages/key-manager/src/abstract-key-management-system.ts",
    "content": "import { IKey, ManagedKeyInfo, MinimalImportableKey, TKeyType } from '@veramo/core-types'\nimport { getBytes, Transaction } from 'ethers'\nimport * as u8a from 'uint8arrays'\n\n/**\n * This base abstract class should be extended to provide cryptographic functions to other Veramo plugins.\n *\n * @public\n */\nexport abstract class AbstractKeyManagementSystem {\n  abstract importKey(args: Exclude<MinimalImportableKey, 'kms'>): Promise<ManagedKeyInfo>\n\n  abstract listKeys(): Promise<Array<ManagedKeyInfo>>\n\n  abstract createKey(args: { type: TKeyType; meta?: any; kid?: string }): Promise<ManagedKeyInfo>\n\n  abstract deleteKey(args: { kid: string }): Promise<boolean>\n\n  /**@deprecated please use `sign({key, alg: 'eth_signTransaction', data: arrayify(serialize(transaction))})` instead */\n  async signEthTX({ key, transaction }: { key: Pick<IKey, 'kid'>; transaction: object }): Promise<string> {\n    const { v, r, s, from, ...tx } = <any>transaction\n    const serializedTx = Transaction.from(tx).unsignedSerialized\n    const data = getBytes(serializedTx)\n    const algorithm = 'eth_signTransaction'\n    const signedTxHexString = this.sign({ keyRef: key, data, algorithm })\n    return signedTxHexString\n  }\n\n  /**@deprecated please use `sign({key, data})` instead, with `Uint8Array` data */\n  async signJWT({ key, data }: { key: Pick<IKey, 'kid'>; data: string | Uint8Array }): Promise<string> {\n    let dataBytes: Uint8Array\n    if (typeof data === 'string') {\n      try {\n        // TODO: Make sure this works as we removed the options from arrayify\n        if (data && data.substring(0, 2) !== \"0x\") {\n          data = \"0x\" + data;\n        }\n        dataBytes = getBytes(data)\n      } catch (e) {\n        dataBytes = u8a.fromString(data, 'utf-8')\n      }\n    } else {\n      dataBytes = data\n    }\n    return this.sign({ keyRef: key, data: dataBytes })\n  }\n\n  abstract sign(args: {\n    keyRef: Pick<IKey, 'kid'>\n    algorithm?: string\n    data: Uint8Array\n    [x: string]: any\n  }): Promise<string>\n\n  abstract sharedSecret(args: {\n    myKeyRef: Pick<IKey, 'kid'>\n    theirKey: Pick<IKey, 'publicKeyHex' | 'type'>\n  }): Promise<string>\n}\n"
  },
  {
    "path": "packages/key-manager/src/abstract-key-store.ts",
    "content": "import { IKey, ManagedKeyInfo } from '@veramo/core-types'\n\n/**\n * This base abstract class should be extended to provide platform specific implementations that are usable by\n * {@link @veramo/key-manager#KeyManager | KeyManager}.\n *\n * Implementations of this class are used to store mappings between key IDs and their respective\n * {@link @veramo/key-manager#AbstractKeyManagementSystem | AbstractKeyManagementSystem} implementations.\n *\n * @public\n */\nexport abstract class AbstractKeyStore {\n  abstract importKey(args: Partial<IKey>): Promise<boolean>\n\n  abstract getKey(args: { kid: string }): Promise<IKey>\n\n  abstract deleteKey(args: { kid: string }): Promise<boolean>\n\n  abstract listKeys(args: {}): Promise<Array<ManagedKeyInfo>>\n}\n"
  },
  {
    "path": "packages/key-manager/src/abstract-private-key-store.ts",
    "content": "import { RequireOnly, TKeyType } from '@veramo/core-types'\n\n/**\n * Represents a private key.\n *\n * The `alias` is used to refer to the key material which is stored as the hex encoding of the raw byte array\n * (`privateKeyHex`).\n *\n * The `type` refers to the type of key that is represented.\n *\n * @public\n */\nexport interface ManagedPrivateKey {\n  alias: string\n  privateKeyHex: string\n  type: TKeyType\n}\n\n/**\n * Represents private key data that can be imported. This is a subset of {@link ManagedPrivateKey}.\n *\n * The `alias` of the resulting {@link ManagedPrivateKey} can be generated automatically if none is provided.\n *\n * @public\n */\nexport type ImportablePrivateKey = RequireOnly<ManagedPrivateKey, 'privateKeyHex' | 'type'>\n\n/**\n * This base abstract class should be extended to provide platform specific implementations that are usable by\n * {@link @veramo/kms-local#KeyManagementSystem | kms-local}.\n *\n * Implementations of this class are used to store mappings between key aliases and key material.\n *\n * @public\n */\nexport abstract class AbstractPrivateKeyStore {\n  abstract importKey(args: ImportablePrivateKey): Promise<ManagedPrivateKey>\n\n  abstract getKey(args: { alias: string }): Promise<ManagedPrivateKey>\n\n  abstract deleteKey(args: { alias: string }): Promise<boolean>\n\n  abstract listKeys(args: {}): Promise<Array<ManagedPrivateKey>>\n}\n"
  },
  {
    "path": "packages/key-manager/src/abstract-secret-box.ts",
    "content": "/**\n * This simple abstract class can be extended by different implementations to provide encryption at rest for\n * some implementations of {@link @veramo/key-manager#AbstractPrivateKeyStore | AbstractPrivateKeyStore}.\n *\n * @public\n */\nexport abstract class AbstractSecretBox {\n  abstract encrypt(message: string): Promise<string>\n  abstract decrypt(encryptedMessageHex: string): Promise<string>\n}\n"
  },
  {
    "path": "packages/key-manager/src/index.ts",
    "content": "/**\n * Provides a {@link @veramo/key-manager#KeyManager | plugin} for the {@link @veramo/core#Agent}\n * that implements {@link @veramo/core-types#IKeyManager} interface\n *\n * @packageDocumentation\n */\nexport { KeyManager } from './key-manager.js'\nexport { AbstractKeyManagementSystem } from './abstract-key-management-system.js'\nexport { AbstractKeyStore } from './abstract-key-store.js'\nexport {\n  AbstractPrivateKeyStore,\n  ImportablePrivateKey,\n  ManagedPrivateKey,\n} from './abstract-private-key-store.js'\nexport { AbstractSecretBox } from './abstract-secret-box.js'\nexport { MemoryKeyStore, MemoryPrivateKeyStore } from './memory-key-store.js'\nexport * from './types.js'\n"
  },
  {
    "path": "packages/key-manager/src/key-manager.ts",
    "content": "import { AbstractKeyStore } from './abstract-key-store.js'\nimport { AbstractKeyManagementSystem } from './abstract-key-management-system.js'\nimport {\n  IAgentPlugin,\n  IKey,\n  IKeyManager,\n  IKeyManagerCreateArgs,\n  IKeyManagerDecryptJWEArgs,\n  IKeyManagerDeleteArgs,\n  IKeyManagerEncryptJWEArgs,\n  IKeyManagerGetArgs,\n  IKeyManagerSharedSecretArgs,\n  IKeyManagerSignArgs,\n  IKeyManagerSignEthTXArgs,\n  IKeyManagerSignJWTArgs,\n  ManagedKeyInfo,\n  MinimalImportableKey,\n  schema,\n  TKeyType,\n} from '@veramo/core-types'\nimport * as u8a from 'uint8arrays'\nimport { createAnonDecrypter, createAnonEncrypter, createJWE, decryptJWE, type ECDH, type JWE } from 'did-jwt'\nimport { convertEd25519PublicKeyToX25519 } from '@veramo/utils'\nimport Debug from 'debug'\nimport { computeAddress, getBytes, hexlify, toUtf8Bytes, toUtf8String, Transaction } from 'ethers'\n\nconst debug = Debug('veramo:key-manager')\n\n/**\n * Agent plugin that implements {@link @veramo/core-types#IKeyManager} methods.\n *\n * This plugin orchestrates various implementations of {@link AbstractKeyManagementSystem}, using a KeyStore to\n * remember the link between a key reference, its metadata, and the respective key management system that provides the\n * actual cryptographic capabilities.\n *\n * The methods of this plugin are used automatically by other plugins, such as\n * {@link @veramo/did-manager#DIDManager | DIDManager},\n * {@link @veramo/credential-w3c#CredentialPlugin | CredentialPlugin}, or {@link @veramo/did-comm#DIDComm | DIDComm} to\n * perform their required cryptographic operations using the managed keys.\n *\n * @public\n */\nexport class KeyManager implements IAgentPlugin {\n  /**\n   * Plugin methods\n   * @public\n   */\n  readonly methods: IKeyManager\n\n  readonly schema = schema.IKeyManager\n\n  private store: AbstractKeyStore\n  private kms: Record<string, AbstractKeyManagementSystem>\n\n  constructor(options: { store: AbstractKeyStore; kms: Record<string, AbstractKeyManagementSystem> }) {\n    this.store = options.store\n    this.kms = options.kms\n    this.methods = {\n      keyManagerGetKeyManagementSystems: this.keyManagerGetKeyManagementSystems.bind(this),\n      keyManagerCreate: this.keyManagerCreate.bind(this),\n      keyManagerGet: this.keyManagerGet.bind(this),\n      keyManagerDelete: this.keyManagerDelete.bind(this),\n      keyManagerImport: this.keyManagerImport.bind(this),\n      keyManagerEncryptJWE: this.keyManagerEncryptJWE.bind(this),\n      keyManagerDecryptJWE: this.keyManagerDecryptJWE.bind(this),\n      keyManagerSignJWT: this.keyManagerSignJWT.bind(this),\n      keyManagerSignEthTX: this.keyManagerSignEthTX.bind(this),\n      keyManagerSign: this.keyManagerSign.bind(this),\n      keyManagerSharedSecret: this.keyManagerSharedSecret.bind(this),\n    }\n  }\n\n  /** {@inheritDoc @veramo/core-types#IKeyManager.keyManagerGetKeyManagementSystems} */\n  async keyManagerGetKeyManagementSystems(): Promise<Array<string>> {\n    return Object.keys(this.kms)\n  }\n\n  /** {@inheritDoc @veramo/core-types#IKeyManager.keyManagerCreate} */\n  async keyManagerCreate(args: IKeyManagerCreateArgs): Promise<ManagedKeyInfo> {\n    const kms = this.getKms(args.kms)\n    const partialKey = await kms.createKey({ type: args.type, meta: args.meta, kid: args.kid })\n    const key: IKey = { ...partialKey, kms: args.kms }\n    if (args.meta || key.meta) {\n      key.meta = { ...args.meta, ...key.meta }\n    }\n    await this.store.importKey(key)\n    if (key.privateKeyHex) {\n      delete key.privateKeyHex\n    }\n    return key\n  }\n\n  /** {@inheritDoc @veramo/core-types#IKeyManager.keyManagerGet} */\n  async keyManagerGet({ kid }: IKeyManagerGetArgs): Promise<IKey> {\n    return this.store.getKey({ kid })\n  }\n\n  /** {@inheritDoc @veramo/core-types#IKeyManager.keyManagerDelete} */\n  async keyManagerDelete({ kid }: IKeyManagerDeleteArgs): Promise<boolean> {\n    const key = await this.store.getKey({ kid })\n    const kms = this.getKms(key.kms)\n    await kms.deleteKey({ kid })\n    return this.store.deleteKey({ kid })\n  }\n\n  /** {@inheritDoc @veramo/core-types#IKeyManager.keyManagerImport} */\n  async keyManagerImport(key: MinimalImportableKey): Promise<ManagedKeyInfo> {\n    const kms = this.getKms(key.kms)\n    const managedKey = await kms.importKey(key)\n    const { meta } = key\n    const importedKey = { ...managedKey, meta: { ...meta, ...managedKey.meta }, kms: key.kms }\n    await this.store.importKey(importedKey)\n    return importedKey\n  }\n\n  /** {@inheritDoc @veramo/core-types#IKeyManager.keyManagerEncryptJWE} */\n  async keyManagerEncryptJWE({ kid, to, data }: IKeyManagerEncryptJWEArgs): Promise<string> {\n    // TODO: if a sender `key` is provided, then it should be used to create an authenticated encrypter\n    // const key = await this.store.get({ kid })\n\n    let recipientPublicKey: Uint8Array\n    if (to.type === 'Ed25519') {\n      recipientPublicKey = getBytes('0x' + to.publicKeyHex)\n      recipientPublicKey = convertEd25519PublicKeyToX25519(recipientPublicKey)\n    } else if (to.type === 'X25519') {\n      recipientPublicKey = getBytes('0x' + to.publicKeyHex)\n    } else {\n      throw new Error('not_supported: The recipient public key type is not supported')\n    }\n\n    const dataBytes = toUtf8Bytes(data)\n    const encrypter = createAnonEncrypter(recipientPublicKey)\n    const result: JWE = await createJWE(dataBytes, [encrypter])\n\n    return JSON.stringify(result)\n  }\n\n  /** {@inheritDoc @veramo/core-types#IKeyManager.keyManagerDecryptJWE} */\n  async keyManagerDecryptJWE({ kid, data }: IKeyManagerDecryptJWEArgs): Promise<string> {\n    const jwe: JWE = JSON.parse(data)\n    const ecdh = this.createX25519ECDH(kid)\n\n    // TODO: figure out if the JWE is anon or not to determine the type of decrypter to use\n    const decrypter = createAnonDecrypter(ecdh)\n\n    const decrypted = await decryptJWE(jwe, decrypter)\n    const result = toUtf8String(decrypted)\n    return result\n  }\n\n  /** {@inheritDoc @veramo/core-types#IKeyManager.keyManagerSignJWT} */\n  async keyManagerSignJWT({ kid, data }: IKeyManagerSignJWTArgs): Promise<string> {\n    if (typeof data === 'string') {\n      return this.keyManagerSign({ keyRef: kid, data, encoding: 'utf-8' })\n    } else {\n      const dataString = u8a.toString(data, 'base16')\n      return this.keyManagerSign({ keyRef: kid, data: dataString, encoding: 'base16' })\n    }\n  }\n\n  /** {@inheritDoc @veramo/core-types#IKeyManager.keyManagerSign} */\n  async keyManagerSign(args: IKeyManagerSignArgs): Promise<string> {\n    const { keyRef, data, algorithm, encoding, ...extras } = { encoding: 'utf-8', ...args }\n    const keyInfo: ManagedKeyInfo = await this.store.getKey({ kid: keyRef })\n    let dataBytes\n    if (typeof data === 'string') {\n      if (encoding === 'base16' || encoding === 'hex') {\n        const preData = data.startsWith('0x') ? data.substring(2) : data\n        dataBytes = u8a.fromString(preData, 'base16')\n      } else {\n        dataBytes = u8a.fromString(data, <'utf-8'>encoding)\n      }\n    } else {\n      dataBytes = data\n    }\n    const kms = this.getKms(keyInfo.kms)\n    return kms.sign({ keyRef: keyInfo, algorithm, data: dataBytes, ...extras })\n  }\n\n  /** {@inheritDoc @veramo/core-types#IKeyManager.keyManagerSignEthTX} */\n  async keyManagerSignEthTX({ kid, transaction }: IKeyManagerSignEthTXArgs): Promise<string> {\n    const { v, r, s, from, ...tx } = <any>transaction\n    if (typeof from === 'string') {\n      debug('WARNING: executing a transaction signing request with a `from` field.')\n      const key = await this.store.getKey({ kid })\n      if (key.publicKeyHex) {\n        const address = computeAddress('0x' + key.publicKeyHex)\n        if (address.toLowerCase() !== from.toLowerCase()) {\n          const msg =\n            'invalid_arguments: keyManagerSignEthTX `from` field does not match the chosen key. `from` field should be omitted.'\n          debug(msg)\n          throw new Error(msg)\n        }\n      }\n    }\n    const data = Transaction.from(tx).unsignedSerialized\n    const algorithm = 'eth_signTransaction'\n    return this.keyManagerSign({ keyRef: kid, data, algorithm, encoding: 'base16' })\n  }\n\n  /** {@inheritDoc @veramo/core-types#IKeyManager.keyManagerSharedSecret} */\n  async keyManagerSharedSecret(args: IKeyManagerSharedSecretArgs): Promise<string> {\n    const { secretKeyRef, publicKey } = args\n    const myKeyRef = await this.store.getKey({ kid: secretKeyRef })\n    const theirKey = publicKey\n    if (\n      myKeyRef.type === theirKey.type ||\n      (['Ed25519', 'X25519'].includes(myKeyRef.type) && ['Ed25519', 'X25519'].includes(theirKey.type))\n    ) {\n      const kms = this.getKms(myKeyRef.kms)\n      return kms.sharedSecret({ myKeyRef, theirKey })\n    } else {\n      throw new Error('invalid_argument: the key types have to match to be able to compute a shared secret')\n    }\n  }\n\n  createX25519ECDH(secretKeyRef: string): ECDH {\n    return async (theirPublicKey: Uint8Array): Promise<Uint8Array> => {\n      if (theirPublicKey.length !== 32) {\n        throw new Error('invalid_argument: incorrect publicKey key length for X25519')\n      }\n      const publicKey = { type: <TKeyType>'X25519', publicKeyHex: hexlify(theirPublicKey).substring(2) }\n      const shared = await this.keyManagerSharedSecret({ secretKeyRef, publicKey })\n      return getBytes('0x' + shared)\n    }\n  }\n\n  private getKms(name: string): AbstractKeyManagementSystem {\n    const kms = this.kms[name]\n    if (!kms) {\n      throw Error(`invalid_argument: This agent has no registered KeyManagementSystem with name='${name}'`)\n    }\n    return kms\n  }\n}\n"
  },
  {
    "path": "packages/key-manager/src/memory-key-store.ts",
    "content": "import { IKey } from '@veramo/core-types'\nimport { AbstractKeyStore } from './abstract-key-store.js'\nimport {\n  AbstractPrivateKeyStore,\n  ImportablePrivateKey,\n  ManagedPrivateKey,\n} from './abstract-private-key-store.js'\nimport { v4 as uuidv4 } from 'uuid'\n\n/**\n * An implementation of {@link AbstractKeyStore} that holds everything in memory.\n *\n * This is usable by {@link @veramo/key-manager#KeyManager | KeyManager} to hold the key metadata and relationship to\n * the KMS implementation.\n *\n * @public\n */\nexport class MemoryKeyStore extends AbstractKeyStore {\n  private keys: Record<string, IKey> = {}\n\n  async getKey({ kid }: { kid: string }): Promise<IKey> {\n    const key = this.keys[kid]\n    if (!key) throw Error('Key not found')\n    return key\n  }\n\n  async deleteKey({ kid }: { kid: string }) {\n    delete this.keys[kid]\n    return true\n  }\n\n  async importKey(args: IKey) {\n    this.keys[args.kid] = { ...args }\n    return true\n  }\n\n  async listKeys(args: {}): Promise<Exclude<IKey, 'privateKeyHex'>[]> {\n    const safeKeys = Object.values(this.keys).map((key) => {\n      const { privateKeyHex, ...safeKey } = key\n      return safeKey\n    })\n    return safeKeys\n  }\n}\n\n/**\n * An implementation of {@link AbstractPrivateKeyStore} that holds everything in memory.\n *\n * This is usable by {@link @veramo/kms-local#KeyManagementSystem} to hold the private key data.\n *\n * @public\n */\nexport class MemoryPrivateKeyStore extends AbstractPrivateKeyStore {\n  private privateKeys: Record<string, ManagedPrivateKey> = {}\n\n  async getKey({ alias }: { alias: string }): Promise<ManagedPrivateKey> {\n    const key = this.privateKeys[alias]\n    if (!key) throw Error(`not_found: PrivateKey not found for alias=${alias}`)\n    return key\n  }\n\n  async deleteKey({ alias }: { alias: string }) {\n    delete this.privateKeys[alias]\n    return true\n  }\n\n  async importKey(args: ImportablePrivateKey) {\n    const alias = args.alias || uuidv4()\n    const existingEntry = this.privateKeys[alias]\n    if (existingEntry && existingEntry.privateKeyHex !== args.privateKeyHex) {\n      throw new Error('key_already_exists: key exists with different data, please use a different alias')\n    }\n    this.privateKeys[alias] = { ...args, alias }\n    return this.privateKeys[alias]\n  }\n\n  async listKeys(): Promise<Array<ManagedPrivateKey>> {\n    return [...Object.values(this.privateKeys)]\n  }\n}\n"
  },
  {
    "path": "packages/key-manager/src/types.ts",
    "content": "import { TypedDataDomain, TypedDataField } from 'ethers'\n\n/**\n * The payload that is sent to be signed according to EIP712\n * @see {@link https://eips.ethereum.org/EIPS/eip-712}\n * @beta\n */\nexport type Eip712Payload = {\n  domain: TypedDataDomain\n  types: Record<string, TypedDataField[]>\n  primaryType: string\n  message: Record<string, any>\n}\n"
  },
  {
    "path": "packages/key-manager/tsconfig.json",
    "content": "{\n  \"extends\": \"../tsconfig.settings.json\",\n  \"compilerOptions\": {\n    \"rootDir\": \"src\",\n    \"outDir\": \"build\",\n    \"declarationDir\": \"build\"\n  },\n  \"references\": [\n    {\n      \"path\": \"../core-types\"\n    },\n    {\n      \"path\": \"../utils\"\n    }\n  ]\n}\n"
  },
  {
    "path": "packages/kms-local/CHANGELOG.md",
    "content": "# Change Log\n\nAll notable changes to this project will be documented in this file.\nSee [Conventional Commits](https://conventionalcommits.org) for commit guidelines.\n\n# [7.0.0](https://github.com/decentralized-identity/veramo/compare/v6.0.2...v7.0.0) (2026-02-11)\n\n\n### Bug Fixes\n\n* **deps:** update devdeps and bump typeorm to 0.3.20 ([#1272](https://github.com/decentralized-identity/veramo/issues/1272)) ([7d17f37](https://github.com/decentralized-identity/veramo/commit/7d17f37ea7cc4e73a8cdae028681ae1be5c4d11c))\n* **did-comm:** remove isomorphic-webcrypto dependency ([#1401](https://github.com/decentralized-identity/veramo/issues/1401)) ([85cc1ce](https://github.com/decentralized-identity/veramo/commit/85cc1ce1d567afcbc42e0fd89eb2515505044c83)), closes [#1381](https://github.com/decentralized-identity/veramo/issues/1381) [#1387](https://github.com/decentralized-identity/veramo/issues/1387)\n* **key-manager:** handling of `kid` param when creating keys ([#1492](https://github.com/decentralized-identity/veramo/issues/1492)) ([4c52549](https://github.com/decentralized-identity/veramo/commit/4c52549daa215fe3b791d56a156f88144d11733e))\n\n\n\n\n\n## [6.0.2](https://github.com/decentralized-identity/veramo/compare/v6.0.1...v6.0.2) (2026-01-16)\n\n**Note:** Version bump only for package @veramo/kms-local\n\n\n\n\n\n## [6.0.1](https://github.com/decentralized-identity/veramo/compare/v6.0.0...v6.0.1) (2026-01-16)\n\n**Note:** Version bump only for package @veramo/kms-local\n\n\n\n\n\n# [6.0.0](https://github.com/decentralized-identity/veramo/compare/v5.6.0...v6.0.0) (2024-04-02)\n\n\n### Features\n\n* add Multikey support ([#1316](https://github.com/decentralized-identity/veramo/issues/1316)) ([165de35](https://github.com/decentralized-identity/veramo/commit/165de3549ccfd3d7c84514608ac3ea9e56a7b807))\n\n\n\n\n\n# [5.6.0](https://github.com/decentralized-identity/veramo/compare/v5.5.3...v5.6.0) (2024-01-16)\n\n\n### Features\n\n* **remote-client:** allow dynamic headers param for AgentRestClient constructor ([#1314](https://github.com/decentralized-identity/veramo/issues/1314)) ([1b8a0a2](https://github.com/decentralized-identity/veramo/commit/1b8a0a2718dd63492ad3a312a6ebe5f6e7849935)), closes [#1313](https://github.com/decentralized-identity/veramo/issues/1313)\n\n\n\n\n\n## [5.5.3](https://github.com/decentralized-identity/veramo/compare/v5.5.2...v5.5.3) (2023-10-09)\n\n\n### Bug Fixes\n\n* use DIF URLs in packages ([#1271](https://github.com/decentralized-identity/veramo/issues/1271)) ([3dfc601](https://github.com/decentralized-identity/veramo/commit/3dfc6014cdee7902c59d8db76b4c8507b870f227))\n\n\n\n\n\n# [5.5.0](https://github.com/uport-project/veramo/compare/v5.4.1...v5.5.0) (2023-09-19)\n\n\n### Bug Fixes\n\n* **did-provider-key:** use compressed keys for creating Secp256k1 did:key ([#1217](https://github.com/uport-project/veramo/issues/1217)) ([ba8f6f5](https://github.com/uport-project/veramo/commit/ba8f6f5b9b701e57af86491504ecd209ca0c1c1d)), closes [#1213](https://github.com/uport-project/veramo/issues/1213)\n\n\n### Features\n\n* **core-types:** export a basic mapping between key types and algorithms ([57b6c58](https://github.com/uport-project/veramo/commit/57b6c583138b0f8f283f4f00b27573529f394a7a))\n\n\n\n\n\n## [5.4.1](https://github.com/uport-project/veramo/compare/v5.4.0...v5.4.1) (2023-08-04)\n\n\n### Bug Fixes\n\n* **ci:** benign change meant to tag all packages for another patch release ([#1211](https://github.com/uport-project/veramo/issues/1211)) ([41b5c90](https://github.com/uport-project/veramo/commit/41b5c90277171b7b38c5cf49ca01db5cf75b6300))\n\n\n\n\n\n# [5.4.0](https://github.com/uport-project/veramo/compare/v5.3.0...v5.4.0) (2023-08-01)\n\n\n### Features\n\n* **did-comm:** add support for the AES based content and key encryption algorithms ([#1180](https://github.com/uport-project/veramo/issues/1180)) ([5294a81](https://github.com/uport-project/veramo/commit/5294a812ee578c0712b54f216416c3ef78c848da))\n\n\n\n\n\n# [5.3.0](https://github.com/uport-project/veramo/compare/v5.2.0...v5.3.0) (2023-07-27)\n\n**Note:** Version bump only for package @veramo/kms-local\n\n\n\n\n\n## [5.1.2](https://github.com/uport-project/veramo/compare/v5.1.1...v5.1.2) (2023-02-25)\n\n**Note:** Version bump only for package @veramo/kms-local\n\n\n\n\n\n# [5.1.0](https://github.com/uport-project/veramo/compare/v5.0.0...v5.1.0) (2023-02-24)\n\n\n### Bug Fixes\n\n* P256 key parity corrections ([#1137](https://github.com/uport-project/veramo/issues/1137)) ([d0eca2b](https://github.com/uport-project/veramo/commit/d0eca2b3cd9ca6741f7f056e28bb9799910bc5ec)), closes [#1136](https://github.com/uport-project/veramo/issues/1136) [#1135](https://github.com/uport-project/veramo/issues/1135)\n\n\n\n\n\n# [5.0.0](https://github.com/uport-project/veramo/compare/v4.3.0...v5.0.0) (2023-02-09)\n\n\n### Bug Fixes\n\n* **key-manager:** rename Abstract[Private]KeyStore methods for SES compatibility ([91631b6](https://github.com/uport-project/veramo/commit/91631b6d2a09d46accff6509f44792d88209b801)), closes [#1090](https://github.com/uport-project/veramo/issues/1090)\n\n\n### Build System\n\n* convert veramo modules to ESM instead of CommonJS ([#1103](https://github.com/uport-project/veramo/issues/1103)) ([b5cea3c](https://github.com/uport-project/veramo/commit/b5cea3c0d80d900a47bd1d9eea68f84b70a35e7b)), closes [#1099](https://github.com/uport-project/veramo/issues/1099)\n\n\n### Features\n\n* isolate `core-types` package from `core` ([#1116](https://github.com/uport-project/veramo/issues/1116)) ([ba7a303](https://github.com/uport-project/veramo/commit/ba7a303de91cf4cc568a3af1ddf8ca98ed022e9f))\n\n\n### BREAKING CHANGES\n\n* **key-manager:** implementations of AbstractKeyStore and AbstractPrivateKeyStore need to rename their methods to conform to the new API. Functionality remains the same.\n* this is a breaking change as modules will have to be imported differently: \n* https://www.typescriptlang.org/docs/handbook/esm-node.html\n* https://nodejs.org/api/esm.html\n* https://caniuse.com/?search=modules\n\ntest(did-provider-ion): skip a couple of tests that fail with unreasonable errors\nchore: use ubuntu-latest on CI\nfix: temporarily remove puppeteer tests\nfix: use craco for test-react-app to enable babel config\ntest: fix unit and integration tests (browser tests still broken)\nfix: fix some build issues that prevented tests from working\nfix: missing deps flagged by pnpm\n\n\n\n\n\n# [4.3.0](https://github.com/uport-project/veramo/compare/v4.2.0...v4.3.0) (2023-01-27)\n\n**Note:** Version bump only for package @veramo/kms-local\n\n\n\n\n\n# [4.2.0](https://github.com/uport-project/veramo/compare/v4.1.2...v4.2.0) (2022-12-05)\n\n\n### Bug Fixes\n\n* **deps:** bump dependencies ([701b8ed](https://github.com/uport-project/veramo/commit/701b8edf981ea11c7ddb6a81d2817dbbdbb022f3))\n\n\n\n\n\n## [4.1.1](https://github.com/uport-project/veramo/compare/v4.1.0...v4.1.1) (2022-11-01)\n\n**Note:** Version bump only for package @veramo/kms-local\n\n\n\n\n\n# [4.1.0](https://github.com/uport-project/veramo/compare/v4.0.2...v4.1.0) (2022-10-31)\n\n\n### Bug Fixes\n\n* **deps:** Update dependency ethr-did-resolver to v7 ([#1038](https://github.com/uport-project/veramo/issues/1038)) ([d421c0f](https://github.com/uport-project/veramo/commit/d421c0f9f5934829df2930e58e98bcfce813ce84))\n\n\n### Features\n\n* add support for did:ethr signed/meta transactions ([#1031](https://github.com/uport-project/veramo/issues/1031)) ([88f1da9](https://github.com/uport-project/veramo/commit/88f1da9a39f6d249fbed301e2d77ea3cee167e33))\n* add support for NIST Secp256r1 keys and ES256 signatures ([#1039](https://github.com/uport-project/veramo/issues/1039)) ([61eb369](https://github.com/uport-project/veramo/commit/61eb369cfcde7372babf3f68fb65ea2055b5bf70))\n\n\n\n\n\n## [4.0.2](https://github.com/uport-project/veramo/compare/v4.0.1...v4.0.2) (2022-10-04)\n\n**Note:** Version bump only for package @veramo/kms-local\n\n\n\n\n\n# [4.0.0](https://github.com/uport-project/veramo/compare/v3.1.5...v4.0.0) (2022-09-22)\n\n\n### Bug Fixes\n\n* **deps:** Bump `did-jwt`, `did-jwt-vc` as direct package deps ([#955](https://github.com/uport-project/veramo/issues/955)) ([e57edb3](https://github.com/uport-project/veramo/commit/e57edb34cfbaee6bba1d944497d688104f32c698))\n* **deps:** update all non-major dependencies ([b537187](https://github.com/uport-project/veramo/commit/b537187ba04ba41cd45c18dfb58c92725b65b084))\n* **deps:** update dependency @ethersproject/random to v5.5.1 ([b5fcdb5](https://github.com/uport-project/veramo/commit/b5fcdb5f083e266a1f865b85e805de1a1ef5baa5))\n* **deps:** update dependency did-jwt to v5.12.0 ([5b414d7](https://github.com/uport-project/veramo/commit/5b414d7d720e7c59cf3f56c35da5fe247e21bf26))\n* **deps:** use did-jwt v6 and ethr-did-resolver v6 ([#925](https://github.com/uport-project/veramo/issues/925)) ([0c77d03](https://github.com/uport-project/veramo/commit/0c77d03ec5ec9e2091de3f74f67ab86a22cde197)), closes [#923](https://github.com/uport-project/veramo/issues/923) [#848](https://github.com/uport-project/veramo/issues/848)\n* **did-resolver:** use interface `Resolvable` instead of the `Resolver` class ([9c2e59f](https://github.com/uport-project/veramo/commit/9c2e59f3f23f808511c6c0e8e440b4d53ba5cb00))\n* update and fix inline documentation of all exported types ([#921](https://github.com/uport-project/veramo/issues/921)) ([63e64e0](https://github.com/uport-project/veramo/commit/63e64e0e2693808c4704dca8cc511dc0bab3f3b1))\n\n\n### Features\n\n* add support for serviceEndpoint property as defined in latest DID Spec ([#988](https://github.com/uport-project/veramo/issues/988)) ([9bed70b](https://github.com/uport-project/veramo/commit/9bed70ba658aed34a97944e0dee27bca6c81d700))\n* **credential-w3c:** align verification API between formats ([#996](https://github.com/uport-project/veramo/issues/996)) ([b987fc0](https://github.com/uport-project/veramo/commit/b987fc0903a31d3bbffb43fef872be4d6c62c2ad)), closes [#935](https://github.com/uport-project/veramo/issues/935) [#954](https://github.com/uport-project/veramo/issues/954) [#375](https://github.com/uport-project/veramo/issues/375) [#989](https://github.com/uport-project/veramo/issues/989)\n* **kms-web3:** add a KMS implementation backed by a web3 provider ([#924](https://github.com/uport-project/veramo/issues/924)) ([14f71af](https://github.com/uport-project/veramo/commit/14f71afbb72dca8274790d3b20b518ddfe4f2585)), closes [#688](https://github.com/uport-project/veramo/issues/688)\n\n\n### BREAKING CHANGES\n\n* the `did-resolver` and connected libraries change the data-type for `ServiceEndpoint` to `Service` and the previous semantic has changed. Services can have multiple endpoints, not just a single string.\n\n\n\n\n\n## [3.1.3](https://github.com/uport-project/veramo/compare/v3.1.2...v3.1.3) (2022-06-01)\n\n**Note:** Version bump only for package @veramo/kms-local\n\n\n\n\n\n# [3.1.0](https://github.com/uport-project/veramo/compare/v3.0.0...v3.1.0) (2021-11-12)\n\n\n### Bug Fixes\n\n* **deps:** update dependency did-jwt to v5.10.0 ([8424291](https://github.com/uport-project/veramo/commit/842429176b7e3a2433dcb0341cdadb5e5fcd71f0))\n* **deps:** update dependency did-jwt to v5.9.0 ([b9af0af](https://github.com/uport-project/veramo/commit/b9af0af9034297316313ac8f5d41f08e06c5a1ab))\n* **deps:** update did-libraries ([417dc5d](https://github.com/uport-project/veramo/commit/417dc5dd157ee259b6f89f4987f1ecca444fb1d4))\n\n\n### Features\n\n* **did-comm:** didcomm messaging using did:ethr ([#744](https://github.com/uport-project/veramo/issues/744)) ([1be5e04](https://github.com/uport-project/veramo/commit/1be5e04e09112c0823d776fe2d55117d71a7b448)), closes [#743](https://github.com/uport-project/veramo/issues/743)\n\n\n\n\n\n# [3.0.0](https://github.com/uport-project/veramo/compare/v2.1.3...v3.0.0) (2021-09-20)\n\n\n### Bug Fixes\n\n* **deps:** update all non-major dependencies ([8fc5312](https://github.com/uport-project/veramo/commit/8fc53120498ce2982e8ec640e00bbb03f6f4204e))\n* **deps:** update dependency uint8arrays to v3 ([#669](https://github.com/uport-project/veramo/issues/669)) ([a5f5c42](https://github.com/uport-project/veramo/commit/a5f5c421d307b39d926f2d701ef3b9861c325dea))\n* **key-manager:** handle eth_signTransaction with from field ([#675](https://github.com/uport-project/veramo/issues/675)) ([50f074d](https://github.com/uport-project/veramo/commit/50f074ddcab5dbafe5bad0ebcbfde8a9f91826e4)), closes [#674](https://github.com/uport-project/veramo/issues/674)\n\n\n### Features\n\n* **key-manager:** move private key storage to kms-local ([#661](https://github.com/uport-project/veramo/issues/661)) ([6b1d135](https://github.com/uport-project/veramo/commit/6b1d135eedb1c58b715be8941d34312da39facb2)), closes [#539](https://github.com/uport-project/veramo/issues/539) [#540](https://github.com/uport-project/veramo/issues/540) [#680](https://github.com/uport-project/veramo/issues/680)\n\n\n### BREAKING CHANGES\n\n* **key-manager:** `keyManagetGet` no longer returns private key data\n* **key-manager:** `KeyStore` no longer requires a `SecretBox`\n* **key-manager:** `KeyManagementSystem` needs a `PrivateKeyStore`\n* **key-manager:** @veramo/cli configuration version update to 3.0\n\nIf you're already working with Veramo and wish to upgrade existing agents to veramo 3.0, you'll have to make some changes to your configuration, depending on how you're using the framework.\n\nIt boils down to these 3 steps:\n\n1. Update your database connection to use migrations\n2. Remove the `SecretBox` parameter from `KeyManager`\n3. Add a `PrivateKeyStore` parameter to `KeyManagementSystem` with a `SecretBox` that you were using before with `KeyManager` (and keep the same encryption key)\n\n* feat(key-manager): move private key storage to kms-local\n\n\n\n\n\n## [2.1.1](https://github.com/uport-project/veramo/compare/v2.1.0...v2.1.1) (2021-08-11)\n\n\n### Bug Fixes\n\n* include tx type in eth_signTransaction ([#660](https://github.com/uport-project/veramo/issues/660)) ([d45129e](https://github.com/uport-project/veramo/commit/d45129ec7106c7fdb0ddfafc22bfa498d4e95d9d)), closes [#641](https://github.com/uport-project/veramo/issues/641)\n\n\n\n\n\n# [2.1.0](https://github.com/uport-project/veramo/compare/v2.0.1...v2.1.0) (2021-08-11)\n\n**Note:** Version bump only for package @veramo/kms-local\n\n\n\n\n\n# [2.0.0](https://github.com/uport-project/veramo/compare/v1.2.2...v2.0.0) (2021-07-14)\n\n\n### Bug Fixes\n\n* **deps:** bump did-jwt to 5.4.0 ([#528](https://github.com/uport-project/veramo/issues/528)) ([65f22cf](https://github.com/uport-project/veramo/commit/65f22cf6dcca48b5bb35331894536a2a567a1189))\n* **deps:** update all non-major dependencies ([9f40f7d](https://github.com/uport-project/veramo/commit/9f40f7d8b2a67e112b7ef2322ba887ee9033646c))\n* **deps:** update dependency did-jwt to v5.5.2 ([ae0661f](https://github.com/uport-project/veramo/commit/ae0661fc5b225f80ebb102db60d55822b4786bce))\n* **kms-local:** replace buggy didcomm clone with did jwt implementation ([#548](https://github.com/uport-project/veramo/issues/548)) ([9dea353](https://github.com/uport-project/veramo/commit/9dea3533c1936d53c1d5674c358679b17d623af2)), closes [#538](https://github.com/uport-project/veramo/issues/538)\n* speed up secp256k1 keygen ([#551](https://github.com/uport-project/veramo/issues/551)) ([75e356c](https://github.com/uport-project/veramo/commit/75e356cac06e6eb3827da1789d3b39e6cd4f08f7)), closes [#549](https://github.com/uport-project/veramo/issues/549)\n\n\n### Features\n\n* **key-manager:** add generic signing capabilities ([#529](https://github.com/uport-project/veramo/issues/529)) ([5f10a1b](https://github.com/uport-project/veramo/commit/5f10a1bcea214cb593de12fa6ec3a91b3cb712bb)), closes [#522](https://github.com/uport-project/veramo/issues/522)\n* **key-manager:** add method to compute a shared secret ([#555](https://github.com/uport-project/veramo/issues/555)) ([393c316](https://github.com/uport-project/veramo/commit/393c316e27fb31b3c7fa63aae039b8fc6ae963ce)), closes [#541](https://github.com/uport-project/veramo/issues/541)\n* **key-manager:** implement JWE functionality directly in `key-manager` ([#557](https://github.com/uport-project/veramo/issues/557)) ([a030f0a](https://github.com/uport-project/veramo/commit/a030f0a9779e5158d9369d2f81107158fbaeac70)), closes [#556](https://github.com/uport-project/veramo/issues/556)\n\n\n### BREAKING CHANGES\n\n* **kms-local:** `@veramo/kms-local-react-native` is no more. On react-native, please use `@veramo/kms-local` instead, combined with `@ethersproject/shims`\n\n\n\n\n\n# [1.2.0](https://github.com/uport-project/veramo/compare/v1.1.2...v1.2.0) (2021-04-27)\n\n\n### Bug Fixes\n\n* **deps:** update all non-major dependencies ([#462](https://github.com/uport-project/veramo/issues/462)) ([4a2b206](https://github.com/uport-project/veramo/commit/4a2b20633810b45a155bf2149cbff57d157bda3c))\n\n\n### Features\n\n* adapt to did core spec ([#430](https://github.com/uport-project/veramo/issues/430)) ([9712db0](https://github.com/uport-project/veramo/commit/9712db0eea1a3f48cf0665d66ae715ea0c23cd4a)), closes [#418](https://github.com/uport-project/veramo/issues/418) [#428](https://github.com/uport-project/veramo/issues/428) [#417](https://github.com/uport-project/veramo/issues/417) [#416](https://github.com/uport-project/veramo/issues/416) [#412](https://github.com/uport-project/veramo/issues/412) [#397](https://github.com/uport-project/veramo/issues/397) [#384](https://github.com/uport-project/veramo/issues/384) [#394](https://github.com/uport-project/veramo/issues/394)\n* **did-provider-key:** add did:key provider; fixes [#335](https://github.com/uport-project/veramo/issues/335) ([#351](https://github.com/uport-project/veramo/issues/351)) ([42cd2b0](https://github.com/uport-project/veramo/commit/42cd2b08a2fd21b5b5d7bdfa57dd00ccc7184dc7)), closes [decentralized-identity/did-jwt#78](https://github.com/decentralized-identity/did-jwt/issues/78)\n\n\n\n\n\n# [1.1.0](https://github.com/uport-project/veramo/compare/v1.0.1...v1.1.0) (2021-01-26)\n\n**Note:** Version bump only for package @veramo/kms-local\n\n\n\n\n\n## 1.0.1 (2020-12-18)\n\n**Note:** Version bump only for package @veramo/kms-local\n"
  },
  {
    "path": "packages/kms-local/LICENSE",
    "content": "                                 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 2019 Consensys AG\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"
  },
  {
    "path": "packages/kms-local/README.md",
    "content": "# Veramo Local KMS\n\nA Veramo KMS implementation that provides Ed25519 and secp256k1 crypto.\n\nThis module provides an implementation\nof [`AbstractKeyManagementSystem`](../key-manager/src/abstract-key-management-system.ts#L6) that can be used by the\n[`@veramo/key-manager`](../key-manager) plugin to provide Secp256k1, Ed25519, and X25519 crypto functionality to a\nVeramo agent.\n\nThe keys managed by this module are stored in an implementation\nof [`AbstractPrivateKeyStore`](../key-manager/src/abstract-private-key-store.ts).\nSee [`MemoryPrivateKeyStore`](../key-manager/src/memory-key-store.ts#L43)\nor [`PrivateKeyStore`](../data-store/src/identifier/private-key-store.ts) for implementations.\n"
  },
  {
    "path": "packages/kms-local/api-extractor.json",
    "content": "{\n  \"$schema\": \"https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json\",\n  \"apiReport\": {\n    \"enabled\": true,\n    \"reportFolder\": \"./api\",\n    \"reportTempFolder\": \"./api\"\n  },\n\n  \"docModel\": {\n    \"enabled\": true,\n    \"apiJsonFilePath\": \"./api/<unscopedPackageName>.api.json\"\n  },\n\n  \"dtsRollup\": {\n    \"enabled\": false\n  },\n  \"mainEntryPointFilePath\": \"<projectFolder>/build/index.d.ts\"\n}\n"
  },
  {
    "path": "packages/kms-local/package.json",
    "content": "{\n  \"name\": \"@veramo/kms-local\",\n  \"description\": \"Veramo KMS implementation that provides Ed25519 and secp256k1 crypto\",\n  \"version\": \"7.0.0\",\n  \"main\": \"build/index.js\",\n  \"exports\": \"./build/index.js\",\n  \"types\": \"build/index.d.ts\",\n  \"scripts\": {\n    \"build\": \"tsc\",\n    \"extract-api\": \"node ../cli/bin/veramo.js dev extract-api\"\n  },\n  \"dependencies\": {\n    \"@noble/curves\": \"^1.4.2\",\n    \"@stablelib/nacl\": \"^1.0.4\",\n    \"@veramo/core-types\": \"workspace:^\",\n    \"@veramo/key-manager\": \"workspace:^\",\n    \"@veramo/utils\": \"workspace:^\",\n    \"debug\": \"^4.3.3\",\n    \"did-jwt\": \"^8.0.0\",\n    \"ethers\": \"^6.13.4\"\n  },\n  \"devDependencies\": {\n    \"@types/debug\": \"4.1.8\",\n    \"typescript\": \"5.7.3\"\n  },\n  \"files\": [\n    \"build/**/*\",\n    \"src/**/*\",\n    \"README.md\",\n    \"LICENSE\"\n  ],\n  \"publishConfig\": {\n    \"access\": \"public\"\n  },\n  \"repository\": {\n    \"type\": \"git\",\n    \"url\": \"https://github.com/decentralized-identity/veramo.git\",\n    \"directory\": \"packages/kms-local\"\n  },\n  \"author\": \"Consensys Mesh R&D <hello@veramo.io>\",\n  \"contributors\": [\n    \"Simonas Karuzas <simonas.karuzas@mesh.xyz>\",\n    \"Mircea Nistor <mircea.nistor@mesh.xyz>\"\n  ],\n  \"keywords\": [\n    \"Veramo\",\n    \"DID\",\n    \"Verifiable Credential\",\n    \"veramo-plugin\",\n    \"KMS\",\n    \"key database\",\n    \"ES256K\",\n    \"ES256K-R\",\n    \"Ed25519\",\n    \"EdDSA\",\n    \"JWS\",\n    \"JWE\",\n    \"Secp256k1\",\n    \"Secp256r1\",\n    \"P-256\",\n    \"X25519\",\n    \"Ethereum\",\n    \"wallet\",\n    \"eth_sign\",\n    \"EIP712\",\n    \"EIP191\"\n  ],\n  \"license\": \"Apache-2.0\",\n  \"type\": \"module\",\n  \"moduleDirectories\": [\n    \"node_modules\",\n    \"src\"\n  ]\n}\n"
  },
  {
    "path": "packages/kms-local/src/__tests__/kms-local.test.ts",
    "content": "import { KeyManagementSystem } from '../key-management-system.js'\nimport { TKeyType } from '../../../core-types/src'\nimport { MemoryPrivateKeyStore } from '../../../key-manager/src'\nimport {\n  bytesToHex,\n  convertEd25519PrivateKeyToX25519,\n  convertEd25519PublicKeyToX25519,\n  hexToBytes,\n  stringToUtf8Bytes,\n} from '../../../utils/src'\nimport { randomBytes } from 'ethers'\nimport {\n  convertPublicKeyToX25519,\n  convertSecretKeyToX25519,\n  generateKeyPairFromSeed,\n} from '@stablelib/ed25519'\n\ndescribe('@veramo/kms-local', () => {\n  it('imports and convert ed25519 key', async () => {\n    const kms = new KeyManagementSystem(new MemoryPrivateKeyStore())\n    const privateBytes = randomBytes(32)\n    const key = await kms.importKey({\n      privateKeyHex: bytesToHex(privateBytes),\n      type: 'Ed25519',\n    })\n    const pair = generateKeyPairFromSeed(privateBytes)\n    expect(key.publicKeyHex).toEqual(bytesToHex(pair.publicKey))\n\n    const xprivNoble = convertEd25519PrivateKeyToX25519(privateBytes)\n    const xprivStable = convertSecretKeyToX25519(privateBytes)\n    expect(bytesToHex(xprivNoble)).toEqual(bytesToHex(xprivStable))\n\n    const xpubNoble = convertEd25519PublicKeyToX25519(hexToBytes(key.publicKeyHex))\n    const xpubStable = convertPublicKeyToX25519(hexToBytes(key.publicKeyHex))\n    expect(bytesToHex(xpubNoble)).toEqual(bytesToHex(xpubStable))\n  })\n\n  it('creates a key with user-provided kid and signs with it', async () => {\n    const kms = new KeyManagementSystem(new MemoryPrivateKeyStore())\n    const kid = 'my-custom-kid'\n    const key = await kms.createKey({ type: 'Ed25519', kid })\n    expect(key.type).toEqual('Ed25519')\n    expect(key.kid).toEqual(kid)\n    expect(key.publicKeyHex).toHaveLength(64)\n    expect(key.meta?.algorithms).toContain('EdDSA')\n\n    const data = stringToUtf8Bytes('test data for custom kid')\n    const signature = await kms.sign({ keyRef: key, data, algorithm: 'EdDSA' })\n    expect(signature).toBeDefined()\n    expect(typeof signature).toBe('string')\n  })\n\n  it('imports an Ed25519 key with custom kid and signs with it', async () => {\n    const kms = new KeyManagementSystem(new MemoryPrivateKeyStore())\n    const privateKeyHex = 'ed3991fa33d4df22c88b78249e4d73c509c640a873a66808ad5dce774334ce94ee5072bc20355b4cd5499e04ee70853591bffa1874b1b5467dedd648d5b89ecb'\n    const kid = 'custom-ed25519-kid'\n    const key = await kms.importKey({ kid, privateKeyHex, type: 'Ed25519' })\n    expect(key.type).toEqual('Ed25519')\n    expect(key.kid).toEqual(kid)\n    expect(key.publicKeyHex).toHaveLength(64)\n    expect(key.meta?.algorithms).toContain('EdDSA')\n\n    const data = stringToUtf8Bytes('test data for imported Ed25519')\n    const signature = await kms.sign({ keyRef: key, data, algorithm: 'EdDSA' })\n    expect(signature).toBeDefined()\n    expect(typeof signature).toBe('string')\n  })\n\n  it('computes a shared secret Ed+Ed', async () => {\n    const kms = new KeyManagementSystem(new MemoryPrivateKeyStore())\n    const myKey = {\n      type: <TKeyType>'Ed25519',\n      privateKeyHex:\n        'ed3991fa33d4df22c88b78249e4d73c509c640a873a66808ad5dce774334ce94ee5072bc20355b4cd5499e04ee70853591bffa1874b1b5467dedd648d5b89ecb',\n    }\n    const theirKey = {\n      type: <TKeyType>'Ed25519',\n      publicKeyHex: 'e1d1dc2afe59bb054c44ba23ba07561d15ba83f9d1c42568ac11351fbdfd87c6',\n    }\n    const myKeyRef = await kms.importKey(myKey)\n    const secret = await kms.sharedSecret({ myKeyRef, theirKey })\n    expect(secret).toEqual('2f1d171ad32fdbd10d1b06600d70223f7298809d4a3690fa03d6b4688c7b116a')\n  })\n\n  it('computes a shared secret Ed+X', async () => {\n    const kms = new KeyManagementSystem(new MemoryPrivateKeyStore())\n    const myKey = {\n      type: <TKeyType>'Ed25519',\n      privateKeyHex:\n        'ed3991fa33d4df22c88b78249e4d73c509c640a873a66808ad5dce774334ce94ee5072bc20355b4cd5499e04ee70853591bffa1874b1b5467dedd648d5b89ecb',\n    }\n    const theirKey = {\n      type: <TKeyType>'X25519',\n      publicKeyHex: '09c99ad2fdb13247d97f4343d05cc20930db0808697e89f8f3d111a40cb6ee35',\n    }\n    const myKeyRef = await kms.importKey(myKey)\n    const secret = await kms.sharedSecret({ myKeyRef, theirKey })\n    expect(secret).toEqual('2f1d171ad32fdbd10d1b06600d70223f7298809d4a3690fa03d6b4688c7b116a')\n  })\n\n  it('computes a shared secret X+Ed', async () => {\n    const kms = new KeyManagementSystem(new MemoryPrivateKeyStore())\n    const myKey = {\n      type: <TKeyType>'X25519',\n      privateKeyHex: '704380837434dde8a41bebcb75494578bf243fa19cd59e120a1de84e0815c84d',\n    }\n\n    const theirKey = {\n      type: <TKeyType>'Ed25519',\n      publicKeyHex: 'e1d1dc2afe59bb054c44ba23ba07561d15ba83f9d1c42568ac11351fbdfd87c6',\n    }\n    const myKeyRef = await kms.importKey(myKey)\n    const secret = await kms.sharedSecret({ myKeyRef, theirKey })\n    expect(secret).toEqual('2f1d171ad32fdbd10d1b06600d70223f7298809d4a3690fa03d6b4688c7b116a')\n  })\n\n  it('computes a shared secret X+X', async () => {\n    const kms = new KeyManagementSystem(new MemoryPrivateKeyStore())\n    const myKey = {\n      type: <TKeyType>'X25519',\n      privateKeyHex: '704380837434dde8a41bebcb75494578bf243fa19cd59e120a1de84e0815c84d',\n    }\n\n    const theirKey = {\n      type: <TKeyType>'X25519',\n      publicKeyHex: '09c99ad2fdb13247d97f4343d05cc20930db0808697e89f8f3d111a40cb6ee35',\n    }\n    const myKeyRef = await kms.importKey(myKey)\n    const secret = await kms.sharedSecret({ myKeyRef, theirKey })\n    expect(secret).toEqual('2f1d171ad32fdbd10d1b06600d70223f7298809d4a3690fa03d6b4688c7b116a')\n  })\n\n  it('throws on invalid myKey type', async () => {\n    expect.assertions(1)\n    const kms = new KeyManagementSystem(new MemoryPrivateKeyStore())\n    const myKey = {\n      type: <TKeyType>'Secp256k1',\n      privateKeyHex: '704380837434dde8a41bebcb75494578bf243fa19cd59e120a1de84e0815c84d',\n    }\n\n    const theirKey = {\n      type: <TKeyType>'X25519',\n      publicKeyHex: '09c99ad2fdb13247d97f4343d05cc20930db0808697e89f8f3d111a40cb6ee35',\n    }\n    const myKeyRef = await kms.importKey(myKey)\n    expect(kms.sharedSecret({ myKeyRef, theirKey })).rejects.toThrow('not_supported')\n  })\n\n  it('throws on invalid theirKey type', async () => {\n    expect.assertions(1)\n    const kms = new KeyManagementSystem(new MemoryPrivateKeyStore())\n    const myKey = {\n      type: <TKeyType>'X25519',\n      privateKeyHex: '704380837434dde8a41bebcb75494578bf243fa19cd59e120a1de84e0815c84d',\n    }\n    const myKeyRef = await kms.importKey(myKey)\n    const theirKey = {\n      type: <TKeyType>'Secp256k1',\n      publicKeyHex: '09c99ad2fdb13247d97f4343d05cc20930db0808697e89f8f3d111a40cb6ee35',\n    }\n\n    expect(kms.sharedSecret({ myKeyRef, theirKey })).rejects.toThrow('not_supported')\n  })\n})\n\ndescribe('@veramo/kms-local Secp256r1 support', () => {\n  it('generates a managed key', async () => {\n    const kms = new KeyManagementSystem(new MemoryPrivateKeyStore())\n    const key = await kms.createKey({ type: 'Secp256r1' })\n    expect(key.type).toEqual('Secp256r1')\n    expect(key.publicKeyHex).toHaveLength(66)\n    expect(key.kid).toBeDefined()\n    expect(key.meta).toEqual({\n      algorithms: ['ES256'],\n    })\n  })\n\n  it('imports a private key', async () => {\n    const kms = new KeyManagementSystem(new MemoryPrivateKeyStore())\n    const privateKeyHex = '96fe4d2b4a5d3abc4679fe39aa5d4b76990ff416e6ff403a58bd722cf8352f94'\n    const key = await kms.importKey({ kid: 'test', privateKeyHex, type: 'Secp256r1' })\n    expect(key.type).toEqual('Secp256r1')\n    expect(key.publicKeyHex).toEqual('03930fc234a12c939ccb1591a7c394088a30a32e81ac832ed8a0136e32bd73f792')\n    expect(key.kid).toEqual('test')\n    expect(key.meta).toEqual({\n      algorithms: ['ES256'],\n    })\n  })\n\n  it('signs input data', async () => {\n    const kms = new KeyManagementSystem(new MemoryPrivateKeyStore())\n    const privateKeyHex = '96fe4d2b4a5d3abc4679fe39aa5d4b76990ff416e6ff403a58bd722cf8352f94'\n    const data = stringToUtf8Bytes('test')\n\n    const key = await kms.importKey({ kid: 'test', privateKeyHex, type: 'Secp256r1' })\n    const signature = await kms.sign({ keyRef: key, data, algorithm: 'ES256' })\n    expect(signature).toEqual(\n      'tTHhkwVSNk-C84zHS_ObzpyMNVoFopwUkR_pKxSC4kPyEIZrB5L36AFWHQQhp827D9aUSMKi38yiCrSfI4h7VA',\n    )\n  })\n})\n"
  },
  {
    "path": "packages/kms-local/src/__tests__/secret-box.test.ts",
    "content": "import { SecretBox } from '../secret-box.js'\n\ndescribe('@veramo/kms-local', () => {\n  it('should encrypt and decrypt', async () => {\n    const secretKey = await SecretBox.createSecretKey()\n    const box = new SecretBox(secretKey)\n    const message = 'hello world'\n\n    const encrypted = await box.encrypt(message)\n    const decrypted = await box.decrypt(encrypted)\n    expect(decrypted).toEqual(message)\n  })\n  //\n  // // @ts-ignore\n  // const curves = elliptic.default.curves\n  //\n  // function createCurve(options: any) {\n  //   // @ts-ignore\n  //   // const curve = elliptic.default.curve\n  //   let curve\n  //   if (options.type === 'short') curve = new elliptic.curve.short(options)\n  //   else if (options.type === 'edwards') curve = new elliptic.curve.edwards(options)\n  //   else {\n  //     // @ts-ignore\n  //     curve = new elliptic.curve.mont(options)\n  //   }\n  //\n  //   curve.hash = options.hash\n  //   if (!curve.g.validate()) {\n  //     throw new Error('Invalid curve')\n  //   }\n  //   if (!curve.g.mul(curve.n).isInfinity()) {\n  //     throw new Error(\"Invalid curve, G*N != O'\")\n  //   }\n  //   return curve\n  // }\n  //\n  // function defineCurve(name: string, options: any) {\n  //   Object.defineProperty(curves, name, {\n  //     configurable: true,\n  //     enumerable: true,\n  //     get: function () {\n  //       var curve = createCurve(options)\n  //       Object.defineProperty(curves, name, {\n  //         configurable: true,\n  //         enumerable: true,\n  //         value: curve,\n  //       })\n  //       return curve\n  //     },\n  //   })\n  // }\n  //\n  // it.only('should do baby jubjbub', async () => {\n  //   // @ts-ignore\n  //   defineCurve('babyjubjub', {\n  //     type: 'edwards',\n  //     prime: '30644e72 e131a029 b85045b6 8181585d 2833e848 79b97091 43e1f593 f0000001',\n  //     p: 'ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff',\n  //     a: 'ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc',\n  //     b: '64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1',\n  //     n: 'ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831',\n  //     hash: hash.sha256,\n  //     gRed: false,\n  //     g: [\n  //       '188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012',\n  //       '07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811',\n  //     ],\n  //   })\n  //   // @ts-ignore\n  //   console.dir(elliptic.default.curves)\n  //   const a = new elliptic.ec('babyjubjub')\n  //\n  // })\n})\n"
  },
  {
    "path": "packages/kms-local/src/index.ts",
    "content": "/**\n * Provides a {@link https://github.com/jedisct1/libsodium.js | libsodium} backed\n * {@link @veramo/kms-local#KeyManagementSystem | key management system } and\n * {@link @veramo/kms-local#SecretBox | secret box } for the {@link @veramo/key-manager#KeyManager}\n *\n * @packageDocumentation\n */\nexport { KeyManagementSystem } from './key-management-system.js'\nexport { SecretBox } from './secret-box.js'\n"
  },
  {
    "path": "packages/kms-local/src/key-management-system.ts",
    "content": "import {\n  IKey,\n  KEY_ALG_MAPPING,\n  ManagedKeyInfo,\n  MinimalImportableKey,\n  RequireOnly,\n  TKeyType,\n} from '@veramo/core-types'\nimport {\n  AbstractKeyManagementSystem,\n  AbstractPrivateKeyStore,\n  Eip712Payload,\n  ManagedPrivateKey,\n} from '@veramo/key-manager'\n\nimport { EdDSASigner, ES256KSigner, ES256Signer } from 'did-jwt'\nimport { ed25519, x25519 } from '@noble/curves/ed25519'\nimport { p256 } from '@noble/curves/p256'\nimport {\n  TransactionRequest,\n  toUtf8String,\n  Wallet,\n  SigningKey,\n  randomBytes,\n  getBytes,\n  hexlify,\n  Transaction,\n  decodeRlp\n} from 'ethers'\nimport Debug from 'debug'\nimport {\n  bytesToHex,\n  concat,\n  convertEd25519PrivateKeyToX25519,\n  convertEd25519PublicKeyToX25519,\n  hexToBytes,\n} from '@veramo/utils'\n\nconst debug = Debug('veramo:kms:local')\n\n/**\n * This is an implementation of {@link @veramo/key-manager#AbstractKeyManagementSystem | AbstractKeyManagementSystem}\n * that uses a local {@link @veramo/key-manager#AbstractPrivateKeyStore | AbstractPrivateKeyStore} to hold private key\n * material.\n *\n * The key material is used to provide local implementations of various cryptographic algorithms.\n *\n * @public\n */\nexport class KeyManagementSystem extends AbstractKeyManagementSystem {\n  private readonly keyStore: AbstractPrivateKeyStore\n\n  constructor(keyStore: AbstractPrivateKeyStore) {\n    super()\n    this.keyStore = keyStore\n  }\n\n  async importKey(args: Omit<MinimalImportableKey, 'kms'>): Promise<ManagedKeyInfo> {\n    if (!args.type || !args.privateKeyHex) {\n      throw new Error('invalid_argument: type and privateKeyHex are required to import a key')\n    }\n    const managedKey = this.asManagedKeyInfo({ alias: args.kid, ...args })\n    await this.keyStore.importKey({ alias: managedKey.kid, ...args })\n    debug('imported key', managedKey.type, managedKey.publicKeyHex)\n    return managedKey\n  }\n\n  async listKeys(): Promise<ManagedKeyInfo[]> {\n    const privateKeys = await this.keyStore.listKeys({})\n    const managedKeys = privateKeys.map((key) => this.asManagedKeyInfo(key))\n    return managedKeys\n  }\n\n  async createKey({ type, kid }: { type: TKeyType, kid?: string }): Promise<ManagedKeyInfo> {\n    let key: ManagedKeyInfo\n\n    switch (type) {\n      case 'Ed25519': {\n        const ed25519SecretKey = ed25519.utils.randomPrivateKey()\n        const publicKey = ed25519.utils.getExtendedPublicKey(ed25519SecretKey).pointBytes\n        key = await this.importKey({\n          type,\n          kid,\n          privateKeyHex: bytesToHex(concat([ed25519SecretKey, publicKey])),\n        })\n        break\n      }\n      case 'Secp256r1': // Generation uses exactly the same input mechanism for both Secp256k1 and Secp256r1\n      case 'Secp256k1': {\n        const privateBytes = randomBytes(32)\n        key = await this.importKey({\n          type,\n          kid,\n          privateKeyHex: bytesToHex(privateBytes),\n        })\n        break\n      }\n      case 'X25519': {\n        const secretX25519 = x25519.utils.randomPrivateKey()\n        key = await this.importKey({\n          type,\n          kid,\n          privateKeyHex: bytesToHex(secretX25519),\n        })\n        break\n      }\n      default:\n        throw Error('not_supported: Key type not supported: ' + type)\n    }\n\n    debug('Created key', type, key.publicKeyHex)\n\n    return key\n  }\n\n  async deleteKey(args: { kid: string }) {\n    return await this.keyStore.deleteKey({ alias: args.kid })\n  }\n\n  async sign({\n    keyRef,\n    algorithm,\n    data,\n  }: {\n    keyRef: Pick<IKey, 'kid'>\n    algorithm?: string\n    data: Uint8Array\n  }): Promise<string> {\n    let managedKey: ManagedPrivateKey\n    try {\n      managedKey = await this.keyStore.getKey({ alias: keyRef.kid })\n    } catch (e) {\n      throw new Error(`key_not_found: No key entry found for kid=${keyRef.kid}`)\n    }\n\n    if (\n      managedKey.type === 'Ed25519' &&\n      (typeof algorithm === 'undefined' || ['Ed25519', 'EdDSA'].includes(algorithm))\n    ) {\n      return await this.signEdDSA(managedKey.privateKeyHex, data)\n    } else if (managedKey.type === 'Secp256k1') {\n      if (typeof algorithm === 'undefined' || ['ES256K', 'ES256K-R'].includes(algorithm)) {\n        return await this.signES256K(managedKey.privateKeyHex, algorithm, data)\n      } else if (['eth_signTransaction', 'signTransaction', 'signTx'].includes(algorithm)) {\n        return await this.eth_signTransaction(managedKey.privateKeyHex, data)\n      } else if (algorithm === 'eth_signMessage') {\n        return await this.eth_signMessage(managedKey.privateKeyHex, data)\n      } else if (['eth_signTypedData', 'EthereumEip712Signature2021'].includes(algorithm)) {\n        return await this.eth_signTypedData(managedKey.privateKeyHex, data)\n      } else if (['eth_rawSign'].includes(algorithm)) {\n        return this.eth_rawSign(managedKey.privateKeyHex, data)\n      }\n    } else if (\n      managedKey.type === 'Secp256r1' &&\n      (typeof algorithm === 'undefined' || algorithm === 'ES256')\n    ) {\n      return await this.signES256(managedKey.privateKeyHex, data)\n    }\n\n    throw Error(`not_supported: Cannot sign ${algorithm} using key of type ${managedKey.type}`)\n  }\n\n  async sharedSecret(args: {\n    myKeyRef: Pick<IKey, 'kid'>\n    theirKey: Pick<IKey, 'type' | 'publicKeyHex'>\n  }): Promise<string> {\n    let myKey: ManagedPrivateKey\n    try {\n      myKey = await this.keyStore.getKey({ alias: args.myKeyRef.kid })\n    } catch (e) {\n      throw new Error(`key_not_found: No key entry found for kid=${args.myKeyRef.kid}`)\n    }\n    if (!myKey.privateKeyHex) {\n      throw Error('key_not_managed: No private key is available for kid: ' + myKey.alias)\n    }\n    let theirKey: Pick<IKey, 'type' | 'publicKeyHex'> = args.theirKey\n    if (\n      !theirKey.type ||\n      typeof theirKey.type !== 'string' ||\n      !theirKey.publicKeyHex ||\n      typeof theirKey.publicKeyHex !== 'string'\n    ) {\n      throw new Error(`invalid_argument: args.theirKey must contain 'type' and 'publicKeyHex'`)\n    }\n    let myKeyBytes = getBytes('0x' + myKey.privateKeyHex)\n    if (myKey.type === 'Ed25519') {\n      myKeyBytes = convertEd25519PrivateKeyToX25519(myKeyBytes)\n    } else if (myKey.type !== 'X25519') {\n      throw new Error(`not_supported: can't compute shared secret for type=${myKey.type}`)\n    }\n    let theirKeyBytes = getBytes('0x' + theirKey.publicKeyHex)\n    if (theirKey.type === 'Ed25519') {\n      theirKeyBytes = convertEd25519PublicKeyToX25519(theirKeyBytes)\n    } else if (theirKey.type !== 'X25519') {\n      throw new Error(`not_supported: can't compute shared secret for type=${theirKey.type}`)\n    }\n    const shared = x25519.getSharedSecret(myKeyBytes, theirKeyBytes)\n    return hexlify(shared).substring(2)\n  }\n\n  /**\n   * @returns a `0x` prefixed hex string representing the signed EIP712 data\n   */\n  private async eth_signTypedData(privateKeyHex: string, data: Uint8Array) {\n    let msg, msgDomain, msgTypes\n    const serializedData = toUtf8String(data)\n    try {\n      let jsonData = <Eip712Payload>JSON.parse(serializedData)\n      if (typeof jsonData.domain === 'object' && typeof jsonData.types === 'object') {\n        const { domain, types, message } = jsonData\n        msg = message\n        msgDomain = domain\n        msgTypes = types\n      } else {\n        // next check will throw since the data couldn't be parsed\n      }\n    } catch (e) {\n      // next check will throw since the data couldn't be parsed\n    }\n    if (typeof msgDomain !== 'object' || typeof msgTypes !== 'object' || typeof msg !== 'object') {\n      throw Error(\n        `invalid_arguments: Cannot sign typed data. 'domain', 'types', and 'message' must be provided`,\n      )\n    }\n    delete msgTypes.EIP712Domain\n    const wallet = new Wallet(privateKeyHex)\n\n    const signature = await wallet.signTypedData(msgDomain, msgTypes, msg)\n    // HEX encoded string\n    return signature\n  }\n\n  /**\n   * @returns a `0x` prefixed hex string representing the signed message\n   */\n  private async eth_signMessage(privateKeyHex: string, rawMessageBytes: Uint8Array) {\n    const wallet = new Wallet(privateKeyHex)\n    const signature = await wallet.signMessage(rawMessageBytes)\n    // HEX encoded string, 0x prefixed\n    return signature\n  }\n\n  /**\n   * @returns a `0x` prefixed hex string representing the signed raw transaction\n   */\n  private async eth_signTransaction(privateKeyHex: string, rlpTransaction: Uint8Array) {\n    const transaction = Transaction.from(bytesToHex(rlpTransaction, true))\n    const wallet = new Wallet(privateKeyHex)\n    if (transaction.from) {\n      debug('WARNING: executing a transaction signing request with a `from` field.')\n      if (wallet.address.toLowerCase() !== transaction.from.toLowerCase()) {\n        const msg =\n          'invalid_arguments: eth_signTransaction `from` field does not match the chosen key. `from` field should be omitted.'\n        debug(msg)\n        throw new Error(msg)\n      }\n    }\n    const signedRawTransaction = await wallet.signTransaction(transaction)\n    // HEX encoded string, 0x prefixed\n    return signedRawTransaction\n  }\n\n  /**\n   * @returns a `0x` prefixed hex string representing the signed digest in compact format\n   */\n  private eth_rawSign(managedKey: string, data: Uint8Array) {\n    return new SigningKey('0x' + managedKey).sign(data).compactSerialized\n  }\n\n  /**\n   * @returns a base64url encoded signature for the `EdDSA` alg\n   */\n  private async signEdDSA(key: string, data: Uint8Array): Promise<string> {\n    const signer = EdDSASigner(hexToBytes(key))\n    const signature = await signer(data)\n    // base64url encoded string\n    return signature as string\n  }\n\n  /**\n   * @returns a base64url encoded signature for the `ES256K` or `ES256K-R` alg\n   */\n  private async signES256K(\n    privateKeyHex: string,\n    alg: string | undefined,\n    data: Uint8Array,\n  ): Promise<string> {\n    const signer = ES256KSigner(hexToBytes(privateKeyHex), alg === 'ES256K-R')\n    const signature = await signer(data)\n    // base64url encoded string\n    return signature as string\n  }\n\n  /**\n   * @returns a base64url encoded signature for the `ES256` alg\n   */\n  private async signES256(privateKeyHex: string, data: Uint8Array): Promise<string> {\n    const signer = ES256Signer(hexToBytes(privateKeyHex))\n    const signature = await signer(data)\n    // base64url encoded string\n    return signature as string\n  }\n\n  /**\n   * Converts a {@link @veramo/key-manager#ManagedPrivateKey | ManagedPrivateKey} to\n   * {@link @veramo/core-types#ManagedKeyInfo}\n   */\n  private asManagedKeyInfo(args: RequireOnly<ManagedPrivateKey, 'privateKeyHex' | 'type'>): ManagedKeyInfo {\n    let key: Partial<ManagedKeyInfo>\n    switch (args.type) {\n      case 'Ed25519': {\n        const secretKey = hexToBytes(args.privateKeyHex.toLowerCase())\n        const publicKeyHex = bytesToHex(ed25519.getPublicKey(secretKey.subarray(0, 32)))\n        key = {\n          type: args.type,\n          kid: args.alias || publicKeyHex,\n          publicKeyHex,\n          meta: {\n            algorithms: [...KEY_ALG_MAPPING[args.type], 'Ed25519'],\n          },\n        }\n        break\n      }\n      case 'Secp256k1': {\n        const privateBytes = hexToBytes(args.privateKeyHex.toLowerCase())\n        const keyPair = new SigningKey(privateBytes)\n        const publicKeyHex = keyPair.publicKey.substring(2)\n        key = {\n          type: args.type,\n          kid: args.alias || publicKeyHex,\n          publicKeyHex,\n          meta: {\n            algorithms: [\n              ...KEY_ALG_MAPPING[args.type],\n              'eth_signTransaction',\n              'eth_signTypedData',\n              'eth_signMessage',\n              'eth_rawSign',\n            ],\n          },\n        }\n        break\n      }\n      case 'Secp256r1': {\n        const privateBytes = hexToBytes(args.privateKeyHex.toLowerCase())\n        const publicKeyHex = bytesToHex(p256.getPublicKey(privateBytes, true))\n        key = {\n          type: args.type,\n          kid: args.alias || publicKeyHex,\n          publicKeyHex,\n          meta: {\n            algorithms: ['ES256'], // ECDH not supported yet by this KMS\n          },\n        }\n        break\n      }\n      case 'X25519': {\n        const secretKeyBytes = hexToBytes(args.privateKeyHex.toLowerCase())\n        const publicKeyHex = bytesToHex(x25519.getPublicKey(secretKeyBytes))\n        key = {\n          type: args.type,\n          kid: args.alias || publicKeyHex,\n          publicKeyHex: publicKeyHex,\n          meta: {\n            algorithms: [...KEY_ALG_MAPPING[args.type]],\n          },\n        }\n        break\n      }\n      default:\n        throw Error('not_supported: Key type not supported: ' + args.type)\n    }\n    return key as ManagedKeyInfo\n  }\n}\n"
  },
  {
    "path": "packages/kms-local/src/secret-box.ts",
    "content": "import { AbstractSecretBox } from '@veramo/key-manager'\nimport { secretBox, openSecretBox, generateKeyPair } from '@stablelib/nacl'\nimport { getBytes, concat, hexlify, toUtf8Bytes, toUtf8String, randomBytes } from 'ethers'\n\nconst NONCE_BYTES = 24\n\n/**\n * This is an implementation of {@link @veramo/key-manager#AbstractSecretBox | AbstractSecretBox} that uses a JavaScript\n * {@link https://nacl.cr.yp.to/secretbox.html | nacl secretBox} implementation for encryption.\n *\n * See {@link @veramo/data-store#PrivateKeyStore}\n * See {@link @veramo/data-store-json#PrivateKeyStoreJson}\n * See {@link @veramo/key-manager#AbstractSecretBox}\n *\n * @public\n */\nexport class SecretBox extends AbstractSecretBox {\n  constructor(private secretKey: string) {\n    super()\n    if (!secretKey) {\n      throw Error('Secret key is required')\n    }\n  }\n\n  static async createSecretKey(): Promise<string> {\n    const pair = generateKeyPair()\n    return hexlify(pair.secretKey).substring(2)\n  }\n\n  async encrypt(message: string): Promise<string> {\n    const nonce = randomBytes(NONCE_BYTES)\n    const key = getBytes('0x' + this.secretKey)\n    const cipherText = secretBox(key, nonce, toUtf8Bytes(message))\n    return concat([nonce, cipherText]).substring(2)\n  }\n\n  async decrypt(encryptedMessageHex: string): Promise<string> {\n    const cipherTextWithNonce = getBytes('0x' + encryptedMessageHex)\n    const nonce = cipherTextWithNonce.slice(0, NONCE_BYTES)\n    const cipherText = cipherTextWithNonce.slice(NONCE_BYTES)\n    const key = getBytes('0x' + this.secretKey)\n    const decrypted = openSecretBox(key, nonce, cipherText) || new Uint8Array(0)\n    return toUtf8String(decrypted)\n  }\n}\n"
  },
  {
    "path": "packages/kms-local/tsconfig.json",
    "content": "{\n  \"extends\": \"../tsconfig.settings.json\",\n  \"compilerOptions\": {\n    \"rootDir\": \"src\",\n    \"outDir\": \"build\",\n    \"declarationDir\": \"build\",\n    \"skipLibCheck\": true\n  },\n  \"references\": [\n    {\n      \"path\": \"../core-types\"\n    },\n    {\n      \"path\": \"../key-manager\"\n    },\n    {\n      \"path\": \"../utils\"\n    }\n  ]\n}\n"
  },
  {
    "path": "packages/kms-web3/CHANGELOG.md",
    "content": "# Change Log\n\nAll notable changes to this project will be documented in this file.\nSee [Conventional Commits](https://conventionalcommits.org) for commit guidelines.\n\n# [7.0.0](https://github.com/decentralized-identity/veramo/compare/v6.0.2...v7.0.0) (2026-02-11)\n\n\n### Bug Fixes\n\n* **deps:** update devdeps and bump typeorm to 0.3.20 ([#1272](https://github.com/decentralized-identity/veramo/issues/1272)) ([7d17f37](https://github.com/decentralized-identity/veramo/commit/7d17f37ea7cc4e73a8cdae028681ae1be5c4d11c))\n\n\n\n\n\n## [6.0.2](https://github.com/decentralized-identity/veramo/compare/v6.0.1...v6.0.2) (2026-01-16)\n\n**Note:** Version bump only for package @veramo/kms-web3\n\n\n\n\n\n## [6.0.1](https://github.com/decentralized-identity/veramo/compare/v6.0.0...v6.0.1) (2026-01-16)\n\n**Note:** Version bump only for package @veramo/kms-web3\n\n\n\n\n\n# [6.0.0](https://github.com/decentralized-identity/veramo/compare/v5.6.0...v6.0.0) (2024-04-02)\n\n**Note:** Version bump only for package @veramo/kms-web3\n\n\n\n\n\n# [5.6.0](https://github.com/decentralized-identity/veramo/compare/v5.5.3...v5.6.0) (2024-01-16)\n\n\n### Features\n\n* **remote-client:** allow dynamic headers param for AgentRestClient constructor ([#1314](https://github.com/decentralized-identity/veramo/issues/1314)) ([1b8a0a2](https://github.com/decentralized-identity/veramo/commit/1b8a0a2718dd63492ad3a312a6ebe5f6e7849935)), closes [#1313](https://github.com/decentralized-identity/veramo/issues/1313)\n\n\n\n\n\n## [5.5.3](https://github.com/decentralized-identity/veramo/compare/v5.5.2...v5.5.3) (2023-10-09)\n\n\n### Bug Fixes\n\n* use DIF URLs in packages ([#1271](https://github.com/decentralized-identity/veramo/issues/1271)) ([3dfc601](https://github.com/decentralized-identity/veramo/commit/3dfc6014cdee7902c59d8db76b4c8507b870f227))\n\n\n\n\n\n# [5.5.0](https://github.com/uport-project/veramo/compare/v5.4.1...v5.5.0) (2023-09-19)\n\n\n### Bug Fixes\n\n* **did-provider-key:** use compressed keys for creating Secp256k1 did:key ([#1217](https://github.com/uport-project/veramo/issues/1217)) ([ba8f6f5](https://github.com/uport-project/veramo/commit/ba8f6f5b9b701e57af86491504ecd209ca0c1c1d)), closes [#1213](https://github.com/uport-project/veramo/issues/1213)\n\n\n\n\n\n## [5.4.1](https://github.com/uport-project/veramo/compare/v5.4.0...v5.4.1) (2023-08-04)\n\n\n### Bug Fixes\n\n* **ci:** benign change meant to tag all packages for another patch release ([#1211](https://github.com/uport-project/veramo/issues/1211)) ([41b5c90](https://github.com/uport-project/veramo/commit/41b5c90277171b7b38c5cf49ca01db5cf75b6300))\n\n\n\n\n\n# [5.4.0](https://github.com/uport-project/veramo/compare/v5.3.0...v5.4.0) (2023-08-01)\n\n**Note:** Version bump only for package @veramo/kms-web3\n\n\n\n\n\n# [5.3.0](https://github.com/uport-project/veramo/compare/v5.2.0...v5.3.0) (2023-07-27)\n\n**Note:** Version bump only for package @veramo/kms-web3\n\n\n\n\n\n## [5.1.2](https://github.com/uport-project/veramo/compare/v5.1.1...v5.1.2) (2023-02-25)\n\n**Note:** Version bump only for package @veramo/kms-web3\n\n\n\n\n\n# [5.1.0](https://github.com/uport-project/veramo/compare/v5.0.0...v5.1.0) (2023-02-24)\n\n**Note:** Version bump only for package @veramo/kms-web3\n\n\n\n\n\n# [5.0.0](https://github.com/uport-project/veramo/compare/v4.3.0...v5.0.0) (2023-02-09)\n\n\n### Build System\n\n* convert veramo modules to ESM instead of CommonJS ([#1103](https://github.com/uport-project/veramo/issues/1103)) ([b5cea3c](https://github.com/uport-project/veramo/commit/b5cea3c0d80d900a47bd1d9eea68f84b70a35e7b)), closes [#1099](https://github.com/uport-project/veramo/issues/1099)\n\n\n### Features\n\n* isolate `core-types` package from `core` ([#1116](https://github.com/uport-project/veramo/issues/1116)) ([ba7a303](https://github.com/uport-project/veramo/commit/ba7a303de91cf4cc568a3af1ddf8ca98ed022e9f))\n\n\n### BREAKING CHANGES\n\n* this is a breaking change as modules will have to be imported differently: \n* https://www.typescriptlang.org/docs/handbook/esm-node.html\n* https://nodejs.org/api/esm.html\n* https://caniuse.com/?search=modules\n\ntest(did-provider-ion): skip a couple of tests that fail with unreasonable errors\nchore: use ubuntu-latest on CI\nfix: temporarily remove puppeteer tests\nfix: use craco for test-react-app to enable babel config\ntest: fix unit and integration tests (browser tests still broken)\nfix: fix some build issues that prevented tests from working\nfix: missing deps flagged by pnpm\n\n\n\n\n\n# [4.3.0](https://github.com/uport-project/veramo/compare/v4.2.0...v4.3.0) (2023-01-27)\n\n**Note:** Version bump only for package @veramo/kms-web3\n\n\n\n\n\n# [4.2.0](https://github.com/uport-project/veramo/compare/v4.1.2...v4.2.0) (2022-12-05)\n\n\n### Bug Fixes\n\n* **deps:** bump dependencies ([701b8ed](https://github.com/uport-project/veramo/commit/701b8edf981ea11c7ddb6a81d2817dbbdbb022f3))\n\n\n\n\n\n## [4.1.1](https://github.com/uport-project/veramo/compare/v4.1.0...v4.1.1) (2022-11-01)\n\n**Note:** Version bump only for package @veramo/kms-web3\n\n\n\n\n\n# [4.1.0](https://github.com/uport-project/veramo/compare/v4.0.2...v4.1.0) (2022-10-31)\n\n**Note:** Version bump only for package @veramo/kms-web3\n\n\n\n\n\n## [4.0.2](https://github.com/uport-project/veramo/compare/v4.0.1...v4.0.2) (2022-10-04)\n\n**Note:** Version bump only for package @veramo/kms-web3\n\n\n\n\n\n# [4.0.0](https://github.com/uport-project/veramo/compare/v3.1.5...v4.0.0) (2022-09-22)\n\n\n### Bug Fixes\n\n* **kms-web3:** use ethers _signTypedData ([#939](https://github.com/uport-project/veramo/issues/939)) ([f198997](https://github.com/uport-project/veramo/commit/f198997d08f65b758bd9471bd4cf170ac8620e82)), closes [#938](https://github.com/uport-project/veramo/issues/938)\n\n\n### Features\n\n* **credential-status:** expect revoked boolean property from StatusMethods ([e00daa4](https://github.com/uport-project/veramo/commit/e00daa47865ea42d7bd8667f37c6e12fc21fd4b9))\n* **credential-status:** rename plugin interfaces and methods ([a5adaba](https://github.com/uport-project/veramo/commit/a5adaba21a97f525bf69d156df991afc234896ab)), closes [#981](https://github.com/uport-project/veramo/issues/981)\n* **credential-w3c:** add ICredentialPlugin interface in core package ([#1001](https://github.com/uport-project/veramo/issues/1001)) ([7b6d195](https://github.com/uport-project/veramo/commit/7b6d1950364c8b741dd958d29e506b95fa5b1cec)), closes [#941](https://github.com/uport-project/veramo/issues/941)\n* **kms-web3:** add a KMS implementation backed by a web3 provider ([#924](https://github.com/uport-project/veramo/issues/924)) ([14f71af](https://github.com/uport-project/veramo/commit/14f71afbb72dca8274790d3b20b518ddfe4f2585)), closes [#688](https://github.com/uport-project/veramo/issues/688)\n* **kms-web3:** add ability to list provider accounts as keys ([#965](https://github.com/uport-project/veramo/issues/965)) ([31e3946](https://github.com/uport-project/veramo/commit/31e3946af3e281f823b41ee3f1c389d6cbc88c29)), closes [#933](https://github.com/uport-project/veramo/issues/933)\n"
  },
  {
    "path": "packages/kms-web3/LICENSE",
    "content": "                                 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 2019 Consensys AG\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"
  },
  {
    "path": "packages/kms-web3/README.md",
    "content": "# Veramo Web3 KMS\n\nA Veramo KMS implementation that provides secp256k1 crypto backed by web3 wallets.\n\nThis module provides an implementation\nof [`AbstractKeyManagementSystem`](../key-manager/src/abstract-key-management-system.ts#L6) that can be used by the\n[`@veramo/key-manager`](../key-manager) plugin to provide Secp256k1 crypto functionality to a\nVeramo agent.\n"
  },
  {
    "path": "packages/kms-web3/api-extractor.json",
    "content": "{\n  \"$schema\": \"https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json\",\n  \"apiReport\": {\n    \"enabled\": true,\n    \"reportFolder\": \"./api\",\n    \"reportTempFolder\": \"./api\"\n  },\n\n  \"docModel\": {\n    \"enabled\": true,\n    \"apiJsonFilePath\": \"./api/<unscopedPackageName>.api.json\"\n  },\n\n  \"dtsRollup\": {\n    \"enabled\": false\n  },\n  \"mainEntryPointFilePath\": \"<projectFolder>/build/index.d.ts\"\n}\n"
  },
  {
    "path": "packages/kms-web3/package.json",
    "content": "{\n  \"name\": \"@veramo/kms-web3\",\n  \"description\": \"Veramo KMS implementation backed by web3 wallets\",\n  \"version\": \"7.0.0\",\n  \"main\": \"build/index.js\",\n  \"exports\": \"./build/index.js\",\n  \"types\": \"build/index.d.ts\",\n  \"scripts\": {\n    \"build\": \"tsc\",\n    \"extract-api\": \"node ../cli/bin/veramo.js dev extract-api\"\n  },\n  \"dependencies\": {\n    \"@veramo/core-types\": \"workspace:^\",\n    \"@veramo/key-manager\": \"workspace:^\",\n    \"debug\": \"^4.3.3\",\n    \"ethers\": \"^6.13.4\"\n  },\n  \"devDependencies\": {\n    \"@types/debug\": \"4.1.8\",\n    \"typescript\": \"5.7.3\"\n  },\n  \"files\": [\n    \"build/**/*\",\n    \"src/**/*\",\n    \"README.md\",\n    \"LICENSE\"\n  ],\n  \"publishConfig\": {\n    \"access\": \"public\"\n  },\n  \"repository\": {\n    \"type\": \"git\",\n    \"url\": \"https://github.com/decentralized-identity/veramo.git\",\n    \"directory\": \"packages/kms-web3\"\n  },\n  \"author\": \"Consensys Mesh R&D <hello@veramo.io>\",\n  \"contributors\": [\n    \"Simonas Karuzas <simonas.karuzas@mesh.xyz>\",\n    \"Mircea Nistor <mircea.nistor@mesh.xyz>\"\n  ],\n  \"keywords\": [\n    \"Veramo\",\n    \"DID\",\n    \"Verifiable Credential\",\n    \"veramo-plugin\",\n    \"KMS\",\n    \"web3\",\n    \"ethereum\",\n    \"wallet\"\n  ],\n  \"license\": \"Apache-2.0\",\n  \"type\": \"module\",\n  \"moduleDirectories\": [\n    \"node_modules\",\n    \"src\"\n  ]\n}\n"
  },
  {
    "path": "packages/kms-web3/src/index.ts",
    "content": "/**\n * Provides a web3 wallet backed\n * {@link @veramo/kms-web3#Web3KeyManagementSystem | key management system } \n * for the {@link @veramo/key-manager#KeyManager}\n *\n * @packageDocumentation\n */\nexport { Web3KeyManagementSystem } from './web3-key-management-system.js'\n\n"
  },
  {
    "path": "packages/kms-web3/src/web3-key-management-system.ts",
    "content": "import { JsonRpcSigner, BrowserProvider, toUtf8String } from 'ethers'\nimport { TKeyType, IKey, ManagedKeyInfo, MinimalImportableKey } from '@veramo/core-types'\nimport { AbstractKeyManagementSystem, Eip712Payload } from '@veramo/key-manager'\n\n/**\n * This is a {@link @veramo/key-manager#AbstractKeyManagementSystem | KMS} implementation that uses the addresses of a\n * web3 wallet as key identifiers, and calls the respective wallet for signing operations.\n * @beta\n */\nexport class Web3KeyManagementSystem extends AbstractKeyManagementSystem {\n  /**\n   *\n   * @param providers - the key can be any unique name.\n   * Example `{ metamask: metamaskProvider, walletConnect: walletConnectProvider }`\n   */\n  constructor(private providers: Record<string, BrowserProvider>) {\n    super()\n  }\n\n  createKey({ type }: { type: TKeyType }): Promise<ManagedKeyInfo> {\n    throw Error('not_supported: Web3KeyManagementSystem cannot create new keys')\n  }\n\n  async importKey(args: Omit<MinimalImportableKey, 'kms'>): Promise<ManagedKeyInfo> {\n    // throw Error('Not implemented')\n    return args as any as ManagedKeyInfo\n  }\n\n  async listKeys(): Promise<ManagedKeyInfo[]> {\n    const keys: ManagedKeyInfo[] = []\n    for (const provider in this.providers) {\n      const accounts = await this.providers[provider].listAccounts()\n      for (const account of accounts) {\n        const key: ManagedKeyInfo = {\n          kid: `${provider}-${account}`,\n          type: 'Secp256k1',\n          publicKeyHex: '',\n          kms: '',\n          meta: {\n            account,\n            provider,\n            algorithms: ['eth_signMessage', 'eth_signTypedData'],\n          },\n        }\n        keys.push(key)\n      }\n    }\n    return keys\n  }\n\n  async sharedSecret(args: {\n    myKeyRef: Pick<IKey, 'kid'>\n    theirKey: Pick<IKey, 'type' | 'publicKeyHex'>\n  }): Promise<string> {\n    throw Error('not_implemented: Web3KeyManagementSystem sharedSecret')\n  }\n\n  async deleteKey(args: { kid: string }) {\n    // this kms doesn't need to delete keys\n    return true\n  }\n\n  // keyRef should be in this format '{providerName-account}\n  // example: 'metamask-0xf3beac30c498d9e26865f34fcaa57dbb935b0d74'\n  private async getAccountAndSignerByKeyRef(keyRef: Pick<IKey, 'kid'>): Promise<{ account: string; signer: JsonRpcSigner }> {\n    const [providerName, account] = keyRef.kid.split('-')\n    if (!this.providers[providerName]) {\n      throw Error(`not_available: provider ${providerName}`)\n    }\n    const signer = await this.providers[providerName].getSigner(account)\n    return { account, signer }\n  }\n\n  async sign({\n    keyRef,\n    algorithm,\n    data,\n  }: {\n    keyRef: Pick<IKey, 'kid'>\n    algorithm?: string\n    data: Uint8Array\n  }): Promise<string> {\n    if (algorithm) {\n      if (algorithm === 'eth_signMessage') {\n        return await this.eth_signMessage(keyRef, data)\n      } else if (['eth_signTypedData', 'EthereumEip712Signature2021'].includes(algorithm)) {\n        return await this.eth_signTypedData(keyRef, data)\n      }\n    }\n\n    throw Error(`not_supported: Cannot sign ${algorithm} `)\n  }\n\n  /**\n   * @returns a `0x` prefixed hex string representing the signed EIP712 data\n   */\n  private async eth_signTypedData(keyRef: Pick<IKey, 'kid'>, data: Uint8Array) {\n    let msg, msgDomain, msgTypes, msgPrimaryType\n    const serializedData = toUtf8String(data)\n    try {\n      const jsonData = JSON.parse(serializedData) as Eip712Payload\n      if (typeof jsonData.domain === 'object' && typeof jsonData.types === 'object') {\n        const { domain, types, message, primaryType } = jsonData\n        msg = message\n        msgDomain = domain\n        msgTypes = types\n        msgPrimaryType = primaryType\n      } else {\n        // next check will throw since the data couldn't be parsed\n      }\n    } catch (e) {\n      // next check will throw since the data couldn't be parsed\n    }\n    if (typeof msgDomain !== 'object' || typeof msgTypes !== 'object' || typeof msg !== 'object') {\n      throw Error(\n        `invalid_arguments: Cannot sign typed data. 'domain', 'types', and 'message' must be provided`,\n      )\n    }\n    delete msgTypes.EIP712Domain\n\n    const { signer } = await this.getAccountAndSignerByKeyRef(keyRef)\n    const signature = await signer.signTypedData(msgDomain, msgTypes, msg)\n\n    return signature\n  }\n\n  /**\n   * @returns a `0x` prefixed hex string representing the signed message\n   */\n  private async eth_signMessage(keyRef: Pick<IKey, 'kid'>, rawMessageBytes: Uint8Array) {\n    const { signer } = await this.getAccountAndSignerByKeyRef(keyRef)\n    const signature = await signer.signMessage(rawMessageBytes)\n    // HEX encoded string, 0x prefixed\n    return signature\n  }\n}\n"
  },
  {
    "path": "packages/kms-web3/tsconfig.json",
    "content": "{\n  \"extends\": \"../tsconfig.settings.json\",\n  \"compilerOptions\": {\n    \"rootDir\": \"src\",\n    \"outDir\": \"build\",\n    \"declarationDir\": \"build\"\n  },\n  \"references\": [{ \"path\": \"../core-types\" }, { \"path\": \"../key-manager\" }]\n}\n"
  },
  {
    "path": "packages/kv-store/CHANGELOG.md",
    "content": "# Change Log\n\nAll notable changes to this project will be documented in this file.\nSee [Conventional Commits](https://conventionalcommits.org) for commit guidelines.\n\n# [7.0.0](https://github.com/decentralized-identity/veramo/compare/v6.0.2...v7.0.0) (2026-02-11)\n\n\n### Bug Fixes\n\n* **deps:** update devdeps and bump typeorm to 0.3.20 ([#1272](https://github.com/decentralized-identity/veramo/issues/1272)) ([7d17f37](https://github.com/decentralized-identity/veramo/commit/7d17f37ea7cc4e73a8cdae028681ae1be5c4d11c))\n\n\n### Features\n\n* **credential-w3c:** refactor the ICredentialProvider API ([#1488](https://github.com/decentralized-identity/veramo/issues/1488)) ([cbd848d](https://github.com/decentralized-identity/veramo/commit/cbd848d4ce2b52497d99d335f1c93bd8b005cdb2))\n\n\n### BREAKING CHANGES\n\n* **credential-w3c:** This changeset, along with the previous changes in #1395 modify the CredentialPlugin to support extensibility without modifications to the veramo repository. This plugin now acts as an orchestrator for other ICredentialProvider implementations that provide the actual support for various verifiable data formats. ICredentialProvider implementations can be implemented externally and used with this plugin.\n\n\n\n\n\n## [6.0.2](https://github.com/decentralized-identity/veramo/compare/v6.0.1...v6.0.2) (2026-01-16)\n\n**Note:** Version bump only for package @veramo/kv-store\n\n\n\n\n\n## [6.0.1](https://github.com/decentralized-identity/veramo/compare/v6.0.0...v6.0.1) (2026-01-16)\n\n**Note:** Version bump only for package @veramo/kv-store\n\n\n\n\n\n# [6.0.0](https://github.com/decentralized-identity/veramo/compare/v5.6.0...v6.0.0) (2024-04-02)\n\n**Note:** Version bump only for package @veramo/kv-store\n\n\n\n\n\n# [5.6.0](https://github.com/decentralized-identity/veramo/compare/v5.5.3...v5.6.0) (2024-01-16)\n\n\n### Features\n\n* **remote-client:** allow dynamic headers param for AgentRestClient constructor ([#1314](https://github.com/decentralized-identity/veramo/issues/1314)) ([1b8a0a2](https://github.com/decentralized-identity/veramo/commit/1b8a0a2718dd63492ad3a312a6ebe5f6e7849935)), closes [#1313](https://github.com/decentralized-identity/veramo/issues/1313)\n\n\n\n\n\n## [5.5.3](https://github.com/decentralized-identity/veramo/compare/v5.5.2...v5.5.3) (2023-10-09)\n\n\n### Bug Fixes\n\n* use DIF URLs in packages ([#1271](https://github.com/decentralized-identity/veramo/issues/1271)) ([3dfc601](https://github.com/decentralized-identity/veramo/commit/3dfc6014cdee7902c59d8db76b4c8507b870f227))\n\n\n\n\n\n# [5.5.0](https://github.com/uport-project/veramo/compare/v5.4.1...v5.5.0) (2023-09-19)\n\n\n### Bug Fixes\n\n* **did-provider-key:** use compressed keys for creating Secp256k1 did:key ([#1217](https://github.com/uport-project/veramo/issues/1217)) ([ba8f6f5](https://github.com/uport-project/veramo/commit/ba8f6f5b9b701e57af86491504ecd209ca0c1c1d)), closes [#1213](https://github.com/uport-project/veramo/issues/1213)\n\n\n\n\n\n## [5.4.1](https://github.com/uport-project/veramo/compare/v5.4.0...v5.4.1) (2023-08-04)\n\n\n### Bug Fixes\n\n* **ci:** benign change meant to tag all packages for another patch release ([#1211](https://github.com/uport-project/veramo/issues/1211)) ([41b5c90](https://github.com/uport-project/veramo/commit/41b5c90277171b7b38c5cf49ca01db5cf75b6300))\n\n\n\n\n\n# [5.4.0](https://github.com/uport-project/veramo/compare/v5.3.0...v5.4.0) (2023-08-01)\n\n\n### Features\n\n* **did-comm:** add support for the AES based content and key encryption algorithms ([#1180](https://github.com/uport-project/veramo/issues/1180)) ([5294a81](https://github.com/uport-project/veramo/commit/5294a812ee578c0712b54f216416c3ef78c848da))\n\n\n\n\n\n# [5.3.0](https://github.com/uport-project/veramo/compare/v5.2.0...v5.3.0) (2023-07-27)\n\n\n### Features\n\n* **kv-store:** add key-value store based on a typescript port of the keyv package ([#1150](https://github.com/uport-project/veramo/issues/1150)) ([e7138d3](https://github.com/uport-project/veramo/commit/e7138d377c4f6ea242cea645cda4d26eb7d7d377))\n"
  },
  {
    "path": "packages/kv-store/LICENSE",
    "content": "                                 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 2019 Consensys AG\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"
  },
  {
    "path": "packages/kv-store/README.md",
    "content": "# Veramo Key Value store\n\nA simple typed Key Value store with out of the box support for in memory/maps, sqlite and typeorm implementations for\nusage in browser, NodeJS and React-Native.\nIt includes a tiered local/remote implementation that support all environments.\n\n# Usage in your application or module\n\n## setup\n\nVeramo provides 3 store adapters out of the box. The first is an in memory Map based store, the second is a TypeORM\nbased store, meaning we support multiple databases. Lastly there is a tiered store, which allows you to use a local and\nremote store together.\n\nYou should also be able to use store adapters from the [keyv](https://github.com/jaredwray/keyv) project. Be aware that\nVeramo uses an internal fork of that project, as we have several constraints not present in the upstream project. As a\nresult the adapters are not guaranteed to work in your environment.\nSee [Keyv project relationship](#keyv-project-relationship) for more information.\n\n### Map based in memory store\n\nThis is the simplest implementation where a Map is being used to store the Keys and Values\n\n````typescript\nimport { IKeyValueStore, IKeyValueStoreOptions, KeyValueStore } from '@veramo/key-value-store'\n\nconst options: IKeyValueStoreOptions<MyValueType> = {\n  namespace: 'example',\n  store: new Map<string, MyValueType>()\n}\nconst kvStore: IKeyValueStore<MyValueType> = new KeyValueStore({ options })\n````\n\n### TypeORM store\n\nThis implementation uses TypeORM using a simple entity to store the namespace prefixed key, an expiration value and the\nvalue itself. It supports multiple database backends.\n\n````typescript\nimport {\n  IKeyValueStore,\n  IKeyValueStoreOptions,\n  KeyValueStore,\n  KeyValueStoreEntity,\n  KeyValueTypeORMStoreAdapter\n} from '@veramo/key-value-store'\nimport { DataSource } from 'typeorm'\n\nconst dbConnection: DataSource = await new DataSource({\n  type: 'sqlite',\n  database: ':memory:',\n  logging: 'all',\n  migrationsRun: true,\n  synchronize: false,\n  entities: [KeyValueStoreEntity],\n}).initialize()\n\nconst options: IKeyValueStoreOptions<MyValueType> = {\n  namespace: 'example',\n  store: new KeyValueTypeORMStoreAdapter({ dbConnection })\n}\nconst kvStore: IKeyValueStore<MyValueType> = new KeyValueStore({ options })\n````\n\n### Tiered store\n\nThe tiered store expects a local store and a remote store. Obviously it makes most sense to have a memory based local\nstore and potentially more expensive/slower remote store\n\n````typescript\nimport {\n  kvStoreMigrations,\n  IKeyValueStore,\n  IKeyValueStoreOptions,\n  KeyValueStore,\n  KeyValueStoreEntity,\n  KeyValueTieredStoreAdapter,\n  KeyValueTypeORMStoreAdapter\n} from '@veramo/key-value-store'\nimport { DataSource } from 'typeorm'\n\ndbConnection = await new DataSource({\n  type: 'sqlite',\n  database: ':memory:',\n  logging: 'all',\n  migrationsRun: true,\n  synchronize: false,\n  migrations: [...kvStoreMigrations],\n  entities: [KeyValueStoreEntity],\n}).initialize()\n\nconst local: Map<string, MyValueType> = new Map()\nconst remote = new KeyValueTypeORMStoreAdapter({ dbConnection })\n\nconst options: IKeyValueStoreOptions<MyValueType> = {\n  namespace: 'example',\n  store: new KeyValueTieredStoreAdapter({ local, remote })\n}\nconst kvStore: IKeyValueStore<MyValueType> = new KeyValueStore<MyValueType>({ options })\n````\n\n## Usage\n\nAfter you have setup the Key Value Store as described above in your agent, it will be available in your agent.\n\n````typescript\n\nkvStore.set('hello', { example: world }) // Stores the value object by key untill deleted\nkvStore.set('expiring', { example: 'expiration' }, 1000) // Stores the value object by key for 1 second\nconst value = await kvStore.get('hello') // { example: world }\nconst values = await kvStore.getMany(['hello', 'expiring']) // [{ example: world }, {example: expiring}]\n\nif (await kvStore.has('hello')) {\n  await kvStore.delete('hello') // return a boolean for success. You can also call it on non existing keys, which will return false\n}\n\nawait kvStore.clear() // Removes all keys/values from the store\nkvStore.disconnect() // disconnects the store from it backing adapter. You cannot reuse the store afterwards unlesss you initialize a new store.\n\n````\n\n# Keyv project relationship\n\nPlease note that a large portion of the Veramo Key Value Store code is a port of\nthe [keyv](https://github.com/jaredwray/keyv) project, adding support for Typescript and ESM, so it can be used Veramo\n\nThe ported code should support the storage plugins available for the keyv project, although testing has been limited\nVeramo itself has a requirement to support NodeJS, Browser and React-Native environments. The port and the store\nadapters included in Veramo run in these environments.\nPlease be aware that these requirements probably aren't true for any keyv storage plugins.\n\nOne of the big changes compared to the upstream project is that this port does not have dynamic loading of adapters\nbased on URIs. We believe that any Veramo Key Value store should use explicit defined adapters.\n\nThe keyv port is part of the Veramo Key Value Store module code itself, as we do not want to make an official maintained port at this point.\n\nVeramo exposes its own API/interfaces for the Key Value store, meaning we could also support any other implementation in\nthe future \n\nWe welcome any new storage modules\n"
  },
  {
    "path": "packages/kv-store/api-extractor.json",
    "content": "{\n  \"$schema\": \"https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json\",\n  \"apiReport\": {\n    \"enabled\": true,\n    \"reportFolder\": \"./api\",\n    \"reportTempFolder\": \"./api\"\n  },\n\n  \"docModel\": {\n    \"enabled\": true,\n    \"apiJsonFilePath\": \"./api/<unscopedPackageName>.api.json\"\n  },\n\n  \"dtsRollup\": {\n    \"enabled\": false\n  },\n  \"mainEntryPointFilePath\": \"<projectFolder>/build/index.d.ts\"\n}\n"
  },
  {
    "path": "packages/kv-store/package.json",
    "content": "{\n  \"name\": \"@veramo/kv-store\",\n  \"description\": \"Veramo Key Value Store plugin\",\n  \"version\": \"7.0.0\",\n  \"main\": \"build/index.js\",\n  \"exports\": \"./build/index.js\",\n  \"types\": \"build/index.d.ts\",\n  \"scripts\": {\n    \"build\": \"tsc\",\n    \"test\": \"jest --config=../../jest.config.mjs\",\n    \"test:ci\": \"jest --config=../../jest.config.mjs\",\n    \"extract-api\": \"node ../cli/bin/veramo.js dev extract-api\"\n  },\n  \"dependencies\": {\n    \"@veramo/core-types\": \"workspace:*\",\n    \"@veramo/utils\": \"workspace:*\",\n    \"debug\": \"^4.3.4\",\n    \"events\": \"^3.2.0\",\n    \"json-buffer\": \"^3.0.1\",\n    \"typeorm\": \"^0.3.20\",\n    \"uint8arrays\": \"^4.0.6\"\n  },\n  \"devDependencies\": {\n    \"@keyv/compress-brotli\": \"1.1.4\",\n    \"@keyv/compress-gzip\": \"1.2.3\",\n    \"@keyv/sqlite\": \"3.6.5\",\n    \"@keyv/test-suite\": \"1.9.2\",\n    \"@types/debug\": \"4.1.8\",\n    \"@types/events\": \"^3.0.0\",\n    \"@types/json-buffer\": \"3.0.0\",\n    \"@types/node\": \"20.17.4\",\n    \"eslint\": \"8.57.1\",\n    \"eslint-plugin-promise\": \"6.6.0\",\n    \"keyv\": \"4.5.3\",\n    \"timekeeper\": \"2.3.1\",\n    \"typescript\": \"5.7.3\"\n  },\n  \"files\": [\n    \"build/**/*\",\n    \"src/**/*\",\n    \"README.md\",\n    \"LICENSE\"\n  ],\n  \"publishConfig\": {\n    \"access\": \"public\"\n  },\n  \"repository\": {\n    \"type\": \"git\",\n    \"url\": \"https://github.com/decentralized-identity/veramo.git\",\n    \"directory\": \"packages/kv-store\"\n  },\n  \"author\": \"Niels Klomp <nklomp@sphereon.com>\",\n  \"contributors\": [\n    \"Consensys Mesh R&D <hello@veramo.io>\",\n    \"Simonas Karuzas <simonas.karuzas@mesh.xyz>\",\n    \"Mircea Nistor <mircea.nistor@mesh.xyz>\"\n  ],\n  \"keywords\": [\n    \"Veramo\",\n    \"Key Value Store\",\n    \"keyv\",\n    \"veramo-plugin\"\n  ],\n  \"license\": \"Apache-2.0\",\n  \"type\": \"module\",\n  \"moduleDirectories\": [\n    \"node_modules\",\n    \"src\"\n  ]\n}\n"
  },
  {
    "path": "packages/kv-store/src/__tests__/keyv.test.ts",
    "content": "import KeyvSqlite from '@keyv/sqlite'\n\nimport timekeeper from 'timekeeper'\nimport { Keyv } from '../keyv/keyv.js'\nimport { DataSource } from 'typeorm'\nimport { KeyValueStoreEntity } from '../store-adapters/typeorm/entities/keyValueStoreEntity.js'\nimport { KeyValueTieredStoreAdapter, KeyValueTypeORMStoreAdapter } from '../store-adapters/index.js'\nimport { KeyvOptions } from '../keyv/keyv-types.js'\nimport { kvStoreMigrations } from '../store-adapters/typeorm/migrations'\n\nlet dbConnection: DataSource\nbeforeEach(async () => {\n  dbConnection = await new DataSource({\n    type: 'sqlite',\n    database: ':memory:',\n    logging: ['error'],\n    migrationsRun: true,\n    synchronize: false,\n    migrations: [...kvStoreMigrations],\n    entities: [KeyValueStoreEntity],\n  }).initialize()\n})\nafterEach(async () => {\n  try {\n    if (dbConnection?.isInitialized) {\n      await (await dbConnection).destroy()\n    }\n  } catch (error) {\n    // the disconnect test will close the DB anyway\n  }\n})\ndescribe('keyv MAP store', () => {\n  it('should respect ttl', async () => {\n    const store = new Map<string, string>()\n    const keyv = new Keyv<string>(store)\n    await keyv.set('key', 'value', 100)\n\n    expect(await keyv.get('key')).toEqual('value')\n    timekeeper.freeze(Date.now() + 150)\n    expect(await keyv.get('key')).toBeUndefined()\n  })\n  it('should work for all methods', async () => {\n    const store = new Map<string, string>()\n    await testAllKeyvMethods(store)\n  })\n})\n\ndescribe('keyv sqlite store', () => {\n  it('should respect ttl', async () => {\n    const keyv = new Keyv<string>(new KeyvSqlite<string>())\n    await keyv.set('key', 'value', 100)\n\n    expect(await keyv.get('key')).toEqual('value')\n    timekeeper.freeze(Date.now() + 150)\n    expect(await keyv.get('key')).toBeUndefined()\n  })\n  it('should work for all methods', async () => {\n    const store = new KeyvSqlite<string>()\n    await testAllKeyvMethods(store)\n  })\n})\n\ndescribe('keyv TypeORM store', () => {\n  it('should respect ttl', async () => {\n    const store = new KeyValueTypeORMStoreAdapter({ dbConnection, namespace: 'test' })\n    const keyv = new Keyv<string>(store)\n    await keyv.set('key', 'value', 100)\n\n    expect(await keyv.get('key')).toEqual('value')\n    timekeeper.freeze(Date.now() + 150)\n    expect(await keyv.get('key')).toBeUndefined()\n  })\n\n  it('should set a value that can be retrieved from the proper namespace', async () => {\n    const store = new KeyValueTypeORMStoreAdapter({ dbConnection, namespace: 'test' })\n    const keyv = new Keyv<string>(store)\n    await keyv.set('key', 'value')\n    expect(await keyv.get('key')).toEqual('value')\n\n    const alternateStore = new KeyValueTypeORMStoreAdapter({ dbConnection, namespace: 'another' })\n    const alternateKeyv = new Keyv<string>(alternateStore)\n    expect(await alternateKeyv.get('key')).toBeUndefined()\n  })\n\n  it('should set multiple values that can be retrieved', async () => {\n    const store = new KeyValueTypeORMStoreAdapter({ dbConnection, namespace: 'test' })\n    const keyv = new Keyv<string>(store)\n    for (let i = 0; i < 10; i++) {\n      await keyv.set(`${i}`, `value${i}`)\n    }\n\n    let values = await keyv.getMany(['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'nope'])\n    expect(values).toHaveLength(11)\n\n    await keyv.delete('0')\n    expect(await keyv.getMany(['0'])).toHaveLength(1)\n    values = await keyv.getMany(['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'nope'])\n    expect(values).toHaveLength(11)\n    expect(values[9]).toBe('value9')\n    expect(values[10]).toBeUndefined()\n\n    await keyv.clear()\n    values = await keyv.getMany(['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'nope'])\n    expect(values).toHaveLength(11)\n    expect(values[0]).toBeUndefined()\n    expect(values[9]).toBeUndefined()\n    expect(values[10]).toBeUndefined()\n  })\n  it('should work for all methods', async () => {\n    const store = new KeyValueTypeORMStoreAdapter({ dbConnection, namespace: 'test-all' })\n    await testAllKeyvMethods(store)\n    await store.disconnect()\n  })\n})\n\ndescribe('keyv tiered store', () => {\n  it('should respect ttl', async () => {\n    const local: Map<string, string> = new Map()\n    const remote = new KeyValueTypeORMStoreAdapter({ dbConnection })\n\n    const options: KeyvOptions<string> = {\n      namespace: 'example',\n      store: new KeyValueTieredStoreAdapter({ local, remote }),\n    }\n    const keyv = new Keyv<string>(undefined, options)\n    await keyv.set('key', 'value', 100)\n\n    expect(await keyv.get('key')).toEqual('value')\n    timekeeper.freeze(Date.now() + 150)\n    expect(await keyv.get('key')).toBeUndefined()\n    await keyv.disconnect()\n  })\n  it('should work for all methods', async () => {\n    const local: Map<string, string> = new Map()\n    const remote = new KeyValueTypeORMStoreAdapter({ dbConnection })\n\n    const options: KeyvOptions<string> = {\n      namespace: 'example',\n      store: new KeyValueTieredStoreAdapter({ local, remote }),\n    }\n    const store = new Keyv<string>(undefined, options)\n\n    // No raw match test, as remote and local have different raw values\n    await testAllKeyvMethods(store, false)\n  })\n})\n\nasync function testAllKeyvMethods(store: any, rawMatchTest = true) {\n  const keyv = new Keyv<string>(store)\n\n  // set value\n  await expect(keyv.set('key1', 'value1')).resolves.toEqual(true)\n  await expect(keyv.set('key2', 'value2')).resolves.toEqual(true)\n\n  // get value by key\n  await expect(keyv.get('key1', { raw: false })).resolves.toEqual('value1')\n  await expect(keyv.get('key1', { raw: true })).resolves.toMatchObject({ value: 'value1' })\n\n  // get value by non-existing key\n  await expect(keyv.get('key3', { raw: false })).resolves.toBeUndefined()\n  await expect(keyv.get('key3', { raw: true })).resolves.toBeUndefined()\n\n  // Get many as non-raw and raw\n  await expect(keyv.getMany(['key1', 'key2'], { raw: false })).resolves.toMatchObject(['value1', 'value2'])\n  if (rawMatchTest) {\n    await expect(keyv.getMany(['key1', 'key2'], { raw: true })).resolves.toMatchObject([\n      { value: 'value1' },\n      { value: 'value2' },\n    ])\n  }\n\n  // Check existence\n  await expect(keyv.has('key1')).resolves.toEqual(true)\n  await expect(keyv.has('key3')).resolves.toEqual(false)\n\n  // delete key1 only\n  await expect(keyv.delete('key1')).resolves.toEqual(true)\n  await expect(keyv.has('key1')).resolves.toEqual(false)\n  await expect(keyv.has('key2')).resolves.toEqual(true)\n\n  // clear\n  await keyv.clear()\n  await expect(keyv.has('key2')).resolves.toEqual(false)\n}\n"
  },
  {
    "path": "packages/kv-store/src/__tests__/kvstore.test.ts",
    "content": "import { KeyValueStore } from '../key-value-store.js'\nimport { IKeyValueStore } from '../key-value-types.js'\n\ninterface TestValue {\n  stringProp: string\n  numberProp: number\n  objectProp: {\n    value: string | number\n  }\n}\n\nlet testValues: TestValue[] = []\n\nfor (let i = 0; i < 10; i++) {\n  testValues.push({\n    stringProp: `stringValue${i}`,\n    numberProp: i,\n    objectProp: {\n      value: `objectValue${i}`,\n    },\n  })\n}\ndescribe('kvStore with MAP adapter', () => {\n  let kvStore: IKeyValueStore<TestValue>\n  beforeEach(async () => {\n    const store = new Map<string, TestValue>()\n    kvStore = new KeyValueStore({ store })\n    for (let i = 0; i < 10; i++) {\n      await kvStore.set(`key${i}`, testValues[i])\n    }\n  })\n  afterEach(async () => {\n    try {\n      await kvStore.clear()\n      await kvStore.disconnect()\n    } catch (error) {}\n  })\n  it('should get non-existing keys as undefined', async () => {\n    await expect(kvStore.get('nope')).resolves.toBeUndefined()\n    await expect(kvStore.getAsValueData('nope')).resolves.toMatchObject({\n      value: undefined,\n      expires: undefined,\n    })\n  })\n\n  it('should get single results', async () => {\n    for (let i = 0; i < 10; i++) {\n      await expect(kvStore.get(`key${i}`)).resolves.toEqual(testValues[i])\n      await expect(kvStore.getAsValueData(`key${i}`)).resolves.toMatchObject({\n        value: testValues[i],\n      })\n    }\n  })\n\n  it('should get multiple results', async () => {\n    // Let's get multiple results\n    const manyResult = await kvStore.getMany(['key1', 'nope', 'key4'])\n    expect(manyResult).toHaveLength(3)\n    expect(manyResult[0]).toEqual(testValues[1])\n    expect(manyResult[1]).toBeUndefined()\n    expect(manyResult[2]).toEqual(testValues[4])\n    const manyValueResult = await kvStore.getManyAsValueData(['key1', 'nope', 'key4'])\n    expect(manyValueResult).toHaveLength(3)\n    expect(manyValueResult[0]).toEqual({ value: testValues[1], expires: undefined })\n    expect(manyValueResult[1]).toEqual({ value: undefined, expires: undefined })\n    expect(manyValueResult[2]).toEqual({ value: testValues[4], expires: undefined })\n  })\n\n  it('should check existence of keys', async () => {\n    await expect(kvStore.has(`key1`)).resolves.toEqual(true)\n    await expect(kvStore.has(`nope`)).resolves.toEqual(false)\n  })\n\n  it('should delete an existing key', async () => {\n    await expect(kvStore.has(`key1`)).resolves.toEqual(true)\n    await expect(kvStore.delete(`key1`)).resolves.toEqual(true)\n    await expect(kvStore.has(`key1`)).resolves.toEqual(false)\n  })\n\n  it('should not throw an error when deleting a non-existing key', async () => {\n    await expect(kvStore.delete(`nope`)).resolves.toEqual(false)\n  })\n\n  it('should delete multiple values', async () => {\n    await expect(kvStore.deleteMany(['key2', 'nope', 'key6'])).resolves.toEqual([true, false, true])\n  })\n\n  it('should clear all', async () => {\n    await kvStore.clear()\n    await expect(kvStore.has(`key1`)).resolves.toEqual(false)\n  })\n})\n"
  },
  {
    "path": "packages/kv-store/src/index.ts",
    "content": "/**\n * Provides a {@link @veramo/did-manager#DIDManager | plugin} for the\n * {@link @veramo/core#Agent} that implements {@link @veramo/core-types#IDIDManager} interface.\n *\n * @packageDocumentation\n */\nexport { KeyValueStore } from './key-value-store.js'\nexport * from './store-adapters/tiered/index.js'\nexport * from './store-adapters/typeorm/index.js'\nexport * from './key-value-types.js'\nexport * from './store-adapters/index.js'\n"
  },
  {
    "path": "packages/kv-store/src/key-value-store.ts",
    "content": "import {\n  IKeyValueStore,\n  IKeyValueStoreOnArgs,\n  IKeyValueStoreOptions,\n  IValueData,\n  ValueStoreType,\n} from './key-value-types.js'\nimport { Keyv } from './keyv/keyv.js'\nimport { KeyvDeserializedData, KeyvOptions, KeyvStoredData } from './keyv/keyv-types.js'\n\n/**\n * Class that implements the {@link @veramo/kv-store#IKeyValueStore} interface\n *\n * This class is a Key Value store that leverages a port of the keyv package internally.\n * The store does not leak the types of the Keyv port,\n * so it could be replaced with another implementations if we want to.\n *\n * @public\n */\nexport class KeyValueStore<ValueType extends ValueStoreType> implements IKeyValueStore<ValueType> {\n  /**\n   * The main keyv typescript port which delegates to the storage adapters and takes care of some common functionality\n   *\n   * @internal\n   */\n  private readonly keyv: Keyv<ValueType>\n\n  constructor(options: IKeyValueStoreOptions<ValueType>) {\n    this.keyv = new Keyv(options.uri, options as KeyvOptions<ValueType>)\n  }\n\n  async get(key: string): Promise<ValueType | undefined> {\n    const result = await this.keyv.get(key, { raw: false })\n    if (result === null || result === undefined) {\n      return undefined\n    }\n    return result as ValueType\n  }\n\n  async getAsValueData(key: string): Promise<IValueData<ValueType>> {\n    const result = await this.keyv.get(key, { raw: true })\n    if (result === null || result === undefined) {\n      // We always return a ValueData object for this method\n      return { value: undefined, expires: undefined }\n    }\n    return this.toDeserializedValueData(result)\n  }\n\n  getIterator(): AsyncGenerator<[key: string, value: ValueType], void> {\n    if (!this.keyv.iterator) throw new Error('keyv: iterator not available')\n    return this.keyv.iterator()\n  }\n\n  async getMany(keys?: string[]): Promise<Array<ValueType | undefined>> {\n    if (!keys || keys.length === 0) {\n      return []\n    }\n\n    let result = await this.keyv.getMany(keys, { raw: false })\n\n    // Making sure we return the same array length as the amount of key(s) passed in\n    if (result === null || result === undefined || result.length === 0) {\n      result = new Array<ValueType | undefined>()\n      for (const key of keys) {\n        result.push(undefined)\n      }\n    }\n    return result.map((v) => (!!v ? (v as ValueType) : undefined))\n  }\n\n  async getManyAsValueData(keys: string[]): Promise<Array<IValueData<ValueType>>> {\n    if (!keys || keys.length === 0) {\n      return []\n    }\n    let result = await this.keyv.getMany(keys, { raw: true })\n\n    // Making sure we return the same array length as the amount of key(s) passed in\n    if (result === null || result === undefined || result.length === 0) {\n      result = new Array<KeyvStoredData<ValueType>>()\n      for (const key of keys) {\n        result.push({ value: undefined, expires: undefined } as unknown as KeyvDeserializedData<ValueType>)\n      }\n    }\n    return result.map((v) =>\n      !!v ? this.toDeserializedValueData(v) : { value: undefined, expires: undefined },\n    )\n  }\n\n  async set(key: string, value: ValueType, ttl?: number): Promise<IValueData<ValueType>> {\n    return this.keyv.set(key, value, ttl).then(() => this.getAsValueData(key))\n  }\n\n  async has(key: string): Promise<boolean> {\n    return this.keyv.has(key)\n  }\n\n  async delete(key: string): Promise<boolean> {\n    return this.keyv.delete(key)\n  }\n\n  async deleteMany(keys: string[]): Promise<boolean[]> {\n    return Promise.all(keys.map((key) => this.keyv.delete(key)))\n  }\n\n  async clear(): Promise<IKeyValueStore<ValueType>> {\n    return this.keyv.clear().then(() => this)\n  }\n\n  async disconnect(): Promise<void> {\n    return this.keyv.disconnect()\n  }\n\n  // Public so parties using the kv store directly can add listeners if they want\n  async kvStoreOn(args: IKeyValueStoreOnArgs): Promise<IKeyValueStore<ValueType>> {\n    this.keyv.on(args.eventName, args.listener)\n    return this\n  }\n\n  private toDeserializedValueData<ValueType>(result: any): IValueData<ValueType> {\n    if (result === null || result === undefined) {\n      throw Error(`Result cannot be undefined or null at this this point`)\n    } else if (typeof result !== 'object') {\n      return { value: result, expires: undefined }\n    } else if (!('value' in result)) {\n      return { value: result, expires: undefined }\n    }\n    return result as IValueData<ValueType>\n  }\n}\n"
  },
  {
    "path": "packages/kv-store/src/key-value-types.ts",
    "content": "/**\n * This is how the store will actually store the value.\n * It contains an optional `expires` property, which indicates when the value would expire\n *\n * @beta\n */\nexport interface IValueData<ValueType> {\n  value?: ValueType\n  expires?: number\n}\n\n/**\n * Event listener arguments\n *\n * @beta\n */\nexport interface IKeyValueStoreOnArgs {\n  eventName: string | symbol\n  listener: (...args: any[]) => void\n}\n\n/**\n * Options for the Key Value store\n *\n * @beta\n */\nexport interface IKeyValueStoreOptions<ValueType> {\n  [key: string]: any\n\n  /** Namespace for the current instance. */\n  namespace?: string | undefined\n\n  /** The connection string URI. */\n  uri?: string | undefined\n  /** The storage adapter instance to be used by Keyv. or any other implementation */\n  store: IKeyValueStoreAdapter<ValueType> | Map<string, ValueType>\n  /** Default TTL. Can be overridden by specifying a TTL on `.set()`. */\n  ttl?: number | undefined\n\n  emitErrors?: boolean\n}\n\n/**\n * A store adapter implementation needs to provide namespace support\n *\n * @beta\n */\nexport interface IKeyValueStoreAdapter<ValueType> {\n  namespace?: string | undefined\n}\n\n/**\n * The types that can be stored by a store adapter\n *\n * @public\n */\nexport type ValueStoreType = object | string | number | boolean\n\n/**\n * A Key Value store is responsible for managing Values identified by keys.\n *\n * @beta\n */\nexport interface IKeyValueStore<ValueType extends ValueStoreType> {\n  /**\n   * Get a single value by key. Can be undefined as the underlying store typically will not throw an error for a non existing key\n   *\n   * @param key - Contains the key to search for\n   */\n  get(key: string): Promise<ValueType | undefined>\n\n  /**\n   * Get a single item as Value Data from the store. Will always return a Value Data Object, but the value in it can be undefined in case the actual store does not contain the value\n   *\n   * @param key - Contains the key to search for\n   */\n  getAsValueData(key: string): Promise<IValueData<ValueType>>\n\n  /**\n   * @remarks in order to consume the iterator, you need to use the for await syntax as follows:\n   *\n   * ```\n   * for await (const result of store.getIterator()) {\n   *   console.log(result)\n   * }\n   * ```\n   *\n   * @returns An async iterator for all the keys in the store\n   */\n  getIterator(): AsyncGenerator<any, void>\n\n  /**\n   * Get multiple values from the store. Will always return an array with values, but the values can be undefined in case the actual store does not contain the value for the respective key\n   *\n   * @param keys - Contains the keys to search for\n   */\n  getMany(keys: string[]): Promise<Array<ValueType | undefined>>\n\n  /**\n   * Get multiple items as Value Data from the store. Will always return an array with Value Data Object, but the value in it can be undefined in case the actual store does not contain the value\n   *\n   * @param keys - Contains the keys to search for\n   */\n  getManyAsValueData(keys: string[]): Promise<Array<IValueData<ValueType>>>\n\n  /**\n   * Store a single value\n   *\n   * @param key - The key\n   * @param value - The value\n   * @param ttl - An optional number how long to store the value in milliseconds. If not provided will be stored indefinitely\n   */\n  set(key: string, value: ValueType, ttl?: number): Promise<IValueData<ValueType>>\n\n  /**\n   * Delete a value from the store by key\n   *\n   * @param key - The key to delete the value for\n   */\n  delete(key: string): Promise<boolean>\n\n  /**\n   * Delete multiple values by provided keys\n   *\n   * @param keys - The keys to delete the values for\n   */\n  deleteMany(keys: string[]): Promise<boolean[]>\n\n  /**\n   * Clear the whole store (delete all values)\n   */\n  clear(): Promise<IKeyValueStore<ValueType>>\n\n  /**\n   * Determine whether the store has the value belonging to the provided key\n   *\n   * @param key - The key to search for\n   */\n  has(key: string): Promise<boolean>\n\n  /**\n   * Disconnect the backing store. After this operation the store typically cannot be reused, unless the store object is re-instantiated\n   */\n  disconnect(): Promise<void>\n}\n"
  },
  {
    "path": "packages/kv-store/src/keyv/keyv-types.ts",
    "content": "/**\n * Please be aware these types are compatible with the keyv package, to ensure we can use its store-adapters for free.\n *\n * Be very careful when extending/changing!. Normally you will want to create an adapter or decorator for your additional behaviour or requirements\n */\nimport { OrPromise } from '@veramo/utils'\n\nexport interface KeyvOptions<Value> {\n  [key: string]: any\n\n  /** Namespace for the current instance. */\n  namespace?: string | undefined\n  /** A custom serialization function. */\n  serialize?: (data: KeyvDeserializedData<Value>) => OrPromise<string | undefined>\n  /** A custom deserialization function. */\n  deserialize?: (data: any) => OrPromise<KeyvDeserializedData<Value> | undefined>\n  /** The connection string URI. */\n  uri?: string | undefined\n  /** The storage adapter instance to be used by Keyv. */\n  store?: KeyvStore<Value | undefined> | undefined\n  /** Default TTL. Can be overridden by specififying a TTL on `.set()`. */\n  ttl?: number | undefined\n  /** Specify an adapter to use. e.g `'redis'` or `'mongodb'`. */\n  adapter?:\n    | 'redis'\n    | 'mongodb'\n    | 'mongo'\n    | 'sqlite'\n    | 'postgresql'\n    | 'postgres'\n    | 'mysql'\n    | object\n    | string\n    | undefined\n  /** Enable compression option **/\n  compression?: KeyvCompressionAdapter | undefined\n\n  emitErrors?: boolean\n}\n\nexport interface KeyvCompressionAdapter {\n  compress(value: any, options?: any): OrPromise<any>\n\n  decompress(value: any, options?: any): OrPromise<any>\n\n  serialize(value: any): OrPromise<string>\n\n  deserialize(value: any): OrPromise<any>\n}\n\nexport interface KeyvDeserializedData<Value> {\n  value: Value\n  expires: number | undefined\n}\n\nexport type KeyvStoredData<Value> = KeyvDeserializedData<Value> | string | Value | undefined\n\nexport interface KeyvStore<Value> {\n  namespace?: string | undefined\n\n  opts: KeyvOptions<Value>\n\n  on?(eventName: string | symbol, listener: (...args: any[]) => void): void\n  get(\n    key: string | string[],\n    options?: { raw?: boolean },\n  ): OrPromise<KeyvStoredData<Value> | Array<KeyvStoredData<Value>>>\n\n  getMany?(keys: string[], options?: { raw?: boolean }): OrPromise<Array<KeyvStoredData<Value>>> | undefined\n\n  iterator?(namespace?: string | undefined): AsyncGenerator<any, void, any>\n\n  set(key: string, value: Value, ttl?: number): any\n\n  delete(key: string | string[]): OrPromise<boolean>\n\n  deleteMany?(keys: string[]): OrPromise<boolean>\n\n  clear(): OrPromise<void>\n\n  has?(key: string): OrPromise<boolean>\n\n  disconnect?(): void\n}\n"
  },
  {
    "path": "packages/kv-store/src/keyv/keyv.ts",
    "content": "import { EventEmitter } from 'events'\nimport JSONB from 'json-buffer'\nimport { KeyvDeserializedData, KeyvOptions, KeyvStore, KeyvStoredData } from './keyv-types.js'\n\n/**\n * Please note that this is code adapted from @link https://github.com/jaredwray/keyv to support Typescript and ESM in Veramo\n *\n * The code should support the storage plugins available for the keyv project.\n * Veramo itself supports NodeJS, Browser and React-Native environment.\n * Please be aware that these requirements probably aren't true for any keyv storage plugins.\n *\n * One of the big changes compared to the upstream project is that this port does not have dynamic loading of store-adapters based on URIs.\n * We believe that any Veramo Key Value store should use explicitly defined store-adapters.\n *\n * The port is part of the Veramo Key Value Store module, as we do not want to make an official maintained port out of it.\n * Veramo exposes its own API/interfaces for the Key Value store, meaning we could also support any other implementation in the future\n *\n * The Veramo kv-store module provides out of the box support for in memory/maps, sqlite and typeorm implementations,\n * including a tiered local/remote implementation that support all environments.\n *\n * We welcome any new storage modules\n */\nexport class Keyv<Value = any> extends EventEmitter implements KeyvStore<Value> {\n  readonly opts: KeyvOptions<Value>\n  readonly namespace: string\n  iterator?: (namespace?: string) => AsyncGenerator<any, void>\n\n  constructor(\n    uri?: string | Map<string, Value | undefined> | KeyvStore<Value> | undefined,\n    options?: KeyvOptions<Value>,\n  ) {\n    super()\n    const emitErrors = options?.emitErrors === undefined ? true : options.emitErrors\n    uri = uri ?? options?.uri\n    /*if (!uri) {\n      throw Error('No URI provided')\n    }*/\n    this.opts = {\n      namespace: 'keyv',\n      serialize: JSONB.stringify,\n      deserialize: JSONB.parse,\n      ...(typeof uri === 'string' ? { uri } : uri),\n      ...options,\n    }\n\n    if (!this.opts.store) {\n      if (typeof uri !== 'string') {\n        this.opts.store = uri as KeyvStore<Value | undefined>\n      } /* else {\n        const adapterOptions = { ...this.opts }\n        this.opts.store = loadStore(adapterOptions)\n      }*/\n    }\n    if (!this.opts.store) {\n      throw Error('No store')\n    }\n\n    if (this.opts.compression) {\n      const compression = this.opts.compression\n      this.opts.serialize = compression.serialize.bind(compression)\n      this.opts.deserialize = compression.deserialize.bind(compression)\n    }\n\n    if (typeof this.opts.store.on === 'function' && emitErrors) {\n      this.opts.store.on('error', (error) => this.emit('error', error))\n    }\n\n    this.opts.store.namespace = this.opts.namespace || 'keyv'\n    this.namespace = this.opts.store.namespace\n\n    const generateIterator = (iterator: any, keyv: Keyv<any>) =>\n      async function* () {\n        for await (const [key, raw] of typeof iterator === 'function'\n          ? iterator(keyv.store.namespace)\n          : iterator) {\n          const data = await keyv.deserialize(raw)\n          if (keyv.store.namespace && !key.includes(keyv.store.namespace)) {\n            continue\n          }\n\n          if (data && typeof data.expires === 'number' && Date.now() > data.expires) {\n            keyv.delete(key)\n            continue\n          }\n\n          yield [keyv._getKeyUnprefix(key), data?.value]\n        }\n      }\n\n    // Attach iterators\n    // @ts-ignore\n    if (typeof this.store[Symbol.iterator] === 'function' && this.store instanceof Map) {\n      this.iterator = generateIterator(this.store, this)\n    } else if (typeof this.store.iterator === 'function' && this.store.opts && this._checkIterableAdapter()) {\n      this.iterator = generateIterator(this.store.iterator.bind(this.store), this)\n    }\n  }\n\n  get store(): Required<KeyvStore<Value>> {\n    return this.opts.store as Required<KeyvStore<Value>>\n  }\n\n  get deserialize() {\n    return this.opts.deserialize!\n  }\n\n  get serialize() {\n    return this.opts.serialize!\n  }\n\n  _checkIterableAdapter() {\n    return (\n      (this.store.opts.dialect && iterableAdapters.includes(this.store.opts.dialect)) ||\n      (this.store.opts.url &&\n        iterableAdapters.findIndex((element) => this.store.opts.url.includes(element)) >= 0)\n    )\n  }\n\n  _getKeyPrefix(key: string): string {\n    return `${this.opts.namespace}:${key}`\n  }\n\n  _getKeyPrefixArray(keys: string[]): string[] {\n    return keys.map((key) => this._getKeyPrefix(key))\n  }\n\n  _getKeyUnprefix(key: string): string {\n    return key.split(':').splice(1).join(':')\n  }\n\n  async getMany(keys: string[], options?: { raw?: boolean }): Promise<Array<KeyvStoredData<Value>>> {\n    const keyPrefixed = this._getKeyPrefixArray(keys)\n    let promise: Promise<Array<KeyvStoredData<Value>>>\n    if (this.store.getMany !== undefined) {\n      promise = this.store.getMany(keyPrefixed, options) as Promise<KeyvStoredData<Value>[]> //.then(value => !!value ? value.values() : undefined)\n      // todo: Probably wise to check expired ValueData here, if the getMany does not implement this feature itself!\n    } else {\n      promise = Promise.all(\n        keyPrefixed.map((k) => this.store.get(k, options) as Promise<KeyvStoredData<Value>>),\n      )\n    }\n    const allValues = Promise.resolve(promise)\n    const results: Promise<KeyvStoredData<Value>>[] = []\n\n    return Promise.resolve(allValues)\n      .then((all) => {\n        keys.forEach((key, index) => {\n          const data = all[index]\n\n          let result =\n            typeof data === 'string'\n              ? this.deserialize(data)\n              : !!data && this.opts.compression\n              ? this.deserialize(data)\n              : data\n\n          if (\n            result &&\n            typeof result === 'object' &&\n            'expires' in result &&\n            typeof result.expires === 'number' &&\n            Date.now() > result.expires\n          ) {\n            this.delete(key)\n            result = undefined\n          }\n\n          const final = (\n            options && options.raw\n              ? result\n              : result && typeof result === 'object' && 'value' in result\n              ? result.value\n              : result\n          ) as Promise<KeyvStoredData<Value>>\n\n          results.push(final)\n        })\n      })\n      .then(() => Promise.all(results))\n  }\n\n  async get(\n    key: string | string[],\n    options?: { raw?: boolean },\n  ): Promise<Value | string | KeyvDeserializedData<Value> | KeyvStoredData<Value>[] | undefined> {\n    const isArray = Array.isArray(key)\n    return Promise.resolve()\n      .then(() =>\n        isArray\n          ? this.getMany(this._getKeyPrefixArray(key), options)\n          : this.store.get(this._getKeyPrefix(key)),\n      )\n      .then((data) =>\n        typeof data === 'string'\n          ? this.deserialize(data)\n          : this.opts.compression\n          ? this.deserialize(data)\n          : data,\n      )\n      .then((data) => {\n        if (data === undefined || data === null) {\n          return undefined\n        }\n        const rows = Array.isArray(data) ? data : [data]\n\n        if (isArray) {\n          const result = []\n\n          for (let row of rows) {\n            if (row === undefined || row === null) {\n              result.push(undefined)\n              continue\n            }\n\n            if (this.isExpired(row)) {\n              this.delete(key).then(() => undefined)\n              result.push(undefined)\n            } else {\n              result.push(options && options.raw ? row : toValue(row))\n            }\n          }\n\n          return result\n        } else if (!Array.isArray(data)) {\n          if (this.isExpired(data)) {\n            return this.delete(key).then(() => undefined)\n          }\n        }\n\n        return options && options.raw\n          ? data\n          : Array.isArray(data)\n          ? data.map((d) => toValue(d))\n          : toValue(data)\n      })\n  }\n\n  private isExpired(data: KeyvDeserializedData<any> | string | Value): boolean {\n    return (\n      typeof data !== 'string' &&\n      data &&\n      typeof data === 'object' &&\n      'expires' in data &&\n      typeof data.expires === 'number' &&\n      Date.now() > data.expires\n    )\n  }\n\n  set(key: string, value: Value, ttl?: number) {\n    const keyPrefixed = this._getKeyPrefix(key)\n    if (typeof ttl === 'undefined') {\n      ttl = this.opts.ttl\n    }\n    if (ttl === 0) {\n      ttl = undefined\n    }\n\n    // @ts-ignore\n    return Promise.resolve()\n      .then(() => {\n        const expires = typeof ttl === 'number' ? Date.now() + ttl : undefined\n        if (typeof value === 'symbol') {\n          this.emit('error', 'symbol cannot be serialized')\n        }\n\n        const input = { value, expires }\n        return this.serialize(input)\n      })\n      .then((value) => this.store.set(keyPrefixed, value as Value, ttl))\n      .then(() => true)\n  }\n\n  delete(key: string | string[]) {\n    if (!Array.isArray(key)) {\n      const keyPrefixed = this._getKeyPrefix(key)\n      return Promise.resolve().then(() => this.store.delete(keyPrefixed))\n    }\n\n    const keyPrefixed = this._getKeyPrefixArray(key)\n    if (this.store.deleteMany !== undefined) {\n      return Promise.resolve().then(() => this.store.deleteMany!(keyPrefixed))\n    }\n\n    const promises = []\n    for (const key of keyPrefixed) {\n      promises.push(this.store.delete(key))\n    }\n\n    return Promise.allSettled(promises).then((values) => values.every((x) => x.valueOf() === true))\n  }\n\n  async clear(): Promise<void> {\n    return Promise.resolve().then(() => this.store.clear())\n  }\n\n  has(key: string) {\n    const keyPrefixed = this._getKeyPrefix(key)\n    return Promise.resolve().then(async () => {\n      if (typeof this.store.has === 'function') {\n        return this.store.has(keyPrefixed)\n      }\n\n      const value = await this.store.get(keyPrefixed)\n      return value !== undefined\n    })\n  }\n\n  disconnect() {\n    if (typeof this.store.disconnect === 'function') {\n      return this.store.disconnect()\n    }\n  }\n}\n\nconst iterableAdapters = ['typeorm', 'sqlite', 'postgres', 'mysql', 'mongo', 'redis', 'tiered']\n\nfunction toValue<Value>(input: KeyvDeserializedData<Value> | string | Value) {\n  return input !== null && typeof input === 'object' && 'value' in input ? input.value : input\n}\n"
  },
  {
    "path": "packages/kv-store/src/store-adapters/index.ts",
    "content": "export * from './tiered/index.js'\nexport * from './typeorm/index.js'\nexport * from './typeorm/migrations/index.js'\n"
  },
  {
    "path": "packages/kv-store/src/store-adapters/tiered/index.ts",
    "content": "import { EventEmitter } from 'events'\nimport type { Options, Options_ } from './types.js'\nimport { KeyvStore, KeyvStoredData } from '../../keyv/keyv-types.js'\nimport { Keyv } from '../../keyv/keyv.js'\nimport { IKeyValueStoreAdapter } from '../../key-value-types.js'\n\ntype KeyvTieredIndex = 'local' | 'remote'\n\n/**\n * Tiered keyv store adapter, combining 2 adapters/stores into one\n * @alpha\n */\nexport class KeyValueTieredStoreAdapter<Value>\n  extends EventEmitter\n  implements KeyvStore<Value>, IKeyValueStoreAdapter<Value>\n{\n  opts: Options_\n  remote: KeyvStore<Value>\n  local: KeyvStore<Value>\n  iterationLimit?: string | number\n\n  namespace?: string | undefined\n\n  constructor({ remote, local, ...options }: Options<Value>) {\n    super()\n    this.opts = {\n      validator: () => true,\n      dialect: 'tiered',\n      ...options,\n    }\n\n    // todo: since we are instantiating a new Keyv object in case we encounter a map, the key prefix applied twice, given it will be part of a an outer keyv object as well.\n    // Probably wise to simply create a Map Store class. As it is an in memory construct, and will work in terms of resolution it does not have highest priority\n    this.local = (isMap(local) ? new Keyv<Value>(local as Map<string, Value>) : local) as KeyvStore<Value>\n    this.remote = (isMap(remote) ? new Keyv<Value>(remote as Map<string, Value>) : remote) as KeyvStore<Value>\n    this.namespace = this.local.namespace\n  }\n\n  async get(\n    key: string | string[],\n    options?: { raw?: boolean },\n  ): Promise<KeyvStoredData<Value> | Array<KeyvStoredData<Value>>> {\n    if (Array.isArray(key)) {\n      return await this.getMany(key, options)\n    }\n    const localResult = (await this.local.get(key, options)) as KeyvStoredData<Value>\n\n    if (localResult === undefined || !this.opts.validator(localResult, key)) {\n      const remoteResult = await this.remote.get(key, options)\n\n      if (remoteResult !== localResult) {\n        const value = (\n          !!remoteResult\n            ? typeof remoteResult === 'object' && 'value' in remoteResult\n              ? remoteResult.value\n              : remoteResult\n            : undefined\n        ) as Value\n        const ttl =\n          !!remoteResult &&\n          typeof remoteResult === 'object' &&\n          'expires' in remoteResult &&\n          remoteResult.expires\n            ? remoteResult.expires - Date.now()\n            : undefined\n        if (!ttl || ttl > 0) {\n          await this.local.set(key, value, ttl)\n        } else {\n          this.local.delete(key)\n        }\n      }\n      return remoteResult\n    }\n\n    return localResult\n  }\n\n  async getMany(keys: string[], options?: { raw?: boolean }): Promise<Array<KeyvStoredData<Value>>> {\n    const promises: Array<Promise<KeyvStoredData<Value>>> = []\n    for (const key of keys) {\n      promises.push(this.get(key, options) as Promise<KeyvStoredData<Value>>)\n    }\n\n    const values = await Promise.all(promises)\n    const data: Array<KeyvStoredData<Value>> | undefined = []\n    for (const value of values) {\n      data.push(value as KeyvStoredData<Value>)\n    }\n    return data\n  }\n\n  async set(key: string, value: any, ttl?: number) {\n    const toSet: KeyvTieredIndex[] = ['local', 'remote']\n    return Promise.all(toSet.map(async (store) => this[store].set(key, value, ttl)))\n  }\n\n  async clear(): Promise<undefined> {\n    const toClear: KeyvTieredIndex[] = ['local']\n    if (!this.opts.localOnly) {\n      toClear.push('remote')\n    }\n\n    await Promise.all(toClear.map(async (store) => this[store].clear()))\n\n    return undefined\n  }\n\n  async delete(key: string): Promise<boolean> {\n    const toDelete: KeyvTieredIndex[] = ['local']\n    if (!this.opts.localOnly) {\n      toDelete.push('remote')\n    }\n\n    const deleted = await Promise.all(toDelete.map(async (store) => this[store].delete(key)))\n\n    return deleted.every(Boolean)\n  }\n\n  async deleteMany(keys: string[]): Promise<boolean> {\n    const promises = []\n    for (const key of keys) {\n      promises.push(this.delete(key))\n    }\n\n    const values = await Promise.all(promises)\n\n    return values.every(Boolean)\n  }\n\n  async has(key: string): Promise<boolean> {\n    let response\n    if (typeof this.local.has === 'function') {\n      response = this.local.has(key)\n    } else {\n      const value = await this.local.get(key)\n      response = value !== undefined\n    }\n    if (!response || !this.opts.validator(response, key)) {\n      if (typeof this.remote.has === 'function') {\n        response = this.remote.has(key)\n      } else {\n        const value = await this.remote.get(key)\n        response = value !== undefined\n      }\n    }\n    return response\n  }\n\n  async *iterator(namespace?: string): AsyncGenerator<any, void, any> {\n    const limit = Number.parseInt(this.iterationLimit as string, 10) || 10\n    this.remote.opts.iterationLimit = limit\n    if (this.remote && typeof this.remote.iterator === 'function') {\n      for await (const entries of this.remote.iterator(namespace)) {\n        yield entries\n      }\n    }\n  }\n}\n\nfunction isMap(map: any) {\n  if (map instanceof Map) {\n    return true\n  } else if (\n    map &&\n    typeof map.clear === 'function' &&\n    typeof map.delete === 'function' &&\n    typeof map.get === 'function' &&\n    typeof map.has === 'function' &&\n    typeof map.set === 'function'\n  ) {\n    return true\n  }\n\n  return false\n}\n"
  },
  {
    "path": "packages/kv-store/src/store-adapters/tiered/types.ts",
    "content": "import { IKeyValueStoreAdapter } from '../../key-value-types.js'\n\nexport type Options<ValueType> = {\n  local: IKeyValueStoreAdapter<ValueType> | Map<string, ValueType>\n  remote: IKeyValueStoreAdapter<ValueType> | Map<string, ValueType>\n  localOnly?: boolean\n  iterationLimit?: number | string\n}\n\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport type Options_ = {\n  validator: (value: any, key: string) => boolean\n  dialect: string\n  iterationLimit?: number | string\n  localOnly?: boolean\n}\n"
  },
  {
    "path": "packages/kv-store/src/store-adapters/typeorm/entities/keyValueStoreEntity.ts",
    "content": "import { BaseEntity, Column, Entity, PrimaryColumn } from 'typeorm'\n\n/**\n *\n * @beta This API may change without a BREAKING CHANGE notice.\n */\n@Entity('keyvaluestore')\nexport class KeyValueStoreEntity extends BaseEntity {\n  @PrimaryColumn()\n  // @ts-ignore\n  key: string\n\n  @Column({\n    type: 'text',\n  })\n  // @ts-ignore\n  data: string\n\n  expires?: number\n}\n"
  },
  {
    "path": "packages/kv-store/src/store-adapters/typeorm/index.ts",
    "content": "import { EventEmitter } from 'events'\nimport { OrPromise } from '@veramo/utils'\nimport { DataSource, In, Like } from 'typeorm'\nimport { KeyValueStoreEntity } from './entities/keyValueStoreEntity.js'\nimport { KeyValueTypeORMOptions, Options_ } from './types.js'\nimport { KeyvStore, KeyvStoredData } from '../../keyv/keyv-types.js'\nimport { IKeyValueStoreAdapter } from '../../key-value-types.js'\nimport JSONB from 'json-buffer'\n\nexport { KeyValueTypeORMOptions } from './types.js'\n\n/**\n * Entities used by the TypeORM key value store adapter\n * @beta\n */\nexport const Entities = [KeyValueStoreEntity]\n\n/**\n * TypeORM based key value store adapter\n * @beta\n */\nexport class KeyValueTypeORMStoreAdapter\n  extends EventEmitter\n  implements KeyvStore<string>, IKeyValueStoreAdapter<string>\n{\n  private readonly dbConnection: OrPromise<DataSource>\n  readonly namespace: string\n  opts: Options_<string>\n\n  constructor(options: KeyValueTypeORMOptions) {\n    super()\n    this.dbConnection = options.dbConnection\n    this.namespace = options.namespace || 'keyv'\n    this.opts = {\n      validator: () => true,\n      dialect: 'typeorm',\n      serialize: JSONB.stringify,\n      deserialize: JSONB.parse,\n      ...options,\n    }\n  }\n\n  async get(\n    key: string | string[],\n    options?: { raw?: boolean },\n  ): Promise<KeyvStoredData<string> | Array<KeyvStoredData<string>>> {\n    if (Array.isArray(key)) {\n      return this.getMany(key, options)\n    }\n    const connection = await _getConnectedDb(this.dbConnection)\n    const result = await connection.getRepository(KeyValueStoreEntity).findOneBy({\n      key,\n    })\n    return options?.raw !== true || !result ? result?.data : { value: result?.data, expires: result?.expires }\n  }\n\n  async *iterator(namespace?: string) {\n    const limit = 10 // NOTE: return 10 entries at a time\n    async function* iterate(\n      offset: number,\n      options: Options_<string>,\n      db: OrPromise<DataSource>,\n    ): AsyncGenerator<any, void> {\n      const connection = await _getConnectedDb(db)\n      const entries = await connection.getRepository(KeyValueStoreEntity).find({\n        where: {\n          key: Like(`${namespace ? namespace + ':' : ''}%`),\n        },\n        take: limit,\n        skip: offset,\n      })\n\n      for (const entry of entries) {\n        yield [entry.key, entry.data]\n      }\n\n      if (entries.length === limit) {\n        offset += limit\n        yield* iterate(offset, options, db)\n      }\n    }\n\n    yield* iterate(0, this.opts, this.dbConnection)\n  }\n\n  async getMany(keys: string[], options?: { raw?: boolean }): Promise<Array<KeyvStoredData<string>>> {\n    const connection = await _getConnectedDb(this.dbConnection)\n    const results = await connection.getRepository(KeyValueStoreEntity).findBy({\n      key: In(keys),\n    })\n    const values = keys.map(async (key) => {\n      const result = results.find((result) => result.key === key)\n      return options?.raw !== true || !result\n        ? (result?.data as KeyvStoredData<string>)\n        : ({\n            value: result?.data ? (await this.opts.deserialize(result.data))?.value : undefined,\n            expires: result?.expires,\n          } as KeyvStoredData<string>)\n    })\n\n    return Promise.all(values)\n  }\n\n  async set(key: string, value: string, ttl?: number): Promise<KeyvStoredData<string>> {\n    const connection = await _getConnectedDb(this.dbConnection)\n    const entity = new KeyValueStoreEntity()\n    entity.key = key\n    entity.data = value\n    entity.expires = ttl\n    await connection.getRepository(KeyValueStoreEntity).save(entity)\n    return { value: value, expires: ttl }\n  }\n\n  async delete(key: string | string[]): Promise<boolean> {\n    if (Array.isArray(key)) {\n      return this.deleteMany(key)\n    }\n    const connection = await _getConnectedDb(this.dbConnection)\n    const result = await connection.getRepository(KeyValueStoreEntity).delete({ key })\n    return result.affected === 1\n  }\n\n  async deleteMany(keys: string[]): Promise<boolean> {\n    const connection = await _getConnectedDb(this.dbConnection)\n    const results = await connection.getRepository(KeyValueStoreEntity).delete({\n      key: In(keys),\n    })\n    return !!results.affected && results.affected >= 1\n  }\n\n  async clear(): Promise<void> {\n    const connection = await _getConnectedDb(this.dbConnection)\n    await connection.getRepository(KeyValueStoreEntity).delete({\n      key: Like(`${this.namespace}:%`),\n    })\n  }\n\n  async has(key: string): Promise<boolean> {\n    const connection = await _getConnectedDb(this.dbConnection)\n    const result = await connection.getRepository(KeyValueStoreEntity).countBy({\n      key,\n    })\n    return result === 1\n  }\n\n  async disconnect(): Promise<void> {\n    const connection = await _getConnectedDb(this.dbConnection)\n    connection.destroy()\n  }\n}\n\n/**\n *  Ensures that the provided DataSource is connected.\n *\n * @param dbConnection - a TypeORM DataSource or a Promise that resolves to a DataSource\n * @internal\n */\nexport async function _getConnectedDb(dbConnection: OrPromise<DataSource>): Promise<DataSource> {\n  if (dbConnection instanceof Promise) {\n    return await dbConnection\n  } else if (!dbConnection.isInitialized) {\n    return await (<DataSource>dbConnection).initialize()\n  } else {\n    return dbConnection\n  }\n}\n"
  },
  {
    "path": "packages/kv-store/src/store-adapters/typeorm/migrations/1.createKVDatabase.ts",
    "content": "import { MigrationInterface, QueryRunner, Table } from 'typeorm'\nimport Debug from 'debug'\nconst debug = Debug('veramo:data-store:initial-migration')\n\n/**\n * Create the database layout for Veramo 3.0\n *\n * @public\n */\nexport class CreateKVDatabaseMigration implements MigrationInterface {\n  private readonly _tableName: string\n  readonly name: string\n\n  constructor(tableName?: string) {\n    this._tableName = tableName || 'keyvaluestore'\n    this.name = `CreateKVDatabase${tableName}1680297189001`\n  }\n\n  async up(queryRunner: QueryRunner): Promise<void> {\n    function getTableName(givenName: string): string {\n      return (\n        queryRunner.connection.entityMetadatas.find((meta) => meta.givenTableName === givenName)?.tableName ||\n        givenName\n      )\n    }\n\n    debug(`creating ${this._tableName} table`)\n    // CREATE TABLE \"keyvaluestore\" (\"key\" varchar PRIMARY KEY NOT NULL, \"data\" text NOT NULL)\n    await queryRunner.createTable(\n      new Table({\n        name: getTableName(this._tableName),\n        columns: [\n          { name: 'key', type: 'varchar', isPrimary: true },\n          { name: 'data', type: 'text', isNullable: false },\n        ],\n        indices: [\n          {\n            columnNames: ['key'],\n            isUnique: true,\n          },\n        ],\n      }),\n      true,\n    )\n  }\n\n  async down(queryRunner: QueryRunner): Promise<void> {\n    throw new Error('illegal_operation: cannot roll back initial migration')\n  }\n}\n"
  },
  {
    "path": "packages/kv-store/src/store-adapters/typeorm/migrations/index.ts",
    "content": "import { CreateKVDatabaseMigration } from './1.createKVDatabase.js'\n\n/**\n * The migrations array that SHOULD be used when initializing a TypeORM database connection.\n *\n * These ensure the correct creation of tables and the proper migrations of data when tables change between versions.\n *\n * @public\n */\nexport const kvStoreMigrations = [CreateKVDatabaseMigration]\n"
  },
  {
    "path": "packages/kv-store/src/store-adapters/typeorm/types.ts",
    "content": "import { OrPromise } from '@veramo/utils'\nimport { DataSource } from 'typeorm'\nimport { KeyvDeserializedData } from '../../keyv/keyv-types.js'\n\n/**\n * @public\n */\nexport type KeyValueTypeORMOptions = {\n  dbConnection: OrPromise<DataSource>\n\n  namespace?: string\n}\n\n/**\n * Internal options for the TypeORM adapter\n *  @internal\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport type Options_<Value> = {\n  validator: (value: any, key: string) => boolean\n  dialect: string\n  serialize: (data: KeyvDeserializedData<Value>) => OrPromise<string | undefined>\n  /** A custom deserialization function. */\n  deserialize: (data: any) => OrPromise<KeyvDeserializedData<Value> | undefined>\n}\n"
  },
  {
    "path": "packages/kv-store/tsconfig.json",
    "content": "{\n  \"extends\": \"../tsconfig.settings.json\",\n  \"compilerOptions\": {\n    \"esModuleInterop\": true,\n    \"rootDir\": \"src\",\n    \"outDir\": \"build\",\n    \"declarationDir\": \"build\",\n    \"skipLibCheck\": true,\n    \"strictFunctionTypes\": false,\n    \"types\": [\"node\"]\n  },\n  \"references\": [\n    {\n      \"path\": \"../core-types\"\n    },\n    {\n      \"path\": \"../utils\"\n    }\n  ]\n}\n"
  },
  {
    "path": "packages/mediation-manager/CHANGELOG.md",
    "content": "# Change Log\n\nAll notable changes to this project will be documented in this file.\nSee [Conventional Commits](https://conventionalcommits.org) for commit guidelines.\n\n# [7.0.0](https://github.com/decentralized-identity/veramo/compare/v6.0.2...v7.0.0) (2026-02-11)\n\n\n### Bug Fixes\n\n* **deps:** update dependency uuid to v11 ([#1431](https://github.com/decentralized-identity/veramo/issues/1431)) ([6ad84d9](https://github.com/decentralized-identity/veramo/commit/6ad84d91f02794e741e4b770e29e1ee9a93edcfb))\n* **deps:** update devdeps and bump typeorm to 0.3.20 ([#1272](https://github.com/decentralized-identity/veramo/issues/1272)) ([7d17f37](https://github.com/decentralized-identity/veramo/commit/7d17f37ea7cc4e73a8cdae028681ae1be5c4d11c))\n\n\n### Features\n\n* **credential-w3c:** remove hardcoded proof formats ([#1395](https://github.com/decentralized-identity/veramo/issues/1395)) ([5b7d3fa](https://github.com/decentralized-identity/veramo/commit/5b7d3fad7d2ada4954f8020a6474df13d9fe51dc))\n\n\n### BREAKING CHANGES\n\n* **credential-w3c:** The credential plugins specializing in JSON-LD / EIP712 are no longer top level veramo plugins but are now managed by the `@veramo/credential-w3c` plugin which will be able to use multiple proof formats and multiplex accordingly. The constructor for the `CredentialPlugin` has changed to accept different implementations of proof formats.\n\n\n\n\n\n## [6.0.2](https://github.com/decentralized-identity/veramo/compare/v6.0.1...v6.0.2) (2026-01-16)\n\n**Note:** Version bump only for package @veramo/mediation-manager\n\n\n\n\n\n## [6.0.1](https://github.com/decentralized-identity/veramo/compare/v6.0.0...v6.0.1) (2026-01-16)\n\n**Note:** Version bump only for package @veramo/mediation-manager\n\n\n\n\n\n# [6.0.0](https://github.com/decentralized-identity/veramo/compare/v5.6.0...v6.0.0) (2024-04-02)\n\n\n### Bug Fixes\n\n* **did-provider-key:** align did:key resolver to spec ([#1332](https://github.com/decentralized-identity/veramo/issues/1332)) ([8e3b94c](https://github.com/decentralized-identity/veramo/commit/8e3b94cf997619d7adcb5cb8827e0f55ff88cdb5)), closes [#1330](https://github.com/decentralized-identity/veramo/issues/1330)\n\n\n\n\n\n# [5.6.0](https://github.com/decentralized-identity/veramo/compare/v5.5.3...v5.6.0) (2024-01-16)\n\n\n### Features\n\n* **remote-client:** allow dynamic headers param for AgentRestClient constructor ([#1314](https://github.com/decentralized-identity/veramo/issues/1314)) ([1b8a0a2](https://github.com/decentralized-identity/veramo/commit/1b8a0a2718dd63492ad3a312a6ebe5f6e7849935)), closes [#1313](https://github.com/decentralized-identity/veramo/issues/1313)\n"
  },
  {
    "path": "packages/mediation-manager/LICENSE",
    "content": "                                 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 2023 Radley E. Sidwell-Lewis\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"
  },
  {
    "path": "packages/mediation-manager/README.md",
    "content": "# Veramo: Mediation Manager Plugin\n\nA plugin for the Veramo agent for integration with the DIDComm plugin when implementing mediation to the [Cooordinate Mediation V3 Specification](https://didcomm.org/coordinate-mediation/3.0/).  \n\n## Overview\n\nThe Mediation Manager plugin enables the Coordinate Mediation V3 Specification in the `did-comm` plugin. There are three distinct stores which represent the three phases of mediation setup as well as a global policy of how requests for mediation should be dealt with. \n\n0. **Mediation Grant Policy**\n\nBy default, the `isMediateGrantAll` policy is set to `true` meaning that any requests for mediation will be `GRANTED` unless their `did` is listed in the `preRequestPolicyStore` as `ALLOW`. Conversely, if the `isMediateGrantAll` policy is set to `false`, all requests will be allowed, unless they are listed in the `preRequestPolicyStore` as `ALLOW`.\n\n1. **Pre-Mediation Policy Store**\n\nThis store includes RequesterDid's as a key and stores an associated policy of `ALLOW` or `DENY`.\n\n2. **Mediation Response Store**\n\nAny request for mediation results in either a `GRANTED` or `DENIED` outcome. This is recorded in the `MediationResponseStore` with the `key=requester-did` and the value of `GRANTED` or `DENIED`.\n\n3. **Recipient DID Store**\n\nFinally, once a requester has been granted mediation, they need to inform the mediator of any dids in use (including their requester did or in other words the did they used to request mediation) by using the update recipient did message type.\n\n**CLI Mediate**\n\nFor the purpose of managing `ALLOW` or `DENY` pre-mediation policies, as well as listing responses to mediation requests, a cli tool for mediation is available. See:\n\n```bash\nveramo mediate -h\n```\n\n## Configuration\n\nThe Mediation Manager Plugin can be used via the `agent.yml` or programatically injected in to the DIDComm plugin. \n\n## example agent.yml configuration\n\n`agent.yml` example configuration for the `mediationManager` plugin below:\n\n#### Step 1. Update the `dbConnection` in your `agent.yml`\n\n> NOTE! this is required to include the kv-store migrations and entities so that the stores required by the mediationManager (in the next step) are available.\n\n```yml\n# Database\n\ndbConnection:\n  $require: typeorm#DataSource\n  $args:\n    - type: sqlite\n      database:\n        $ref: /constants/databaseFile\n      synchronize: false\n      migrationsRun: true\n      migrations:\n        $require: '@veramo/data-store?t=function#migrationConcat'\n        $args:\n          - $require: '@veramo/data-store?t=object#migrations'\n          - $require: '@veramo/kv-store?t=object#kvStoreMigrations'\n      logging: false\n      entities:\n        $require: '@veramo/data-store?t=function#entitiesConcat'\n        $args:\n          - $require: '@veramo/data-store?t=object#Entities'\n          - $require: '@veramo/kv-store?t=object#Entities'\n```\n\n#### Step 2. Configure your Mediation Manager Plugin\n\n> NOTE! each store MUST have a unique namespace so as to prevent conflicts. Each stage of the mediation setup has its own accompanying store.  \n\n```yml\n# Mediation Manager plugin\n\nmediationManager:\n  $require: '@veramo/mediation-manager#MediationManagerPlugin'\n  $args:\n    - isDefaultMediateGrantAll: true\n    - policyStore: \n      $require: '@veramo/kv-store#KeyValueStore'\n      $args:\n          - namespace: 'mediation_policy'\n            store:\n              $require: '@veramo/kv-store#KeyValueTypeORMStoreAdapter'\n              $args:\n              - options:\n                dbConnection:\n                  $ref: /dbConnection\n    - mediationStore:\n      $require: '@veramo/kv-store#KeyValueStore'\n      $args:\n          - namespace: 'mediation'\n            store:\n              $require: '@veramo/kv-store#KeyValueTypeORMStoreAdapter'\n              $args:\n              - options:\n                dbConnection:\n                  $ref: /dbConnection\n    - recipientDidStore:\n      $require: '@veramo/kv-store#KeyValueStore'\n      $args:\n          - namespace: 'recipient_did'\n            store:\n              $require: '@veramo/kv-store#KeyValueTypeORMStoreAdapter'\n              $args:\n              - options:\n                dbConnection:\n                  $ref: /dbConnection\n```\n\n#### Step 3. Include the `mediationManager` above in your agent's plugins\n\n```yml\n# Agent\n\nagent:\n  $require: '@veramo/core#Agent'\n  $args:\n    - schemaValidation: false\n      plugins:\n        - $ref: /keyManager\n        - $ref: /didManager\n        - $ref: /didResolver\n        - $ref: /didDiscovery\n        - $ref: /messageHandler\n        - $ref: /mediationManager # <<<< include your mediationManager plugin here\n        - $require: '@veramo/did-comm#DIDComm'\n        - $require: '@veramo/credential-w3c#CredentialPlugin'\n          $args:\n            - issuers:\n              - $ref: /CredentialProviderLD\n              - $ref: /CredentialProviderJWT\n        - $require: '@veramo/selective-disclosure#SelectiveDisclosure'\n        - $require: '@veramo/data-store#DataStore'\n          $args:\n            - $ref: /dbConnection\n        - $require: '@veramo/data-store#DataStoreORM'\n          $args:\n            - $ref: /dbConnection\n```\n\n## Example TypeScript Configuration\n\n```typescript\nimport {\n  KeyValueStore,\n  KeyValueTypeORMStoreAdapter,\n  Entities as KVStoreEntities,\n  kvStoreMigrations,\n} from '@veramo/kv-store'\nimport { DataSource } from 'typeorm'\n\nconst dbConnection = new DataSource({\n  name: 'test',\n  type: 'sqlite',\n  database: ':memory:',\n  synchronize: false,\n  migrations: dataStoreMigrations.concat(kvStoreMigrations),\n  migrationsRun: true,\n  logging: false,\n  entities: (KVStoreEntities as any).concat(DataStoreEntities),\n})\n\nconst policyStore = new KeyValueStore<PreMediationRequestPolicy>({\n  namespace: 'mediation_policy',\n  store: new KeyValueTypeORMStoreAdapter({ dbConnection, namespace: 'mediation_policy' }),\n})\nconst mediationStore = new KeyValueStore<MediationResponse>({\n  namespace: 'mediation_response',\n  store: new KeyValueTypeORMStoreAdapter({ dbConnection, namespace: 'mediation_response' }),\n})\n\nconst recipientDidStore = new KeyValueStore<RequesterDid>({\n  namespace: 'recipient_did',\n  store: new KeyValueTypeORMStoreAdapter({ dbConnection, namespace: 'recipient_did' }),\n})\n\nconst isDefaultMediateGrantAll = true;\nconst mediationManager = new MediationManagerPlugin(\n  isDefaultMediateGrantAll,\n  policyStore,\n  mediationStore,\n  recipientDidStore\n)\n\nconst agent = createAgent({\n  plugins: [\n    // other plugins go here\n    mediationManager\n  ],\n})\n```\n"
  },
  {
    "path": "packages/mediation-manager/api-extractor.json",
    "content": "{\n  \"$schema\": \"https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json\",\n  \"apiReport\": {\n    \"enabled\": true,\n    \"reportFolder\": \"./api\",\n    \"reportTempFolder\": \"./api\"\n  },\n  \"docModel\": {\n    \"enabled\": true,\n    \"apiJsonFilePath\": \"./api/<unscopedPackageName>.api.json\"\n  },\n  \"dtsRollup\": {\n    \"enabled\": false\n  },\n  \"mainEntryPointFilePath\": \"<projectFolder>/build/index.d.ts\"\n}\n"
  },
  {
    "path": "packages/mediation-manager/package.json",
    "content": "{\n  \"name\": \"@veramo/mediation-manager\",\n  \"description\": \"Mediation Manager Plugin for Veramo\",\n  \"version\": \"7.0.0\",\n  \"main\": \"build/index.js\",\n  \"exports\": \"./build/index.js\",\n  \"types\": \"build/index.d.ts\",\n  \"scripts\": {\n    \"build\": \"tsc\",\n    \"test\": \"jest --config=../../jest.config.mjs\",\n    \"test:ci\": \"jest --config=../../jest.config.mjs\",\n    \"extract-api\": \"node ../cli/bin/veramo.js dev extract-api\"\n  },\n  \"dependencies\": {\n    \"@veramo/core-types\": \"workspace:^\",\n    \"@veramo/kv-store\": \"workspace:^\",\n    \"debug\": \"^4.3.4\",\n    \"uuid\": \"^11.0.0\"\n  },\n  \"devDependencies\": {\n    \"eslint\": \"8.57.1\",\n    \"eslint-plugin-promise\": \"6.6.0\",\n    \"timekeeper\": \"2.3.1\",\n    \"typescript\": \"5.7.3\"\n  },\n  \"files\": [\n    \"build/**/*\",\n    \"src/**/*\",\n    \"README.md\",\n    \"LICENSE\"\n  ],\n  \"publishConfig\": {\n    \"access\": \"public\"\n  },\n  \"repository\": {\n    \"type\": \"git\",\n    \"url\": \"https://github.com/decentralized-identity/veramo.git\",\n    \"directory\": \"packages/mediation-manager\"\n  },\n  \"author\": \"Radley Sidwell-Lewis <radley.lewis@gmail.com>\",\n  \"contributors\": [\n    \"Paul Desmond Parker <pauldesmondparker@gmail.com>\",\n    \"Mircea Nistor <mircea.nistor@mesh.xyz>\"\n  ],\n  \"keywords\": [\n    \"Veramo\",\n    \"mediation-manager\",\n    \"veramo-plugin\"\n  ],\n  \"license\": \"Apache-2.0\",\n  \"type\": \"module\",\n  \"moduleDirectories\": [\n    \"node_modules\",\n    \"src\"\n  ]\n}\n"
  },
  {
    "path": "packages/mediation-manager/src/index.ts",
    "content": "/**\n * Provides a {@link @veramo/mediation-manager#MediationManager | plugin} for the\n * {@link @veramo/core#Agent} that implements the {@link @veramo/mediation-manager#IMediationManager} interface.\n *\n * @packageDocumentation\n */\nexport { MediationManagerPlugin } from './mediation-manager.js'\nexport * from './types/IMediationManager.js'\n"
  },
  {
    "path": "packages/mediation-manager/src/mediation-manager.ts",
    "content": "import type {\n  PreMediationRequestPolicy,\n  IMediationManagerSaveMediationPolicyArgs,\n  IMediationManagerRemoveMediationPolicyArgs,\n  IMediationManagerGetMediationPolicyArgs,\n  IMediationManager,\n  IMediationGetArgs,\n  MediationResponse,\n  RequesterDid,\n  IMediationManagerSaveMediationArgs,\n  IMediationManagerRecipientDidArgs,\n  IMediationManagerAddRecipientDidArgs,\n  RecipientDid,\n  IMediationManagerListRecipientDidsArgs,\n} from './types/IMediationManager.js'\nimport type { IAgentPlugin } from '@veramo/core-types'\nimport type { KeyValueStore } from '@veramo/kv-store'\n\ntype PreRequestPolicyStore = KeyValueStore<PreMediationRequestPolicy>\ntype MediationResponseStore = KeyValueStore<MediationResponse>\ntype RecipientDidStore = KeyValueStore<RequesterDid>\n\n/**\n * Mediation Manager Plugin for {@link @veramo/core#Agent}\n *\n * This plugin exposes methods pertaining to the {@link @veramo/core-types#IMediationManager} interface.\n *\n * @remarks be advised that the {@link @veramo/mediation-manager#IMediationManager} interface is for use with\n * {@link @veramo/did-comm#DIDComm | DIDCOmm} and specifically the V3 Coordinate Mediation Protocol implementation.\n *\n * @beta This API may change without a BREAKING CHANGE notice.\n */\nexport class MediationManagerPlugin implements IAgentPlugin {\n  private readonly preRequestPolicyStore: KeyValueStore<PreMediationRequestPolicy>\n  private readonly mediationResponseStore: KeyValueStore<MediationResponse>\n  private readonly recipientDidStore: KeyValueStore<RequesterDid>\n  readonly methods: IMediationManager\n\n  constructor(\n    isMediateDefaultGrantAll = true,\n    preRequestPolicyStore: PreRequestPolicyStore,\n    mediationResponseStore: MediationResponseStore,\n    recipientDidStore: RecipientDidStore,\n  ) {\n    this.preRequestPolicyStore = preRequestPolicyStore\n    this.mediationResponseStore = mediationResponseStore\n    this.recipientDidStore = recipientDidStore\n    this.methods = {\n      isMediateDefaultGrantAll: () => Promise.resolve(isMediateDefaultGrantAll),\n      /* Mediation Policy Methods */\n      mediationManagerSaveMediationPolicy: this.mediationManagerSaveMediationPolicy.bind(this),\n      mediationManagerRemoveMediationPolicy: this.mediationManagerRemoveMediationPolicy.bind(this),\n      mediationManagerGetMediationPolicy: this.mediationManagerGetMediationPolicy.bind(this),\n      mediationManagerListMediationPolicies: this.mediationManagerListMediationPolicies.bind(this),\n      /* Mediation Methods */\n      mediationManagerSaveMediation: this.mediationManagerSaveMediation.bind(this),\n      mediationManagerGetMediation: this.mediationManagerGetMediation.bind(this),\n      mediationManagerRemoveMediation: this.mediationManagerRemoveMediation.bind(this),\n      mediationManagerGetAllMediations: this.mediationManagerGetAllMediations.bind(this),\n      /* Recipient Did Methods */\n      mediationManagerAddRecipientDid: this.mediationManagerAddRecipientDid.bind(this),\n      mediationManagerRemoveRecipientDid: this.mediationManagerRemoveRecipientDid.bind(this),\n      mediationManagerGetRecipientDid: this.mediationManagerGetRecipientDid.bind(this),\n      mediationManagerListRecipientDids: this.mediationManagerListRecipientDids.bind(this),\n      mediationManagerIsMediationGranted: this.mediationManagerIsMediationGranted.bind(this),\n    }\n  }\n\n  public async mediationManagerSaveMediationPolicy({\n    requesterDid,\n    policy,\n  }: IMediationManagerSaveMediationPolicyArgs): Promise<RequesterDid> {\n    const res = await this.preRequestPolicyStore.set(requesterDid, policy)\n    if (!res || !res.value) throw new Error('mediation_manager: failed to save mediation policy')\n    return requesterDid\n  }\n\n  public async mediationManagerRemoveMediationPolicy({\n    requesterDid,\n  }: IMediationManagerRemoveMediationPolicyArgs): Promise<boolean> {\n    return await this.preRequestPolicyStore.delete(requesterDid)\n  }\n\n  public async mediationManagerGetMediationPolicy({\n    requesterDid,\n  }: IMediationManagerGetMediationPolicyArgs): Promise<PreMediationRequestPolicy | null> {\n    return (await this.preRequestPolicyStore.get(requesterDid)) || null\n  }\n\n  public async mediationManagerListMediationPolicies(): Promise<Record<string, PreMediationRequestPolicy>> {\n    const policies: Record<string, PreMediationRequestPolicy> = {}\n    for await (const [requesterDid, policy] of this.preRequestPolicyStore.getIterator()) {\n      policies[requesterDid] = policy\n    }\n    return policies\n  }\n\n  public async mediationManagerGetMediation({\n    requesterDid,\n  }: IMediationGetArgs): Promise<MediationResponse | null> {\n    return (await this.mediationResponseStore.get(requesterDid)) || null\n  }\n\n  public async mediationManagerSaveMediation({\n    requesterDid,\n    status,\n  }: IMediationManagerSaveMediationArgs): Promise<MediationResponse> {\n    const res = await this.mediationResponseStore.set(requesterDid, status)\n    if (!res.value) throw new Error('mediation_manager: failed to save mediation')\n    return res.value\n  }\n\n  public async mediationManagerRemoveMediation({ requesterDid }: IMediationGetArgs): Promise<boolean> {\n    return await this.mediationResponseStore.delete(requesterDid)\n  }\n\n  public async mediationManagerGetAllMediations(): Promise<Record<string, MediationResponse>> {\n    const mediationResponses: Record<string, MediationResponse> = {}\n    for await (const [requesterDid, response] of this.mediationResponseStore.getIterator()) {\n      mediationResponses[requesterDid] = response\n    }\n    return mediationResponses\n  }\n\n  public async mediationManagerAddRecipientDid({\n    recipientDid,\n    requesterDid,\n  }: IMediationManagerAddRecipientDidArgs): Promise<RequesterDid> {\n    const addResult = await this.recipientDidStore.set(recipientDid, requesterDid)\n    if (!addResult || !addResult.value) throw new Error('mediation_manager: failed to add recipient did')\n    return addResult.value\n  }\n\n  public async mediationManagerRemoveRecipientDid({\n    recipientDid,\n  }: IMediationManagerRecipientDidArgs): Promise<boolean> {\n    return await this.recipientDidStore.delete(recipientDid)\n  }\n\n  public async mediationManagerGetRecipientDid({\n    recipientDid,\n  }: IMediationManagerRecipientDidArgs): Promise<RequesterDid | null> {\n    return (await this.recipientDidStore.get(recipientDid)) || null\n  }\n\n  public async mediationManagerListRecipientDids({\n    requesterDid,\n  }: IMediationManagerListRecipientDidsArgs): Promise<RecipientDid[]> {\n    const recipientDids: RecipientDid[] = []\n    for await (const [recipientDid, did] of this.recipientDidStore.getIterator()) {\n      if (did === requesterDid) recipientDids.push(recipientDid)\n    }\n    return recipientDids\n  }\n\n  public async mediationManagerIsMediationGranted({\n    recipientDid,\n  }: IMediationManagerRecipientDidArgs): Promise<boolean> {\n    return !!(await this.recipientDidStore.get(recipientDid))\n  }\n}\n"
  },
  {
    "path": "packages/mediation-manager/src/types/IMediationManager.ts",
    "content": "import { IPluginMethodMap } from '@veramo/core-types'\n\n/**\n * The input to the {@link IMediationManager.mediationManagerSaveMediationPolicy} method.\n *\n * @beta This API may change without a BREAKING CHANGE notice.\n */\nexport interface IMediationManagerSaveMediationPolicyArgs {\n  requesterDid: RequesterDid\n  policy: PreMediationRequestPolicy\n}\n\n/**\n * The input to the {@link IMediationManager.mediationManagerRemoveMediationPolicy} method.\n *\n * @beta This API may change without a BREAKING CHANGE notice.\n */\nexport interface IMediationManagerRemoveMediationPolicyArgs {\n  requesterDid: RequesterDid\n}\n\n/**\n * The input to the {@link IMediationManager.mediationManagerListRecipientDids} method.\n *\n * @beta This API may change without a BREAKING CHANGE notice.\n */\nexport interface IMediationManagerListRecipientDidsArgs {\n  requesterDid: RequesterDid\n}\n\n/**\n * The input to the {@link IMediationManager.mediationManagerGetMediationPolicy} method.\n *\n * @beta This API may change without a BREAKING CHANGE notice.\n */\nexport interface IMediationManagerGetMediationPolicyArgs {\n  requesterDid: RequesterDid\n}\n\n/**\n * The input to the {@link IMediationManager.mediationManagerGetMediation} method.\n *\n * @beta This API may change without a BREAKING CHANGE notice.\n */\nexport interface IMediationGetArgs {\n  requesterDid: RequesterDid\n}\n\n/**\n * The input to the {@link IMediationManager.mediationManagerSaveMediation} method.\n *\n * @beta This API may change without a BREAKING CHANGE notice.\n */\nexport interface IMediationManagerSaveMediationArgs {\n  requesterDid: RequesterDid\n  status: MediationResponse\n}\n\n/**\n * The input to the {@link IMediationManager.mediationManagerAddRecipientDid} method.\n *\n * @beta This API may change without a BREAKING CHANGE notice.\n */\nexport interface IMediationManagerAddRecipientDidArgs {\n  recipientDid: RecipientDid\n  requesterDid: RequesterDid\n}\n\n/**\n * The input to the {@link IMediationManager.mediationManagerGetRecipientDid} method.\n *\n * @beta This API may change without a BREAKING CHANGE notice.\n */\nexport interface IMediationManagerRecipientDidArgs {\n  recipientDid: RecipientDid\n}\n\n/**\n * A string representing the Recipient Did\n *\n * @beta This API may change without a BREAKING CHANGE notice.\n */\nexport type RecipientDid = string\n\n/**\n * A string representing the Requester Did\n *\n * @beta This API may change without a BREAKING CHANGE notice.\n */\nexport type RequesterDid = string\n\n/**\n * Can be \"ALLOW\" or \"DENY\" and is used to determine whether a mediation request for a specific {@link RequesterDid} should be ALLOW or DENY.\n *\n * @beta This API may change without a BREAKING CHANGE notice.\n */\nexport type PreMediationRequestPolicy = 'ALLOW' | 'DENY'\n\n/**\n * Can be \"GRANTED\" or \"DENIED\" and is used to record whether a mediation response for a specific {@link RequesterDid} has been granted or denied.\n *\n * @beta This API may change without a BREAKING CHANGE notice.\n */\nexport type MediationResponse = 'GRANTED' | 'DENIED'\n\n/**\n * An object of keys and their associated {@link PreMediationRequestPolicy}\n *\n * @beta This API may change without a BREAKING CHANGE notice.\n */\nexport type Mediations = Record<RequesterDid, MediationResponse>\n\n/**\n * MediationManager plugin interface for {@link @veramo/core#Agent}\n *\n * @beta This API may change without a BREAKING CHANGE notice.\n */\nexport interface IMediationManager extends IPluginMethodMap {\n  /**\n   * Returns a boolean indicating whether the agent is configured to \"ALLOW\" or \"DENY\" all mediation requests\n   * as the default policy.\n   *\n   * @returns - a Promise that resolves to a boolean\n   *\n   * @beta This API may change without a BREAKING CHANGE notice.\n   */\n  isMediateDefaultGrantAll(): Promise<boolean>\n\n  /**\n   * Takes a Requester Did and a {@link PreMediationRequestPolicy} and saves it to the store.\n   *\n   * @param args - an object {@link IMediationManagerSaveMediationPolicyArgs}\n   * @returns - a Promise that resolves to the saved Requester Did\n   * @beta This API may change without a BREAKING CHANGE notice.\n   */\n  mediationManagerSaveMediationPolicy(args: IMediationManagerSaveMediationPolicyArgs): Promise<RequesterDid>\n\n  /**\n   * Takes a Requester Did and removes the {@link PreMediationRequestPolicy} associated with it from the store.\n   *\n   * @param args - an object {@link IMediationManagerRemoveMediationPolicyArgs}\n   * @returns - a Promise that resolves to a boolean indicating whether the policy was successfully removed\n   * @beta This API may change without a BREAKING CHANGE notice.\n   */\n  mediationManagerRemoveMediationPolicy(args: IMediationManagerRemoveMediationPolicyArgs): Promise<boolean>\n\n  /**\n   * Takes a Requester Did and returns the {@link PreMediationRequestPolicy} associated with it from the store.\n   *\n   * @param args - an object {@link IMediationManagerRemoveMediationPolicyArgs}\n   * @returns - a Promise that resolves to the {@link PreMediationRequestPolicy} associated with the Requester Did or null if no policy exists\n   * @beta This API may change without a BREAKING CHANGE notice.\n   */\n  mediationManagerGetMediationPolicy(\n    args: IMediationManagerGetMediationPolicyArgs,\n  ): Promise<PreMediationRequestPolicy | null>\n\n  /**\n   * Returns an object of keys and their associated {@link PreMediationRequestPolicy} it from the store.\n   *\n   * @returns - a Promise that resolves to an object {@link PreMediationRequestPolicy}.\n   * @beta This API may change without a BREAKING CHANGE notice.\n   */\n  mediationManagerListMediationPolicies(): Promise<Record<string, PreMediationRequestPolicy>>\n\n  /**\n   * Takes a Requester Did and returns the {@link MediationResponse} associated with it from the store.\n   *\n   * @param args - an object {@link IMediationGetArgs}\n   * @returns - a Promise that resolves to the {@link MediationResponse} associated with the Requester Did\n   * or null if no {@link MediationResponse} exists\n   * @beta This API may change without a BREAKING CHANGE notice.\n   */\n  mediationManagerGetMediation(args: IMediationGetArgs): Promise<MediationResponse | null>\n\n  /**\n   * Takes a Requester Did and removes the {@link MediationResponse} associated with it from the store.\n   *\n   * @param args - an object {@link IMediationGetArgs}\n   * @returns - a Promise that resolves to a boolean indicating success or failure.\n   * or null if no {@link MediationResponse} exists\n   * @beta This API may change without a BREAKING CHANGE notice.\n   */\n  mediationManagerRemoveMediation(args: IMediationGetArgs): Promise<boolean>\n\n  /**\n   * Takes a Requester Did and saves the {@link MediationResponse} associated with it to the store.\n   *\n   * @param args - an object {@link IMediationManagerSaveMediationArgs}\n   * @returns - a Promise that resolves to a {@link RequesterDid} saved to the store.\n   * @beta This API may change without a BREAKING CHANGE notice.\n   */\n  mediationManagerSaveMediation(args: IMediationManagerSaveMediationArgs): Promise<RequesterDid>\n\n  /**\n   * Returns a record of all {@link RequesterDid} and their associated {@link MediationResponse}.\n   *\n   * @returns - a Promise that resolves to a list of {@link RequesterDid} saved to the store.\n   * @beta This API may change without a BREAKING CHANGE notice.\n   */\n  mediationManagerGetAllMediations(): Promise<Record<RequesterDid, MediationResponse>>\n\n  /**\n   * Takes a {@link RecipientDid} and its owning {@link RequesterDid} and adds it to the store.\n   *\n   * @remarks the {@link RecipientDid} is used as the key and the {@link RequesterDid} is the value.\n   * @param args - an object {@link IMediationManagerAddRecipientDidArgs}\n   * @returns - a Promise that resolves to a {@link RequesterDid}.\n   * @beta This API may change without a BREAKING CHANGE notice.\n   */\n  mediationManagerAddRecipientDid(args: IMediationManagerAddRecipientDidArgs): Promise<RequesterDid>\n\n  /**\n   * Takes a {@link RecipientDid} and removes it from the store.\n   *\n   * @param args - an object {@link IMediationManagerRecipientDidArgs}\n   * @returns - a Promise that resolves to a boolean indicating success or failure.\n   * @beta This API may change without a BREAKING CHANGE notice.\n   */\n  mediationManagerRemoveRecipientDid(args: IMediationManagerRecipientDidArgs): Promise<boolean>\n\n  /**\n   * Takes a {@link RecipientDid} and returns its associated value {@link RequesterDid}.\n   *\n   * @param args - an object {@link IMediationManagerRecipientDidArgs}\n   * @returns - a Promise that resolves string which is the {@link RequesterDid}\n   * @beta This API may change without a BREAKING CHANGE notice.\n   */\n  mediationManagerGetRecipientDid(args: IMediationManagerRecipientDidArgs): Promise<RequesterDid | null>\n\n  /**\n   * Takes a {@link RequesterDid} and returns all associated {@link RecipientDid}.\n   *\n   * @param args - an object {@link IMediationManagerListRecipientDidsArgs}\n   * @returns - a Promise that resolves to an array of {@link RecipientDid}\n   * @beta This API may change without a BREAKING CHANGE notice.\n   */\n  mediationManagerListRecipientDids(args: IMediationManagerListRecipientDidsArgs): Promise<RecipientDid[]>\n\n  /**\n   * Takes a {@link RecipientDid} and returns a boolean indicating whether it has been granted mediation.\n   *\n   * @param args - an object {@link IMediationManagerRecipientDidArgs}\n   * @returns - a Promise that resolves to a boolean indicating whether mediation has been granted.\n   * @beta This API may change without a BREAKING CHANGE notice.\n   */\n  mediationManagerIsMediationGranted(args: IMediationManagerRecipientDidArgs): Promise<boolean>\n}\n"
  },
  {
    "path": "packages/mediation-manager/tsconfig.json",
    "content": "{\n  \"extends\": \"../tsconfig.settings.json\",\n  \"compilerOptions\": {\n    \"esModuleInterop\": true,\n    \"rootDir\": \"src\",\n    \"outDir\": \"build\",\n    \"declarationDir\": \"build\",\n    \"skipLibCheck\": true,\n    \"strictFunctionTypes\": false,\n    \"types\": [\n      \"node\"\n    ]\n  },\n  \"references\": [\n    {\n      \"path\": \"../core-types\"\n    },\n    {\n      \"path\": \"../utils\"\n    }\n  ]\n}\n"
  },
  {
    "path": "packages/message-handler/CHANGELOG.md",
    "content": "# Change Log\n\nAll notable changes to this project will be documented in this file.\nSee [Conventional Commits](https://conventionalcommits.org) for commit guidelines.\n\n# [7.0.0](https://github.com/decentralized-identity/veramo/compare/v6.0.2...v7.0.0) (2026-02-11)\n\n\n### Bug Fixes\n\n* **deps:** update devdeps and bump typeorm to 0.3.20 ([#1272](https://github.com/decentralized-identity/veramo/issues/1272)) ([7d17f37](https://github.com/decentralized-identity/veramo/commit/7d17f37ea7cc4e73a8cdae028681ae1be5c4d11c))\n\n\n\n\n\n## [6.0.2](https://github.com/decentralized-identity/veramo/compare/v6.0.1...v6.0.2) (2026-01-16)\n\n**Note:** Version bump only for package @veramo/message-handler\n\n\n\n\n\n## [6.0.1](https://github.com/decentralized-identity/veramo/compare/v6.0.0...v6.0.1) (2026-01-16)\n\n**Note:** Version bump only for package @veramo/message-handler\n\n\n\n\n\n# [6.0.0](https://github.com/decentralized-identity/veramo/compare/v5.6.0...v6.0.0) (2024-04-02)\n\n\n### Bug Fixes\n\n* export const plugin schemas instead of defaults ([#1327](https://github.com/decentralized-identity/veramo/issues/1327)) ([7896cea](https://github.com/decentralized-identity/veramo/commit/7896ceaf2c79993eee44e46950814bea74bfe647)), closes [#1318](https://github.com/decentralized-identity/veramo/issues/1318) [#1317](https://github.com/decentralized-identity/veramo/issues/1317) [#1315](https://github.com/decentralized-identity/veramo/issues/1315)\n\n\n### Code Refactoring\n\n* generate plugin schemas as TS instead of JSON ([#1315](https://github.com/decentralized-identity/veramo/issues/1315)) ([65c2d4b](https://github.com/decentralized-identity/veramo/commit/65c2d4bc814daa9a3a89f4f7b8e8c6973b8ce2f0)), closes [#1254](https://github.com/decentralized-identity/veramo/issues/1254)\n\n\n### BREAKING CHANGES\n\n* The `plugin.schema.json` files are now generated as `plugin.schema.ts`.\n\n\n\n\n\n# [5.6.0](https://github.com/decentralized-identity/veramo/compare/v5.5.3...v5.6.0) (2024-01-16)\n\n\n### Features\n\n* **remote-client:** allow dynamic headers param for AgentRestClient constructor ([#1314](https://github.com/decentralized-identity/veramo/issues/1314)) ([1b8a0a2](https://github.com/decentralized-identity/veramo/commit/1b8a0a2718dd63492ad3a312a6ebe5f6e7849935)), closes [#1313](https://github.com/decentralized-identity/veramo/issues/1313)\n\n\n\n\n\n## [5.5.3](https://github.com/decentralized-identity/veramo/compare/v5.5.2...v5.5.3) (2023-10-09)\n\n\n### Bug Fixes\n\n* use DIF URLs in packages ([#1271](https://github.com/decentralized-identity/veramo/issues/1271)) ([3dfc601](https://github.com/decentralized-identity/veramo/commit/3dfc6014cdee7902c59d8db76b4c8507b870f227))\n\n\n\n\n\n# [5.5.0](https://github.com/uport-project/veramo/compare/v5.4.1...v5.5.0) (2023-09-19)\n\n\n### Bug Fixes\n\n* **did-provider-key:** use compressed keys for creating Secp256k1 did:key ([#1217](https://github.com/uport-project/veramo/issues/1217)) ([ba8f6f5](https://github.com/uport-project/veramo/commit/ba8f6f5b9b701e57af86491504ecd209ca0c1c1d)), closes [#1213](https://github.com/uport-project/veramo/issues/1213)\n\n\n\n\n\n## [5.4.1](https://github.com/uport-project/veramo/compare/v5.4.0...v5.4.1) (2023-08-04)\n\n\n### Bug Fixes\n\n* **ci:** benign change meant to tag all packages for another patch release ([#1211](https://github.com/uport-project/veramo/issues/1211)) ([41b5c90](https://github.com/uport-project/veramo/commit/41b5c90277171b7b38c5cf49ca01db5cf75b6300))\n\n\n\n\n\n# [5.4.0](https://github.com/uport-project/veramo/compare/v5.3.0...v5.4.0) (2023-08-01)\n\n**Note:** Version bump only for package @veramo/message-handler\n\n\n\n\n\n# [5.3.0](https://github.com/uport-project/veramo/compare/v5.2.0...v5.3.0) (2023-07-27)\n\n**Note:** Version bump only for package @veramo/message-handler\n\n\n\n\n\n## [5.1.2](https://github.com/uport-project/veramo/compare/v5.1.1...v5.1.2) (2023-02-25)\n\n**Note:** Version bump only for package @veramo/message-handler\n\n\n\n\n\n# [5.1.0](https://github.com/uport-project/veramo/compare/v5.0.0...v5.1.0) (2023-02-24)\n\n**Note:** Version bump only for package @veramo/message-handler\n\n\n\n\n\n# [5.0.0](https://github.com/uport-project/veramo/compare/v4.3.0...v5.0.0) (2023-02-09)\n\n\n### Build System\n\n* convert veramo modules to ESM instead of CommonJS ([#1103](https://github.com/uport-project/veramo/issues/1103)) ([b5cea3c](https://github.com/uport-project/veramo/commit/b5cea3c0d80d900a47bd1d9eea68f84b70a35e7b)), closes [#1099](https://github.com/uport-project/veramo/issues/1099)\n\n\n### Features\n\n* isolate `core-types` package from `core` ([#1116](https://github.com/uport-project/veramo/issues/1116)) ([ba7a303](https://github.com/uport-project/veramo/commit/ba7a303de91cf4cc568a3af1ddf8ca98ed022e9f))\n\n\n### BREAKING CHANGES\n\n* this is a breaking change as modules will have to be imported differently: \n* https://www.typescriptlang.org/docs/handbook/esm-node.html\n* https://nodejs.org/api/esm.html\n* https://caniuse.com/?search=modules\n\ntest(did-provider-ion): skip a couple of tests that fail with unreasonable errors\nchore: use ubuntu-latest on CI\nfix: temporarily remove puppeteer tests\nfix: use craco for test-react-app to enable babel config\ntest: fix unit and integration tests (browser tests still broken)\nfix: fix some build issues that prevented tests from working\nfix: missing deps flagged by pnpm\n\n\n\n\n\n# [4.3.0](https://github.com/uport-project/veramo/compare/v4.2.0...v4.3.0) (2023-01-27)\n\n\n### Features\n\n* **did-comm:** add trust ping protocol ([#1080](https://github.com/uport-project/veramo/issues/1080)) ([fb22e63](https://github.com/uport-project/veramo/commit/fb22e632ef6dcce6a7dfec9a229c7be4d6d5c894))\n* **did-comm:** support DIDComm Messaging attachments ([#1087](https://github.com/uport-project/veramo/issues/1087)) ([6679574](https://github.com/uport-project/veramo/commit/66795742a01d5390ad083610efd28a8fe59fb3a3)), closes [#612](https://github.com/uport-project/veramo/issues/612)\n\n\n\n\n\n# [4.2.0](https://github.com/uport-project/veramo/compare/v4.1.2...v4.2.0) (2022-12-05)\n\n\n### Bug Fixes\n\n* **deps:** bump dependencies ([701b8ed](https://github.com/uport-project/veramo/commit/701b8edf981ea11c7ddb6a81d2817dbbdbb022f3))\n\n\n\n\n\n## [4.1.1](https://github.com/uport-project/veramo/compare/v4.1.0...v4.1.1) (2022-11-01)\n\n**Note:** Version bump only for package @veramo/message-handler\n\n\n\n\n\n# [4.1.0](https://github.com/uport-project/veramo/compare/v4.0.2...v4.1.0) (2022-10-31)\n\n**Note:** Version bump only for package @veramo/message-handler\n\n\n\n\n\n# [4.0.0](https://github.com/uport-project/veramo/compare/v3.1.5...v4.0.0) (2022-09-22)\n\n\n### Bug Fixes\n\n* **did-resolver:** use interface `Resolvable` instead of the `Resolver` class ([9c2e59f](https://github.com/uport-project/veramo/commit/9c2e59f3f23f808511c6c0e8e440b4d53ba5cb00))\n* update and fix inline documentation of all exported types ([#921](https://github.com/uport-project/veramo/issues/921)) ([63e64e0](https://github.com/uport-project/veramo/commit/63e64e0e2693808c4704dca8cc511dc0bab3f3b1))\n\n\n### Features\n\n* **credential-ld:** add support for browser environments ([#916](https://github.com/uport-project/veramo/issues/916)) ([435e4d2](https://github.com/uport-project/veramo/commit/435e4d260b1774f96b182c1a75ab2f1c993f2291))\n\n\n\n\n\n## [3.1.3](https://github.com/uport-project/veramo/compare/v3.1.2...v3.1.3) (2022-06-01)\n\n**Note:** Version bump only for package @veramo/message-handler\n\n\n\n\n\n# [3.1.0](https://github.com/uport-project/veramo/compare/v3.0.0...v3.1.0) (2021-11-12)\n\n**Note:** Version bump only for package @veramo/message-handler\n\n\n\n\n\n# [3.0.0](https://github.com/uport-project/veramo/compare/v2.1.3...v3.0.0) (2021-09-20)\n\n**Note:** Version bump only for package @veramo/message-handler\n\n\n\n\n\n# [2.1.0](https://github.com/uport-project/veramo/compare/v2.0.1...v2.1.0) (2021-08-11)\n\n**Note:** Version bump only for package @veramo/message-handler\n\n\n\n\n\n# [2.0.0](https://github.com/uport-project/veramo/compare/v1.2.2...v2.0.0) (2021-07-14)\n\n**Note:** Version bump only for package @veramo/message-handler\n\n\n\n\n\n# [1.2.0](https://github.com/uport-project/veramo/compare/v1.1.2...v1.2.0) (2021-04-27)\n\n**Note:** Version bump only for package @veramo/message-handler\n\n\n\n\n\n# [1.1.0](https://github.com/uport-project/veramo/compare/v1.0.1...v1.1.0) (2021-01-26)\n\n**Note:** Version bump only for package @veramo/message-handler\n\n\n\n\n\n## 1.0.1 (2020-12-18)\n\n**Note:** Version bump only for package @veramo/message-handler\n"
  },
  {
    "path": "packages/message-handler/LICENSE",
    "content": "                                 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 2019 Consensys AG\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"
  },
  {
    "path": "packages/message-handler/README.md",
    "content": "# Veramo Message Handler\n\nThis is a Veramo plugin that coordinates several `AbstractMessageHandler` implementations\nto provide a `handleMessage` method to a Veramo agent.\n"
  },
  {
    "path": "packages/message-handler/api-extractor.json",
    "content": "{\n  \"$schema\": \"https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json\",\n  \"apiReport\": {\n    \"enabled\": true,\n    \"reportFolder\": \"./api\",\n    \"reportTempFolder\": \"./api\"\n  },\n\n  \"docModel\": {\n    \"enabled\": true,\n    \"apiJsonFilePath\": \"./api/<unscopedPackageName>.api.json\"\n  },\n\n  \"dtsRollup\": {\n    \"enabled\": false\n  },\n  \"mainEntryPointFilePath\": \"<projectFolder>/build/index.d.ts\"\n}\n"
  },
  {
    "path": "packages/message-handler/package.json",
    "content": "{\n  \"name\": \"@veramo/message-handler\",\n  \"description\": \"Message Handler plugin for Veramo\",\n  \"version\": \"7.0.0\",\n  \"main\": \"build/index.js\",\n  \"exports\": \"./build/index.js\",\n  \"types\": \"build/index.d.ts\",\n  \"scripts\": {\n    \"build\": \"tsc\",\n    \"extract-api\": \"node ../cli/bin/veramo.js dev extract-api\"\n  },\n  \"dependencies\": {\n    \"@veramo/core-types\": \"workspace:^\",\n    \"debug\": \"^4.3.4\"\n  },\n  \"devDependencies\": {\n    \"@types/debug\": \"4.1.8\",\n    \"typescript\": \"5.7.3\"\n  },\n  \"files\": [\n    \"build/**/*\",\n    \"src/**/*\",\n    \"README.md\",\n    \"LICENSE\"\n  ],\n  \"publishConfig\": {\n    \"access\": \"public\"\n  },\n  \"repository\": {\n    \"type\": \"git\",\n    \"url\": \"https://github.com/decentralized-identity/veramo.git\",\n    \"directory\": \"packages/message-handler\"\n  },\n  \"author\": \"Consensys Mesh R&D <hello@veramo.io>\",\n  \"contributors\": [\n    \"Simonas Karuzas <simonas.karuzas@mesh.xyz>\",\n    \"Mircea Nistor <mircea.nistor@mesh.xyz>\"\n  ],\n  \"keywords\": [\n    \"Veramo\",\n    \"DID\",\n    \"Verifiable Credential\",\n    \"veramo-plugin\",\n    \"aggregator\",\n    \"messaging\",\n    \"DIDComm\"\n  ],\n  \"license\": \"Apache-2.0\",\n  \"type\": \"module\",\n  \"moduleDirectories\": [\n    \"node_modules\",\n    \"src\"\n  ]\n}\n"
  },
  {
    "path": "packages/message-handler/src/__tests__/default.test.ts",
    "content": "import { IAgentContext, IMessageHandler } from '../../../core-types/src'\nimport { createAgent } from '../../../core/src'\nimport { MessageHandler } from '../message-handler.js'\nimport { jest } from '@jest/globals'\nimport { AbstractMessageHandler } from \"../abstract-message-handler.js\";\nimport { Message } from \"../message.js\";\n\njest.setTimeout(60000)\n\nclass DummyHandler extends AbstractMessageHandler {\n  async handle(message: Message, context: IAgentContext<{}>): Promise<Message> {\n    return super.handle(message, context)\n  }\n}\n\ndescribe('@veramo/message-handler', () => {\n  const a = 100\n  it('should run a dummy test', () => {\n    expect(a).toEqual(100)\n  })\n\n  let agent = createAgent<IMessageHandler>({\n    plugins: [\n      new MessageHandler({\n        messageHandlers: [new DummyHandler()],\n      }),\n    ],\n  })\n\n  it('should reject unknown message', async () => {\n    expect.assertions(1)\n    const raw = 'some message of unknown format'\n    await expect(agent.handleMessage({ raw, save: false, metaData: [{ type: 'test' }] })).rejects.toThrow(\n      'Unsupported message type',\n    )\n  })\n})\n"
  },
  {
    "path": "packages/message-handler/src/abstract-message-handler.ts",
    "content": "import { IAgentContext } from '@veramo/core-types'\nimport { Message } from './message.js'\nimport Debug from 'debug'\n\nconst debug = Debug('veramo:message-handler')\nexport const unsupportedMessageTypeError = new Error('Unsupported message type')\n\n/**\n * An abstract class for creating {@link @veramo/message-handler#MessageHandler} plugins\n * @public\n */\nexport abstract class AbstractMessageHandler {\n  public nextMessageHandler?: AbstractMessageHandler\n\n  public setNext(messageHandler: AbstractMessageHandler): AbstractMessageHandler {\n    this.nextMessageHandler = messageHandler\n    return messageHandler\n  }\n\n  public async handle(message: Message, context: IAgentContext<{}>): Promise<Message> {\n    if (this.nextMessageHandler) return this.nextMessageHandler.handle(message, context)\n    debug(\"can't handle message: \", message)\n    return Promise.reject(unsupportedMessageTypeError)\n  }\n}\n"
  },
  {
    "path": "packages/message-handler/src/index.ts",
    "content": "/**\n * Provides a {@link @veramo/message-handler#MessageHandler | plugin} for the\n * {@link @veramo/core#Agent} that implements {@link @veramo/core-types#IMessageHandler} interface.\n *\n * @packageDocumentation\n */\nexport { MessageHandler } from './message-handler.js'\nexport { AbstractMessageHandler } from './abstract-message-handler.js'\nexport { Message } from './message.js'\n"
  },
  {
    "path": "packages/message-handler/src/message-handler.ts",
    "content": "import {\n  IDataStore,\n  IAgentPlugin,\n  IAgentContext,\n  IMessageHandler,\n  IHandleMessageArgs,\n  CoreEvents,\n  IMessage,\n} from '@veramo/core-types'\nimport { schema } from '@veramo/core-types'\nimport { Message } from './message.js'\nimport { AbstractMessageHandler } from './abstract-message-handler.js'\n\nimport Debug from 'debug'\n\nconst debug = Debug('veramo:message-handler')\n\nexport const EventTypes = {\n  validatedMessage: 'validatedMessage',\n  savedMessage: 'savedMessage',\n  error: CoreEvents.error,\n}\n\n/**\n * A Veramo agent plugin that implements {@link @veramo/core-types#IMessageHandler | IMessageHandler} methods.\n *\n * This plugin is meant to chain together multiple other {@link @veramo/core-types#IMessageHandler | IMessageHandler}\n * implementations.\n *\n * When handling a message, the message is passed from one handler to the next, and each handler in\n * the chain can decide if it is able to interpret the message.\n *\n * If the message can be processed by a handler it is returned as an {@link @veramo/core-types#IMessage | IMessage}.\n * If the message cannot be processed by any of the handlers, an error is thrown.\n *\n * @public\n */\nexport class MessageHandler implements IAgentPlugin {\n  /**\n   * Plugin methods\n   * @public\n   */\n  readonly methods: IMessageHandler\n  readonly schema = schema.IMessageHandler\n  private messageHandler?: AbstractMessageHandler\n\n  constructor(options: { messageHandlers: AbstractMessageHandler[] }) {\n    for (const messageHandler of options.messageHandlers) {\n      if (!this.messageHandler) {\n        this.messageHandler = messageHandler\n      } else {\n        let lastHandler = this.messageHandler\n        while (lastHandler.nextMessageHandler !== undefined) {\n          lastHandler = lastHandler.nextMessageHandler\n        }\n        lastHandler.setNext(messageHandler)\n      }\n    }\n\n    this.handleMessage = this.handleMessage.bind(this)\n    this.methods = {\n      handleMessage: this.handleMessage,\n    }\n  }\n\n  /** {@inheritDoc @veramo/core-types#IMessageHandler.handleMessage} */\n  public async handleMessage(\n    args: IHandleMessageArgs,\n    context: IAgentContext<IDataStore>,\n  ): Promise<IMessage> {\n    const { raw, metaData, save } = args\n    debug('%o', { raw, metaData, save })\n    if (!this.messageHandler) {\n      return Promise.reject(new Error('Message handler not provided'))\n    }\n\n    try {\n      const message = await this.messageHandler.handle(new Message({ raw, metaData }), context)\n      if (message.isValid()) {\n        debug('Emitting event', EventTypes.validatedMessage)\n        context.agent.emit(EventTypes.validatedMessage, message)\n      }\n\n      debug('Validated message %o', message)\n      if (save) {\n        await context.agent.dataStoreSaveMessage({ message })\n        debug('Emitting event', EventTypes.savedMessage)\n        context.agent.emit(EventTypes.savedMessage, message)\n      }\n      return message\n    } catch (error) {\n      debug('Error', error)\n      context.agent.emit(EventTypes.error, error)\n      return Promise.reject(error)\n    }\n  }\n}\n"
  },
  {
    "path": "packages/message-handler/src/message.ts",
    "content": "import {\n  IMessage,\n  IMetaData,\n  IMessageAttachment,\n  VerifiableCredential,\n  VerifiablePresentation,\n} from '@veramo/core-types'\n\n/**\n * A class implementing {@link @veramo/core-types#IMessage | IMessage}.\n *\n * This is used by {@link @veramo/message-handler#MessageHandler | MessageHandler}.\n *\n * @public\n */\nexport class Message implements IMessage {\n  constructor(data?: { raw: string; metaData?: IMetaData[] }) {\n    if (data?.raw) {\n      this.raw = data.raw\n    }\n    if (data?.metaData) {\n      this.metaData = data.metaData\n    }\n  }\n\n  // @ts-ignore\n  id: string\n\n  createdAt?: string\n\n  expiresAt?: string\n\n  threadId?: string\n\n  // @ts-ignore\n  type: string\n\n  raw?: string\n\n  data?: any\n\n  replyTo?: string[]\n\n  replyUrl?: string\n\n  from?: string\n\n  to?: string\n\n  returnRoute?: string\n\n  metaData?: IMetaData[]\n\n  presentations?: VerifiablePresentation[]\n  credentials?: VerifiableCredential[]\n  attachments?: IMessageAttachment[]\n\n  addMetaData(meta: IMetaData) {\n    if (this.metaData) {\n      this.metaData.push(meta)\n    } else {\n      this.metaData = [meta]\n    }\n  }\n\n  getLastMetaData(): IMetaData | null {\n    if (this.metaData !== undefined && this.metaData.length > 0) {\n      return this.metaData[this.metaData.length - 1]\n    } else {\n      return null\n    }\n  }\n\n  isValid() {\n    if (this.type === null || this.type === '') {\n      return false\n    }\n    if (!this.raw || this.raw === null || this.raw === '') {\n      return false\n    }\n    return true\n  }\n}\n"
  },
  {
    "path": "packages/message-handler/tsconfig.json",
    "content": "{\n  \"extends\": \"../tsconfig.settings.json\",\n  \"compilerOptions\": {\n    \"rootDir\": \"src\",\n    \"outDir\": \"build\",\n    \"declarationDir\": \"build\"\n  },\n  \"references\": [{ \"path\": \"../core-types\" }, { \"path\": \"../core\"}]\n}\n"
  },
  {
    "path": "packages/remote-client/CHANGELOG.md",
    "content": "# Change Log\n\nAll notable changes to this project will be documented in this file.\nSee [Conventional Commits](https://conventionalcommits.org) for commit guidelines.\n\n# [7.0.0](https://github.com/decentralized-identity/veramo/compare/v6.0.2...v7.0.0) (2026-02-11)\n\n\n### Bug Fixes\n\n* **deps:** update devdeps and bump typeorm to 0.3.20 ([#1272](https://github.com/decentralized-identity/veramo/issues/1272)) ([7d17f37](https://github.com/decentralized-identity/veramo/commit/7d17f37ea7cc4e73a8cdae028681ae1be5c4d11c))\n\n\n\n\n\n## [6.0.2](https://github.com/decentralized-identity/veramo/compare/v6.0.1...v6.0.2) (2026-01-16)\n\n**Note:** Version bump only for package @veramo/remote-client\n\n\n\n\n\n## [6.0.1](https://github.com/decentralized-identity/veramo/compare/v6.0.0...v6.0.1) (2026-01-16)\n\n**Note:** Version bump only for package @veramo/remote-client\n\n\n\n\n\n# [6.0.0](https://github.com/decentralized-identity/veramo/compare/v5.6.0...v6.0.0) (2024-04-02)\n\n**Note:** Version bump only for package @veramo/remote-client\n\n\n\n\n\n# [5.6.0](https://github.com/decentralized-identity/veramo/compare/v5.5.3...v5.6.0) (2024-01-16)\n\n\n### Features\n\n* **remote-client:** allow dynamic headers param for AgentRestClient constructor ([#1314](https://github.com/decentralized-identity/veramo/issues/1314)) ([1b8a0a2](https://github.com/decentralized-identity/veramo/commit/1b8a0a2718dd63492ad3a312a6ebe5f6e7849935)), closes [#1313](https://github.com/decentralized-identity/veramo/issues/1313)\n\n\n\n\n\n## [5.5.3](https://github.com/decentralized-identity/veramo/compare/v5.5.2...v5.5.3) (2023-10-09)\n\n\n### Bug Fixes\n\n* use DIF URLs in packages ([#1271](https://github.com/decentralized-identity/veramo/issues/1271)) ([3dfc601](https://github.com/decentralized-identity/veramo/commit/3dfc6014cdee7902c59d8db76b4c8507b870f227))\n\n\n\n\n\n# [5.5.0](https://github.com/uport-project/veramo/compare/v5.4.1...v5.5.0) (2023-09-19)\n\n\n### Bug Fixes\n\n* **deps:** update dependency cross-fetch to v4 ([1c14d34](https://github.com/uport-project/veramo/commit/1c14d34f48a51bef373541e84ed89f2f44711406))\n* **did-provider-key:** use compressed keys for creating Secp256k1 did:key ([#1217](https://github.com/uport-project/veramo/issues/1217)) ([ba8f6f5](https://github.com/uport-project/veramo/commit/ba8f6f5b9b701e57af86491504ecd209ca0c1c1d)), closes [#1213](https://github.com/uport-project/veramo/issues/1213)\n\n\n\n\n\n## [5.4.1](https://github.com/uport-project/veramo/compare/v5.4.0...v5.4.1) (2023-08-04)\n\n\n### Bug Fixes\n\n* **ci:** benign change meant to tag all packages for another patch release ([#1211](https://github.com/uport-project/veramo/issues/1211)) ([41b5c90](https://github.com/uport-project/veramo/commit/41b5c90277171b7b38c5cf49ca01db5cf75b6300))\n\n\n\n\n\n# [5.4.0](https://github.com/uport-project/veramo/compare/v5.3.0...v5.4.0) (2023-08-01)\n\n\n### Features\n\n* **did-comm:** add support for the AES based content and key encryption algorithms ([#1180](https://github.com/uport-project/veramo/issues/1180)) ([5294a81](https://github.com/uport-project/veramo/commit/5294a812ee578c0712b54f216416c3ef78c848da))\n\n\n\n\n\n# [5.3.0](https://github.com/uport-project/veramo/compare/v5.2.0...v5.3.0) (2023-07-27)\n\n**Note:** Version bump only for package @veramo/remote-client\n\n\n\n\n\n## [5.1.2](https://github.com/uport-project/veramo/compare/v5.1.1...v5.1.2) (2023-02-25)\n\n**Note:** Version bump only for package @veramo/remote-client\n\n\n\n\n\n# [5.1.0](https://github.com/uport-project/veramo/compare/v5.0.0...v5.1.0) (2023-02-24)\n\n**Note:** Version bump only for package @veramo/remote-client\n\n\n\n\n\n# [5.0.0](https://github.com/uport-project/veramo/compare/v4.3.0...v5.0.0) (2023-02-09)\n\n\n### Build System\n\n* convert veramo modules to ESM instead of CommonJS ([#1103](https://github.com/uport-project/veramo/issues/1103)) ([b5cea3c](https://github.com/uport-project/veramo/commit/b5cea3c0d80d900a47bd1d9eea68f84b70a35e7b)), closes [#1099](https://github.com/uport-project/veramo/issues/1099)\n\n\n### Features\n\n* isolate `core-types` package from `core` ([#1116](https://github.com/uport-project/veramo/issues/1116)) ([ba7a303](https://github.com/uport-project/veramo/commit/ba7a303de91cf4cc568a3af1ddf8ca98ed022e9f))\n\n\n### BREAKING CHANGES\n\n* this is a breaking change as modules will have to be imported differently: \n* https://www.typescriptlang.org/docs/handbook/esm-node.html\n* https://nodejs.org/api/esm.html\n* https://caniuse.com/?search=modules\n\ntest(did-provider-ion): skip a couple of tests that fail with unreasonable errors\nchore: use ubuntu-latest on CI\nfix: temporarily remove puppeteer tests\nfix: use craco for test-react-app to enable babel config\ntest: fix unit and integration tests (browser tests still broken)\nfix: fix some build issues that prevented tests from working\nfix: missing deps flagged by pnpm\n\n\n\n\n\n# [4.3.0](https://github.com/uport-project/veramo/compare/v4.2.0...v4.3.0) (2023-01-27)\n\n**Note:** Version bump only for package @veramo/remote-client\n\n\n\n\n\n# [4.2.0](https://github.com/uport-project/veramo/compare/v4.1.2...v4.2.0) (2022-12-05)\n\n\n### Bug Fixes\n\n* **deps:** bump dependencies ([701b8ed](https://github.com/uport-project/veramo/commit/701b8edf981ea11c7ddb6a81d2817dbbdbb022f3))\n\n\n\n\n\n## [4.1.1](https://github.com/uport-project/veramo/compare/v4.1.0...v4.1.1) (2022-11-01)\n\n**Note:** Version bump only for package @veramo/remote-client\n\n\n\n\n\n# [4.1.0](https://github.com/uport-project/veramo/compare/v4.0.2...v4.1.0) (2022-10-31)\n\n**Note:** Version bump only for package @veramo/remote-client\n\n\n\n\n\n# [4.0.0](https://github.com/uport-project/veramo/compare/v3.1.5...v4.0.0) (2022-09-22)\n\n\n### Bug Fixes\n\n* **credential-ld:** fix EcdsaSecp256k1RecoverySignature2020 suite context ([#909](https://github.com/uport-project/veramo/issues/909)) ([48fbee3](https://github.com/uport-project/veramo/commit/48fbee3e62eab3df4225ae0bdb3a92f5665eb171))\n* **deps:** update all non-major dependencies ([b537187](https://github.com/uport-project/veramo/commit/b537187ba04ba41cd45c18dfb58c92725b65b084))\n* **deps:** update dependency openapi-types to v10 ([3d9cf88](https://github.com/uport-project/veramo/commit/3d9cf8810cd04dbde394248a818e1e59eb251c67))\n* **deps:** update dependency openapi-types to v11 ([992ad40](https://github.com/uport-project/veramo/commit/992ad4041f54634203bd3017fd984f45a7c92012))\n* **deps:** update dependency openapi-types to v12 ([b8401f5](https://github.com/uport-project/veramo/commit/b8401f526b0771a98ab7987b773b9e9113710e9e))\n* **did-resolver:** use interface `Resolvable` instead of the `Resolver` class ([9c2e59f](https://github.com/uport-project/veramo/commit/9c2e59f3f23f808511c6c0e8e440b4d53ba5cb00))\n* update and fix inline documentation of all exported types ([#921](https://github.com/uport-project/veramo/issues/921)) ([63e64e0](https://github.com/uport-project/veramo/commit/63e64e0e2693808c4704dca8cc511dc0bab3f3b1))\n\n\n### Features\n\n* **credential-ld:** add support for browser environments ([#916](https://github.com/uport-project/veramo/issues/916)) ([435e4d2](https://github.com/uport-project/veramo/commit/435e4d260b1774f96b182c1a75ab2f1c993f2291))\n\n\n\n\n\n## [3.1.3](https://github.com/uport-project/veramo/compare/v3.1.2...v3.1.3) (2022-06-01)\n\n**Note:** Version bump only for package @veramo/remote-client\n\n\n\n\n\n# [3.1.0](https://github.com/uport-project/veramo/compare/v3.0.0...v3.1.0) (2021-11-12)\n\n**Note:** Version bump only for package @veramo/remote-client\n\n\n\n\n\n# [3.0.0](https://github.com/uport-project/veramo/compare/v2.1.3...v3.0.0) (2021-09-20)\n\n**Note:** Version bump only for package @veramo/remote-client\n\n\n\n\n\n# [2.1.0](https://github.com/uport-project/veramo/compare/v2.0.1...v2.1.0) (2021-08-11)\n\n**Note:** Version bump only for package @veramo/remote-client\n\n\n\n\n\n# [2.0.0](https://github.com/uport-project/veramo/compare/v1.2.2...v2.0.0) (2021-07-14)\n\n\n### Bug Fixes\n\n* **deps:** update dependency openapi-types to v9 ([#517](https://github.com/uport-project/veramo/issues/517)) ([3c33265](https://github.com/uport-project/veramo/commit/3c33265d3ebf65d6bc64f1fccda5461a1109b25c))\n\n\n\n\n\n# [1.2.0](https://github.com/uport-project/veramo/compare/v1.1.2...v1.2.0) (2021-04-27)\n\n\n### Bug Fixes\n\n* **deps:** update all non-major dependencies ([#462](https://github.com/uport-project/veramo/issues/462)) ([4a2b206](https://github.com/uport-project/veramo/commit/4a2b20633810b45a155bf2149cbff57d157bda3c))\n* **deps:** update dependency openapi-types to v8 ([#446](https://github.com/uport-project/veramo/issues/446)) ([7ab3737](https://github.com/uport-project/veramo/commit/7ab3737094beaf1312336b2ed31764121d59ccf1))\n* open api schema x-methods ([#414](https://github.com/uport-project/veramo/issues/414)) ([faa7940](https://github.com/uport-project/veramo/commit/faa7940c515bbd65dfaf9370594794f627099a38))\n\n\n\n\n\n# [1.1.0](https://github.com/uport-project/veramo/compare/v1.0.1...v1.1.0) (2021-01-26)\n\n**Note:** Version bump only for package @veramo/remote-client\n\n\n\n\n\n## 1.0.1 (2020-12-18)\n\n**Note:** Version bump only for package @veramo/remote-client\n"
  },
  {
    "path": "packages/remote-client/LICENSE",
    "content": "                                 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 2019 Consensys AG\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"
  },
  {
    "path": "packages/remote-client/README.md",
    "content": "# Veramo remote client\n\nA Veramo agent plugin that can expose methods from a remote agent locally.\n"
  },
  {
    "path": "packages/remote-client/api-extractor.json",
    "content": "{\n  \"$schema\": \"https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json\",\n  \"apiReport\": {\n    \"enabled\": true,\n    \"reportFolder\": \"./api\",\n    \"reportTempFolder\": \"./api\"\n  },\n\n  \"docModel\": {\n    \"enabled\": true,\n    \"apiJsonFilePath\": \"./api/<unscopedPackageName>.api.json\"\n  },\n\n  \"dtsRollup\": {\n    \"enabled\": false\n  },\n  \"mainEntryPointFilePath\": \"<projectFolder>/build/index.d.ts\"\n}\n"
  },
  {
    "path": "packages/remote-client/package.json",
    "content": "{\n  \"name\": \"@veramo/remote-client\",\n  \"description\": \"A remote client plugin for Veramo. Call the methods of a remote agent locally\",\n  \"version\": \"7.0.0\",\n  \"main\": \"build/index.js\",\n  \"exports\": \"./build/index.js\",\n  \"types\": \"build/index.d.ts\",\n  \"scripts\": {\n    \"build\": \"tsc\",\n    \"extract-api\": \"node ../cli/bin/veramo.js dev extract-api\"\n  },\n  \"dependencies\": {\n    \"@veramo/core-types\": \"workspace:^\",\n    \"cross-fetch\": \"^4.0.0\",\n    \"debug\": \"^4.3.3\",\n    \"openapi-types\": \"12.1.3\"\n  },\n  \"devDependencies\": {\n    \"@types/debug\": \"4.1.8\",\n    \"typescript\": \"5.7.3\"\n  },\n  \"files\": [\n    \"build/**/*\",\n    \"src/**/*\",\n    \"README.md\",\n    \"LICENSE\"\n  ],\n  \"publishConfig\": {\n    \"access\": \"public\"\n  },\n  \"repository\": {\n    \"type\": \"git\",\n    \"url\": \"https://github.com/decentralized-identity/veramo.git\",\n    \"directory\": \"packages/remote-client\"\n  },\n  \"author\": \"Consensys Mesh R&D <hello@veramo.io>\",\n  \"contributors\": [\n    \"Simonas Karuzas <simonas.karuzas@mesh.xyz>\",\n    \"Mircea Nistor <mircea.nistor@mesh.xyz>\"\n  ],\n  \"keywords\": [\n    \"Veramo\",\n    \"DID\",\n    \"Verifiable Credential\",\n    \"veramo-plugin\",\n    \"remote\",\n    \"OpenAPI\"\n  ],\n  \"license\": \"Apache-2.0\",\n  \"type\": \"module\",\n  \"moduleDirectories\": [\n    \"node_modules\",\n    \"src\"\n  ]\n}\n"
  },
  {
    "path": "packages/remote-client/src/client.ts",
    "content": "import { IAgentPlugin, IPluginMethodMap, IAgentPluginSchema } from '@veramo/core-types'\n\n/**\n * This plugin can be used to access the methods of a remote Veramo agent as if they were implemented locally.\n *\n * The remote agent should be provided by {@link @veramo/remote-server#AgentRouter | AgentRouter}, or a similar\n * implementation of this API.\n *\n * The schema of the remote agent is usually provided by {@link @veramo/remote-server#ApiSchemaRouter |\n * ApiSchemaRouter}.\n *\n * @public\n */\nexport class AgentRestClient implements IAgentPlugin {\n  readonly methods: IPluginMethodMap = {}\n  readonly schema?: IAgentPluginSchema\n  private url: string\n\n  constructor(options: {\n    url: string\n    enabledMethods: string[]\n    schema?: IAgentPluginSchema\n    headers?: Record<string, string> | (() => Promise<Record<string, string>>)\n  }) {\n    this.url = options.url\n    this.schema = options.schema\n\n    for (const method of options.enabledMethods) {\n      this.methods[method] = async (args: any) => {\n        // in case headers is an async call, we will wait for it to resolve\n        const headers = typeof options.headers === 'function' ? await options.headers() : options.headers\n        const res = await fetch(this.url + '/' + method, {\n          headers: { ...headers, 'Content-Type': 'application/json' },\n          method: 'post',\n          body: JSON.stringify(args),\n        })\n        const json = await res.json()\n\n        if (res.status >= 400) {\n          throw Error(json.error)\n        }\n\n        return json\n      }\n    }\n  }\n}\n"
  },
  {
    "path": "packages/remote-client/src/index.ts",
    "content": "/**\n * Provides a {@link @veramo/remote-client#AgentRestClient | plugin} for the {@link @veramo/core#Agent} that\n * can proxy method execution over HTTPS\n *\n * @packageDocumentation\n */\nexport { AgentRestClient } from './client.js'\nexport { getOpenApiSchema } from './openApi.js'\n"
  },
  {
    "path": "packages/remote-client/src/openApi.ts",
    "content": "import { OpenAPIV3 } from 'openapi-types'\nimport { IAgent } from '@veramo/core-types'\n\n/**\n * This method can be used to generate an OpenAPIv3 schema to describe how the methods of a Veramo agent can be called\n * remotely.\n *\n * @param agent - The agent whose schema needs to be interpreted.\n * @param basePath - The base URL\n * @param exposedMethods - The list of method names available through this schema\n * @param name - The name of the agent\n * @param version - The version of the agent\n *\n * @public\n */\nexport const getOpenApiSchema = (\n  agent: IAgent,\n  basePath: string,\n  exposedMethods: Array<string>,\n  name?: string,\n  version?: string,\n): OpenAPIV3.Document => {\n  const agentSchema = agent.getSchema()\n\n  const paths: OpenAPIV3.PathsObject = {}\n\n  const schemas = {}\n  const xMethods: Record<string, any> = {}\n\n  for (const method of exposedMethods) {\n    const pathItemObject: OpenAPIV3.PathItemObject = {\n      post: {\n        operationId: method,\n        description: agentSchema.components.methods[method].description,\n        requestBody: {\n          content: {\n            'application/json': {\n              schema: agentSchema.components.methods[method].arguments,\n            },\n          },\n        },\n        responses: {\n          200: {\n            // TODO returnType description\n            description: agentSchema.components.methods[method].description,\n            content: {\n              'application/json; charset=utf-8': {\n                schema: agentSchema.components.methods[method].returnType,\n              },\n            },\n          },\n          400: {\n            description: 'Validation error',\n            content: {\n              'application/json; charset=utf-8': {\n                schema: agentSchema.components.schemas.ValidationError,\n              },\n            },\n          },\n        },\n      },\n    }\n    paths[basePath + '/' + method] = pathItemObject\n    xMethods[method] = agentSchema.components.methods[method]\n  }\n\n  const openApi: OpenAPIV3.Document & { 'x-methods'?: Record<string, any> } = {\n    openapi: '3.0.0',\n    info: {\n      title: name || 'DID Agent',\n      version: version || '',\n    },\n    components: {\n      schemas: agent.getSchema().components.schemas,\n    },\n    paths,\n  }\n\n  openApi['x-methods'] = xMethods\n\n  return openApi\n}\n"
  },
  {
    "path": "packages/remote-client/tsconfig.json",
    "content": "{\n  \"extends\": \"../tsconfig.settings.json\",\n  \"compilerOptions\": {\n    \"rootDir\": \"src\",\n    \"outDir\": \"build\",\n    \"declarationDir\": \"build\",\n    \"lib\": [\n      \"dom\",\n      \"esnext\"\n    ]\n  },\n  \"references\": [{ \"path\": \"../core-types\" }]\n}\n"
  },
  {
    "path": "packages/remote-server/CHANGELOG.md",
    "content": "# Change Log\n\nAll notable changes to this project will be documented in this file.\nSee [Conventional Commits](https://conventionalcommits.org) for commit guidelines.\n\n# [7.0.0](https://github.com/decentralized-identity/veramo/compare/v6.0.2...v7.0.0) (2026-02-11)\n\n\n### Bug Fixes\n\n* **deps:** update devdeps and bump typeorm to 0.3.20 ([#1272](https://github.com/decentralized-identity/veramo/issues/1272)) ([7d17f37](https://github.com/decentralized-identity/veramo/commit/7d17f37ea7cc4e73a8cdae028681ae1be5c4d11c))\n* **remote-server:** fix for code scanning alert [#17](https://github.com/decentralized-identity/veramo/issues/17): Information exposure through a stack trace ([#1467](https://github.com/decentralized-identity/veramo/issues/1467)) ([833c580](https://github.com/decentralized-identity/veramo/commit/833c5809e0db3001d4195a99015f82deaa740d23))\n\n\n\n\n\n## [6.0.2](https://github.com/decentralized-identity/veramo/compare/v6.0.1...v6.0.2) (2026-01-16)\n\n**Note:** Version bump only for package @veramo/remote-server\n\n\n\n\n\n## [6.0.1](https://github.com/decentralized-identity/veramo/compare/v6.0.0...v6.0.1) (2026-01-16)\n\n**Note:** Version bump only for package @veramo/remote-server\n\n\n\n\n\n# [6.0.0](https://github.com/decentralized-identity/veramo/compare/v5.6.0...v6.0.0) (2024-04-02)\n\n**Note:** Version bump only for package @veramo/remote-server\n\n\n\n\n\n# [5.6.0](https://github.com/decentralized-identity/veramo/compare/v5.5.3...v5.6.0) (2024-01-16)\n\n\n### Features\n\n* **remote-client:** allow dynamic headers param for AgentRestClient constructor ([#1314](https://github.com/decentralized-identity/veramo/issues/1314)) ([1b8a0a2](https://github.com/decentralized-identity/veramo/commit/1b8a0a2718dd63492ad3a312a6ebe5f6e7849935)), closes [#1313](https://github.com/decentralized-identity/veramo/issues/1313)\n\n\n\n\n\n## [5.5.3](https://github.com/decentralized-identity/veramo/compare/v5.5.2...v5.5.3) (2023-10-09)\n\n\n### Bug Fixes\n\n* use DIF URLs in packages ([#1271](https://github.com/decentralized-identity/veramo/issues/1271)) ([3dfc601](https://github.com/decentralized-identity/veramo/commit/3dfc6014cdee7902c59d8db76b4c8507b870f227))\n\n\n\n\n\n# [5.5.0](https://github.com/uport-project/veramo/compare/v5.4.1...v5.5.0) (2023-09-19)\n\n\n### Bug Fixes\n\n* **did-provider-key:** use compressed keys for creating Secp256k1 did:key ([#1217](https://github.com/uport-project/veramo/issues/1217)) ([ba8f6f5](https://github.com/uport-project/veramo/commit/ba8f6f5b9b701e57af86491504ecd209ca0c1c1d)), closes [#1213](https://github.com/uport-project/veramo/issues/1213)\n\n\n\n\n\n## [5.4.1](https://github.com/uport-project/veramo/compare/v5.4.0...v5.4.1) (2023-08-04)\n\n\n### Bug Fixes\n\n* **ci:** benign change meant to tag all packages for another patch release ([#1211](https://github.com/uport-project/veramo/issues/1211)) ([41b5c90](https://github.com/uport-project/veramo/commit/41b5c90277171b7b38c5cf49ca01db5cf75b6300))\n\n\n\n\n\n# [5.4.0](https://github.com/uport-project/veramo/compare/v5.3.0...v5.4.0) (2023-08-01)\n\n\n### Features\n\n* **did-comm:** add support for the AES based content and key encryption algorithms ([#1180](https://github.com/uport-project/veramo/issues/1180)) ([5294a81](https://github.com/uport-project/veramo/commit/5294a812ee578c0712b54f216416c3ef78c848da))\n\n\n\n\n\n# [5.3.0](https://github.com/uport-project/veramo/compare/v5.2.0...v5.3.0) (2023-07-27)\n\n**Note:** Version bump only for package @veramo/remote-server\n\n\n\n\n\n# [5.2.0](https://github.com/uport-project/veramo/compare/v5.1.4...v5.2.0) (2023-05-02)\n\n\n### Bug Fixes\n\n* **credential-ld:** fix Ed25519Signature2020 verification ([#1166](https://github.com/uport-project/veramo/issues/1166)) ([c965fd5](https://github.com/uport-project/veramo/commit/c965fd502f652c9929ae4753c56ebbe351447733))\n\n\n\n\n\n## [5.1.2](https://github.com/uport-project/veramo/compare/v5.1.1...v5.1.2) (2023-02-25)\n\n**Note:** Version bump only for package @veramo/remote-server\n\n\n\n\n\n# [5.1.0](https://github.com/uport-project/veramo/compare/v5.0.0...v5.1.0) (2023-02-24)\n\n**Note:** Version bump only for package @veramo/remote-server\n\n\n\n\n\n# [5.0.0](https://github.com/uport-project/veramo/compare/v4.3.0...v5.0.0) (2023-02-09)\n\n\n### Build System\n\n* convert veramo modules to ESM instead of CommonJS ([#1103](https://github.com/uport-project/veramo/issues/1103)) ([b5cea3c](https://github.com/uport-project/veramo/commit/b5cea3c0d80d900a47bd1d9eea68f84b70a35e7b)), closes [#1099](https://github.com/uport-project/veramo/issues/1099)\n\n\n### Features\n\n* increase request limit for express routers ([#1118](https://github.com/uport-project/veramo/issues/1118)) ([2db3149](https://github.com/uport-project/veramo/commit/2db314930e883fc599d5b670088e7be6475346a2)), closes [#1117](https://github.com/uport-project/veramo/issues/1117)\n* isolate `core-types` package from `core` ([#1116](https://github.com/uport-project/veramo/issues/1116)) ([ba7a303](https://github.com/uport-project/veramo/commit/ba7a303de91cf4cc568a3af1ddf8ca98ed022e9f))\n\n\n### BREAKING CHANGES\n\n* this is a breaking change as modules will have to be imported differently: \n* https://www.typescriptlang.org/docs/handbook/esm-node.html\n* https://nodejs.org/api/esm.html\n* https://caniuse.com/?search=modules\n\ntest(did-provider-ion): skip a couple of tests that fail with unreasonable errors\nchore: use ubuntu-latest on CI\nfix: temporarily remove puppeteer tests\nfix: use craco for test-react-app to enable babel config\ntest: fix unit and integration tests (browser tests still broken)\nfix: fix some build issues that prevented tests from working\nfix: missing deps flagged by pnpm\n\n\n\n\n\n# [4.3.0](https://github.com/uport-project/veramo/compare/v4.2.0...v4.3.0) (2023-01-27)\n\n**Note:** Version bump only for package @veramo/remote-server\n\n\n\n\n\n# [4.2.0](https://github.com/uport-project/veramo/compare/v4.1.2...v4.2.0) (2022-12-05)\n\n\n### Bug Fixes\n\n* **deps:** bump dependencies ([701b8ed](https://github.com/uport-project/veramo/commit/701b8edf981ea11c7ddb6a81d2817dbbdbb022f3))\n\n\n\n\n\n## [4.1.1](https://github.com/uport-project/veramo/compare/v4.1.0...v4.1.1) (2022-11-01)\n\n**Note:** Version bump only for package @veramo/remote-server\n\n\n\n\n\n# [4.1.0](https://github.com/uport-project/veramo/compare/v4.0.2...v4.1.0) (2022-10-31)\n\n\n### Bug Fixes\n\n* **deps:** Update dependency ethr-did-resolver to v7 ([#1038](https://github.com/uport-project/veramo/issues/1038)) ([d421c0f](https://github.com/uport-project/veramo/commit/d421c0f9f5934829df2930e58e98bcfce813ce84))\n\n\n### Features\n\n* add support for NIST Secp256r1 keys and ES256 signatures ([#1039](https://github.com/uport-project/veramo/issues/1039)) ([61eb369](https://github.com/uport-project/veramo/commit/61eb369cfcde7372babf3f68fb65ea2055b5bf70))\n\n\n\n\n\n# [4.0.0](https://github.com/uport-project/veramo/compare/v3.1.5...v4.0.0) (2022-09-22)\n\n\n### Bug Fixes\n\n* **deps:** update all non-major dependencies ([b537187](https://github.com/uport-project/veramo/commit/b537187ba04ba41cd45c18dfb58c92725b65b084))\n* **did-resolver:** use interface `Resolvable` instead of the `Resolver` class ([9c2e59f](https://github.com/uport-project/veramo/commit/9c2e59f3f23f808511c6c0e8e440b4d53ba5cb00))\n* **remote-server:** api-key-auth ([#772](https://github.com/uport-project/veramo/issues/772)) ([cbe6f35](https://github.com/uport-project/veramo/commit/cbe6f35e31c3a9e062d7f9c593253cb53b988e46)), closes [#771](https://github.com/uport-project/veramo/issues/771)\n* **remote-server:** web-did-doc-router options ([#777](https://github.com/uport-project/veramo/issues/777)) ([cc1ec7a](https://github.com/uport-project/veramo/commit/cc1ec7a0c510fcc2329bffcb33ee91fe8739ae5a))\n* update and fix inline documentation of all exported types ([#921](https://github.com/uport-project/veramo/issues/921)) ([63e64e0](https://github.com/uport-project/veramo/commit/63e64e0e2693808c4704dca8cc511dc0bab3f3b1))\n\n\n### Features\n\n* add key type definitions: 'Bls12381G1Key2020' and 'Bls12381G2Key2020' ([#839](https://github.com/uport-project/veramo/issues/839)) ([0f0f517](https://github.com/uport-project/veramo/commit/0f0f517d97230fd5334d604d4f20d575a14f8670))\n* add support for serviceEndpoint property as defined in latest DID Spec ([#988](https://github.com/uport-project/veramo/issues/988)) ([9bed70b](https://github.com/uport-project/veramo/commit/9bed70ba658aed34a97944e0dee27bca6c81d700))\n* **credential-ld:** add support for browser environments ([#916](https://github.com/uport-project/veramo/issues/916)) ([435e4d2](https://github.com/uport-project/veramo/commit/435e4d260b1774f96b182c1a75ab2f1c993f2291))\n\n\n### BREAKING CHANGES\n\n* the `did-resolver` and connected libraries change the data-type for `ServiceEndpoint` to `Service` and the previous semantic has changed. Services can have multiple endpoints, not just a single string.\n\n\n\n\n\n## [3.1.3](https://github.com/uport-project/veramo/compare/v3.1.2...v3.1.3) (2022-06-01)\n\n**Note:** Version bump only for package @veramo/remote-server\n\n\n\n\n\n## [3.1.2](https://github.com/uport-project/veramo/compare/v3.1.1...v3.1.2) (2022-05-30)\n\n\n### Bug Fixes\n\n* **remote-server:** fix error when resolving local did:web ([#905](https://github.com/uport-project/veramo/issues/905)) ([782f64a](https://github.com/uport-project/veramo/commit/782f64ace21c4710185fa80015b6435c8c37d088))\n\n\n\n\n\n## [3.1.1](https://github.com/uport-project/veramo/compare/v3.1.0...v3.1.1) (2022-01-13)\n\n\n### Bug Fixes\n\n* **remote-server:** api-key-auth ([#772](https://github.com/uport-project/veramo/issues/772)) ([6d1916b](https://github.com/uport-project/veramo/commit/6d1916b52f23aa818e023c35e6324ec5153e1a5c)), closes [#771](https://github.com/uport-project/veramo/issues/771)\n* **remote-server:** fix path for web-did-doc-router ([6bb1003](https://github.com/uport-project/veramo/commit/6bb10039434d45de3ffcc22bcfeadf796c774b08))\n\n\n\n\n\n# [3.1.0](https://github.com/uport-project/veramo/compare/v3.0.0...v3.1.0) (2021-11-12)\n\n\n### Bug Fixes\n\n* **deps:** update dependency passport to ^0.5.0 ([a4dae24](https://github.com/uport-project/veramo/commit/a4dae24c8e8b2bf9e061e182076c1b89b71df306))\n\n\n### Features\n\n* **did-comm:** didcomm messaging using did:ethr ([#744](https://github.com/uport-project/veramo/issues/744)) ([1be5e04](https://github.com/uport-project/veramo/commit/1be5e04e09112c0823d776fe2d55117d71a7b448)), closes [#743](https://github.com/uport-project/veramo/issues/743)\n* **remote-server:** add default services option for WebDidDocRouter ([#715](https://github.com/uport-project/veramo/issues/715)) ([cfa6431](https://github.com/uport-project/veramo/commit/cfa64319a6ca27ec29330ea743104d0fa1a7eba0))\n* **remote-server:** add MessagingRouter `save` option ([#713](https://github.com/uport-project/veramo/issues/713)) ([0ca9b44](https://github.com/uport-project/veramo/commit/0ca9b448db8b467630a14bc64343082af29bc725))\n\n\n\n\n\n# [3.0.0](https://github.com/uport-project/veramo/compare/v2.1.3...v3.0.0) (2021-09-20)\n\n**Note:** Version bump only for package @veramo/remote-server\n\n\n\n\n\n# [2.1.0](https://github.com/uport-project/veramo/compare/v2.0.1...v2.1.0) (2021-08-11)\n\n**Note:** Version bump only for package @veramo/remote-server\n\n\n\n\n\n# [2.0.0](https://github.com/uport-project/veramo/compare/v1.2.2...v2.0.0) (2021-07-14)\n\n\n### Bug Fixes\n\n* **remote-server:** create an Ed25519 key for the default did:web ([a2f7f8c](https://github.com/uport-project/veramo/commit/a2f7f8c3fc6ab6cc276f6853104386bf9d923424))\n* **remote-server:** list DIDCommMessaging service entry by default for did:web ([339201a](https://github.com/uport-project/veramo/commit/339201a30f2f95f9b92251f233fb426d8290274f))\n\n\n### Features\n\n* add support for did-comm over simple HTTP-based transports ([#610](https://github.com/uport-project/veramo/issues/610)) ([78836a4](https://github.com/uport-project/veramo/commit/78836a46d3ce71b568acaa98558b64f9c2b98167)), closes [#552](https://github.com/uport-project/veramo/issues/552) [#469](https://github.com/uport-project/veramo/issues/469)\n* **remote-server:** express keys properly in did:web doc ([c33e39e](https://github.com/uport-project/veramo/commit/c33e39e6e33f5976aa4e5ff27ed3675b22113119)), closes [#618](https://github.com/uport-project/veramo/issues/618)\n\n\n\n\n\n# [1.2.0](https://github.com/uport-project/veramo/compare/v1.1.2...v1.2.0) (2021-04-27)\n\n\n### Bug Fixes\n\n* **deps:** update all non-major dependencies ([#462](https://github.com/uport-project/veramo/issues/462)) ([4a2b206](https://github.com/uport-project/veramo/commit/4a2b20633810b45a155bf2149cbff57d157bda3c))\n* **remote-server:** get alias for request ([#455](https://github.com/uport-project/veramo/issues/455)) ([6ef7e3a](https://github.com/uport-project/veramo/commit/6ef7e3a8b45e5b25961cdadfd6f4026372e9d73f))\n* use URI encoded host in web-did-doc-router ([#384](https://github.com/uport-project/veramo/issues/384)) ([37186d5](https://github.com/uport-project/veramo/commit/37186d5cbdbbdbdccf0b6b9c56b1f78a482d1193)), closes [#383](https://github.com/uport-project/veramo/issues/383)\n\n\n### Features\n\n* adapt to did core spec ([#430](https://github.com/uport-project/veramo/issues/430)) ([9712db0](https://github.com/uport-project/veramo/commit/9712db0eea1a3f48cf0665d66ae715ea0c23cd4a)), closes [#418](https://github.com/uport-project/veramo/issues/418) [#428](https://github.com/uport-project/veramo/issues/428) [#417](https://github.com/uport-project/veramo/issues/417) [#416](https://github.com/uport-project/veramo/issues/416) [#412](https://github.com/uport-project/veramo/issues/412) [#397](https://github.com/uport-project/veramo/issues/397) [#384](https://github.com/uport-project/veramo/issues/384) [#394](https://github.com/uport-project/veramo/issues/394)\n\n\n\n\n\n# [1.1.0](https://github.com/uport-project/veramo/compare/v1.0.1...v1.1.0) (2021-01-26)\n\n**Note:** Version bump only for package @veramo/remote-server\n\n\n\n\n\n## 1.0.1 (2020-12-18)\n\n**Note:** Version bump only for package @veramo/remote-server\n"
  },
  {
    "path": "packages/remote-server/LICENSE",
    "content": "                                 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 2019 Consensys AG\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"
  },
  {
    "path": "packages/remote-server/README.md",
    "content": "# Veramo Express\n\nA utility module that contains express.js routers to:\n\n* expose some agent methods to other agents or APIs\n* serve open API schema for these methods\n* serve did:web did documents\n"
  },
  {
    "path": "packages/remote-server/api-extractor.json",
    "content": "{\n  \"$schema\": \"https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json\",\n  \"apiReport\": {\n    \"enabled\": true,\n    \"reportFolder\": \"./api\",\n    \"reportTempFolder\": \"./api\"\n  },\n\n  \"docModel\": {\n    \"enabled\": true,\n    \"apiJsonFilePath\": \"./api/<unscopedPackageName>.api.json\"\n  },\n\n  \"dtsRollup\": {\n    \"enabled\": false\n  },\n  \"mainEntryPointFilePath\": \"<projectFolder>/build/index.d.ts\"\n}\n"
  },
  {
    "path": "packages/remote-server/package.json",
    "content": "{\n  \"name\": \"@veramo/remote-server\",\n  \"description\": \"Express.js module that can expose some agent methods and messaging endpoints\",\n  \"version\": \"7.0.0\",\n  \"main\": \"build/index.js\",\n  \"exports\": \"./build/index.js\",\n  \"types\": \"build/index.d.ts\",\n  \"scripts\": {\n    \"build\": \"tsc\",\n    \"extract-api\": \"node ../cli/bin/veramo.js dev extract-api\"\n  },\n  \"dependencies\": {\n    \"@veramo/core-types\": \"workspace:^\",\n    \"@veramo/remote-client\": \"workspace:^\",\n    \"@veramo/utils\": \"workspace:^\",\n    \"debug\": \"^4.3.3\",\n    \"did-resolver\": \"^4.1.0\",\n    \"express\": \"^4.18.2\",\n    \"passport\": \"^0.6.0\",\n    \"passport-http-bearer\": \"^1.0.1\",\n    \"url-parse\": \"^1.5.4\"\n  },\n  \"devDependencies\": {\n    \"@types/debug\": \"4.1.8\",\n    \"@types/express\": \"4.17.17\",\n    \"@types/passport\": \"1.0.12\",\n    \"@types/passport-http-bearer\": \"1.0.37\",\n    \"@types/url-parse\": \"1.4.8\",\n    \"typescript\": \"5.7.3\"\n  },\n  \"peerDependencies\": {\n    \"express\": \"^4.18.2\"\n  },\n  \"files\": [\n    \"build/**/*\",\n    \"src/**/*\",\n    \"README.md\",\n    \"LICENSE\"\n  ],\n  \"publishConfig\": {\n    \"access\": \"public\"\n  },\n  \"repository\": {\n    \"type\": \"git\",\n    \"url\": \"https://github.com/decentralized-identity/veramo.git\",\n    \"directory\": \"packages/remote-server\"\n  },\n  \"author\": \"Consensys Mesh R&D <hello@veramo.io>\",\n  \"contributors\": [\n    \"Simonas Karuzas <simonas.karuzas@mesh.xyz>\",\n    \"Mircea Nistor <mircea.nistor@mesh.xyz>\"\n  ],\n  \"keywords\": [\n    \"Veramo\",\n    \"DID\",\n    \"Verifiable Credential\",\n    \"veramo-plugin\",\n    \"remote\",\n    \"did:web\",\n    \"OpenAPI\",\n    \"Swagger\"\n  ],\n  \"license\": \"Apache-2.0\",\n  \"type\": \"module\",\n  \"moduleDirectories\": [\n    \"node_modules\",\n    \"src\"\n  ]\n}\n"
  },
  {
    "path": "packages/remote-server/src/agent-router.ts",
    "content": "import { IAgent } from '@veramo/core-types'\nimport { Request, Response, NextFunction, Router, json } from 'express'\nimport Debug from 'debug'\n\ninterface RequestWithAgent extends Request {\n  agent?: IAgent\n}\n\n/**\n * @public\n */\nexport interface AgentRouterOptions {\n  /**\n   * List of exposed methods\n   */\n  exposedMethods: Array<string>\n}\n\n/**\n * Creates a router that exposes {@link @veramo/core#Agent} methods remotely.\n *\n * This can be used by {@link @veramo/remote-client#AgentRestClient | AgentRestClient} to instantiate the methods of\n * this agent on the client.\n *\n * @param options - Initialization option\n * @returns Expressjs router\n *\n * @public\n */\nexport const AgentRouter = (options: AgentRouterOptions): Router => {\n  const router = Router()\n  router.use(json({ limit: '10mb' }))\n\n  for (const exposedMethod of options.exposedMethods) {\n    Debug('veramo:remote-server:initializing')(exposedMethod)\n\n    router.post('/' + exposedMethod, async (req: RequestWithAgent, res: Response, next: NextFunction) => {\n      if (!req.agent) throw Error('Agent not available')\n      try {\n        const result = await req.agent.execute(exposedMethod, req.body)\n        res.status(200).json(result)\n      } catch (e: any) {\n        if (e.name === 'ValidationError') {\n          res.status(400).json({\n            name: 'ValidationError',\n            message: e.message,\n            method: e.method,\n            path: e.path,\n            code: e.code,\n            description: e.description,\n          })\n        } else {\n          res.status(500).json({ error: e.message })\n        }\n      }\n    })\n  }\n\n  return router\n}\n"
  },
  {
    "path": "packages/remote-server/src/api-key-auth.ts",
    "content": "import passport from 'passport'\nimport Bearer from 'passport-http-bearer'\nimport { Router } from 'express'\n\n/**\n * This provides a simple authorization mechanism based on a single pre-shared API key.\n *\n * @param apiKey - the pre-shared API key\n *\n * @public\n */\nexport function apiKeyAuth({ apiKey }: { apiKey: string }): Router {\n  const router = Router()\n  router.use(passport.initialize())\n  passport.use(\n    new Bearer.Strategy((token, done) => {\n      if (!apiKey || apiKey === token) {\n        done(null, {}, { scope: 'all' })\n      } else {\n        done(null, false)\n      }\n    }),\n  )\n  router.use(passport.authenticate('bearer', { session: false }))\n  return router\n}\n"
  },
  {
    "path": "packages/remote-server/src/api-schema-router.ts",
    "content": "import { Router } from 'express'\nimport { getOpenApiSchema } from '@veramo/remote-client'\nimport { RequestWithAgent } from './request-agent-router.js'\n\n/**\n * @public\n */\nexport interface ApiSchemaRouterOptions {\n  /**\n   * List of exposed methods\n   */\n  exposedMethods?: Array<string>\n\n  /**\n   * Base path\n   */\n  basePath: string\n\n  /**\n   * Security scheme\n   * @example\n   * ```\n   * 'bearer'\n   * ```\n   */\n  securityScheme?: string\n\n  /**\n   * Name used in OpenAPI schema\n   */\n  apiName?: string\n\n  /**\n   * Version used in OpenAPI schema\n   */\n  apiVersion?: string\n}\n\n/**\n * Creates a router that exposes {@link @veramo/core#Agent} OpenAPI schema\n *\n * @param options - Initialization option\n * @returns Expressjs router\n *\n * @public\n */\nexport const ApiSchemaRouter = (options: ApiSchemaRouterOptions): Router => {\n  const router = Router()\n\n  router.get('/', (req: RequestWithAgent, res) => {\n    if (req.agent) {\n      const openApiSchema = getOpenApiSchema(\n        req.agent,\n        '',\n        options.exposedMethods || req.agent?.availableMethods(),\n        options.apiName,\n        options.apiVersion,\n      )\n      const url = (req.headers['x-forwarded-proto'] || req.protocol) + '://' + req.hostname + options.basePath\n      openApiSchema.servers = [{ url }]\n\n      if (options.securityScheme && openApiSchema.components) {\n        openApiSchema.components.securitySchemes = {\n          auth: { type: 'http', scheme: options.securityScheme },\n        }\n        openApiSchema.security = [{ auth: [] }]\n      }\n\n      res.json(openApiSchema)\n    } else {\n      res.status(500).json({ error: 'Agent not available' })\n    }\n  })\n\n  return router\n}\n"
  },
  {
    "path": "packages/remote-server/src/default-did.ts",
    "content": "import parse from 'url-parse'\n\nimport { IDIDManager, TAgent, TKeyType } from '@veramo/core-types'\n\ninterface CreateDefaultDidOptions {\n  agent: TAgent<IDIDManager>\n  baseUrl: string\n  messagingServiceEndpoint?: string\n}\n\n/**\n * This can be used to automatically create a did:web with signing and encryption keys and listing messaging and\n * DIDComm service endpoints.\n *\n * @param options - The options guiding the creation of the default DID\n *\n * @beta This API may change without a BREAKING CHANGE notice.\n */\nexport async function createDefaultDid(options: CreateDefaultDidOptions) {\n  if (!options.agent) throw Error('[createDefaultDid] Agent is required')\n  if (!options.baseUrl) throw Error('[createDefaultDid] baseUrl is required')\n\n  const hostname = parse(options.baseUrl).hostname\n\n  const serverIdentifier = await options?.agent?.didManagerGetOrCreate({\n    provider: 'did:web',\n    alias: hostname,\n    options: {\n      keyType: <TKeyType>'Ed25519',\n    },\n  })\n  console.log('🆔', serverIdentifier?.did)\n\n  if (serverIdentifier && options.messagingServiceEndpoint) {\n    const messagingServiceEndpoint = options.baseUrl + options.messagingServiceEndpoint\n\n    console.log('📨 Messaging endpoint', messagingServiceEndpoint)\n    await options?.agent?.didManagerAddService({\n      did: serverIdentifier.did,\n      service: {\n        id: serverIdentifier.did + '#msg',\n        type: 'Messaging',\n        description: 'Handles incoming POST messages',\n        serviceEndpoint: messagingServiceEndpoint,\n      },\n    })\n    // list DIDCommMessaging service at the same endpoint\n    await options?.agent?.didManagerAddService({\n      did: serverIdentifier.did,\n      service: {\n        id: serverIdentifier.did + '#msg-didcomm',\n        type: 'DIDCommMessaging',\n        description: 'Handles incoming DIDComm messages',\n        serviceEndpoint: messagingServiceEndpoint,\n      },\n    })\n  }\n}\n"
  },
  {
    "path": "packages/remote-server/src/index.ts",
    "content": "/**\n * {@link https://expressjs.com | Express} router for exposing `@veramo/remote-client` OpenAPI schema\n *\n * @example\n * ```typescript\n * import express from 'express'\n * import { agent } from './agent'\n * import { AgentRouter, ApiSchemaRouter, WebDidDocRouter } from '@veramo/remote-server'\n *\n * const getAgentForRequest = async (req: express.Request) => agent\n * const exposedMethods = agent.availableMethods()\n * const basePath = '/agent'\n * const schemaPath = '/open-api.json'\n *\n * const agentRouter = AgentRouter({\n *   getAgentForRequest,\n *   exposedMethods,\n * })\n *\n * const schemaRouter = ApiSchemaRouter({\n *  basePath,\n *  getAgentForRequest,\n *  exposedMethods,\n * })\n *\n * const didDocRouter = WebDidDocRouter({\n *   getAgentForRequest\n * })\n *\n * const app = express()\n * app.use(basePath, agentRouter)\n * app.use(schemaPath, schemaRouter)\n * app.use(didDocRouter)\n * app.listen(3002)\n * ```\n *\n * @packageDocumentation\n */\n\nexport { AgentRouter, AgentRouterOptions } from './agent-router.js'\nexport { ApiSchemaRouter, ApiSchemaRouterOptions } from './api-schema-router.js'\nexport { WebDidDocRouter, didDocEndpoint } from './web-did-doc-router.js'\nexport { apiKeyAuth } from './api-key-auth.js'\nexport { RequestWithAgentRouter } from './request-agent-router.js'\nexport { MessagingRouter } from './messaging-router.js'\nexport { createDefaultDid } from './default-did.js'\n"
  },
  {
    "path": "packages/remote-server/src/messaging-router.ts",
    "content": "import { IMessageHandler, TAgent } from '@veramo/core-types'\nimport { Request, Router, text } from 'express'\n\ninterface RequestWithMessageHandler extends Request {\n  agent?: TAgent<IMessageHandler>\n}\n\n/**\n * @public\n */\nexport interface MessagingRouterOptions {\n  /**\n   * Message metadata\n   */\n  metaData: {\n    type: string\n    value?: string\n  }\n\n  /**\n   * Optional. true by default\n   */\n  save?: boolean\n}\n\n/**\n * Creates a router for handling incoming messages.\n *\n * Messages posted to this router get sent to the `handleMessage` method of the associated agent where this is used.\n *\n * @param options - Initialization option\n * @returns Expressjs router\n *\n * @public\n */\nexport const MessagingRouter = (options: MessagingRouterOptions): Router => {\n  const router = Router()\n  router.use(text({ type: '*/*', limit: '10mb' }))\n  router.post('/', async (req: RequestWithMessageHandler, res) => {\n    try {\n      const message = await req.agent?.handleMessage({\n        raw: req.body as any as string,\n        metaData: [options.metaData],\n        save: typeof options.save === 'undefined' ? true : options.save,\n      })\n\n      const returnRouteResponse = message?.metaData?.find((v) => v.type === 'ReturnRouteResponse')\n      if (returnRouteResponse && returnRouteResponse.value) {\n        const returnMessage = JSON.parse(returnRouteResponse.value)\n        res.contentType(returnMessage.contentType).json(returnMessage.message)\n        req.agent?.emit('DIDCommV2Message-sent', returnMessage.id)\n      } else if (message) {\n        res.json({ id: message.id })\n      }\n    } catch (e: any) {\n      console.error(e)\n      res.status(400).send(e.message)\n    }\n  })\n\n  return router\n}\n"
  },
  {
    "path": "packages/remote-server/src/request-agent-router.ts",
    "content": "import { IAgent } from '@veramo/core-types'\nimport { Request, Router } from 'express'\n\nexport interface RequestWithAgent extends Request {\n  agent?: IAgent\n}\n\n/**\n * @public\n */\nexport interface RequestWithAgentRouterOptions {\n  /**\n   * Optional. Pre-configured agent\n   */\n  agent?: IAgent\n\n  /**\n   * Optional. Function that returns a Promise that resolves to a configured agent for specific request\n   */\n  getAgentForRequest?: (req: Request) => Promise<IAgent>\n}\n\n/**\n * Creates an expressjs router that adds a Veramo agent to the request object.\n *\n * This is needed by all other routers provided by this package to be able to perform their functions.\n *\n * @param options - Initialization option\n * @returns Expressjs router\n *\n * @public\n */\nexport const RequestWithAgentRouter = (options: RequestWithAgentRouterOptions): Router => {\n  const router = Router()\n  router.use(async (req: RequestWithAgent, res, next) => {\n    if (options.agent) {\n      req.agent = options.agent\n    } else if (options.getAgentForRequest) {\n      req.agent = await options.getAgentForRequest(req)\n    } else {\n      throw Error('[RequestWithAgentRouter] agent or getAgentForRequest is required')\n    }\n    next()\n  })\n\n  return router\n}\n"
  },
  {
    "path": "packages/remote-server/src/web-did-doc-router.ts",
    "content": "import { IIdentifier, IDIDManager, TAgent, TKeyType, IKey } from '@veramo/core-types'\nimport { bytesToBase58, bytesToMultibase, hexToBytes } from '@veramo/utils'\nimport { Request, Router } from 'express'\nimport { ServiceEndpoint, VerificationMethod } from 'did-resolver'\n\ninterface RequestWithAgentDIDManager extends Request {\n  agent?: TAgent<IDIDManager>\n}\n\n/**\n * The URL path to the DID document, used by did:web when the identifier is a hostname.\n *\n * @public\n */\nexport const didDocEndpoint = '/.well-known/did.json'\n\nconst keyMapping: Record<TKeyType, string> = {\n  Secp256k1: 'EcdsaSecp256k1VerificationKey2019',\n  Secp256r1: 'EcdsaSecp256r1VerificationKey2019',\n  Ed25519: 'Ed25519VerificationKey2018',\n  X25519: 'X25519KeyAgreementKey2019',\n  Bls12381G1: 'Bls12381G1Key2020',\n  Bls12381G2: 'Bls12381G2Key2020',\n}\n\n/**\n * @public\n */\nexport interface WebDidDocRouterOptions {\n  services?: ServiceEndpoint[]\n}\n\n/**\n * Creates a router that serves `did:web` DID Documents\n *\n * @param options - Initialization option\n * @returns Expressjs router\n *\n * @public\n */\nexport const WebDidDocRouter = (options: WebDidDocRouterOptions): Router => {\n  const router = Router()\n\n  const didDocForIdentifier = (identifier: IIdentifier) => {\n    const contexts = new Set<string>()\n    const allKeys: VerificationMethod[] = identifier.keys.map((key: IKey) => {\n      const vm: VerificationMethod = {\n        id: identifier.did + '#' + key.kid,\n        type: keyMapping[key.type],\n        controller: identifier.did,\n        publicKeyHex: key.publicKeyHex,\n      }\n      switch (vm.type) {\n        case 'EcdsaSecp256k1VerificationKey2019':\n        case 'EcdsaSecp256k1RecoveryMethod2020':\n          contexts.add('https://w3id.org/security/v2')\n          contexts.add('https://w3id.org/security/suites/secp256k1recovery-2020/v2')\n          break\n        case 'Ed25519VerificationKey2018':\n          contexts.add('https://w3id.org/security/suites/ed25519-2018/v1')\n          vm.publicKeyBase58 = bytesToBase58(hexToBytes(key.publicKeyHex))\n          delete(vm.publicKeyHex)\n          break\n        case 'X25519KeyAgreementKey2019':\n          contexts.add('https://w3id.org/security/suites/x25519-2019/v1')\n          vm.publicKeyBase58 = bytesToBase58(hexToBytes(key.publicKeyHex))\n          delete(vm.publicKeyHex)\n          break\n        case 'Ed25519VerificationKey2020':\n          contexts.add('https://w3id.org/security/suites/ed25519-2020/v1')\n          vm.publicKeyMultibase = bytesToMultibase(hexToBytes(key.publicKeyHex), 'base58btc', 'ed25519-pub')\n          delete(vm.publicKeyHex)\n          break\n        case 'X25519KeyAgreementKey2020':\n          contexts.add('https://w3id.org/security/suites/x25519-2020/v1')\n          vm.publicKeyMultibase = bytesToMultibase(hexToBytes(key.publicKeyHex), 'base58btc', 'x25519-pub')\n          delete(vm.publicKeyHex)\n          break\n        case 'EcdsaSecp256r1VerificationKey2019':\n          contexts.add('https://w3id.org/security/v2')\n          break\n        case 'Bls12381G1Key2020':\n        case 'Bls12381G2Key2020':\n          contexts.add('https://w3id.org/security/bbs/v1')\n          break\n        default:\n          break\n      }\n      return vm\n    })\n    // ed25519 keys can also be converted to x25519 for key agreement\n    const keyAgreementKeyIds = allKeys\n      .filter((key) => ['Ed25519VerificationKey2018', 'X25519KeyAgreementKey2019'].includes(key.type))\n      .map((key) => key.id)\n    const signingKeyIds = allKeys\n      .filter((key) => key.type !== 'X25519KeyAgreementKey2019')\n      .map((key) => key.id)\n\n    const didDoc = {\n      '@context': ['https://www.w3.org/ns/did/v1', ...contexts],\n      id: identifier.did,\n      verificationMethod: allKeys,\n      authentication: signingKeyIds,\n      assertionMethod: signingKeyIds,\n      keyAgreement: keyAgreementKeyIds,\n      service: [...(options?.services || []), ...(identifier?.services || [])],\n    }\n\n    return didDoc\n  }\n\n  const getAliasForRequest = (req: Request) => {\n    return encodeURIComponent(req.get('host') || req.hostname)\n  }\n\n  router.get(didDocEndpoint, async (req: RequestWithAgentDIDManager, res) => {\n    if (req.agent) {\n      try {\n        const serverIdentifier = await req.agent.didManagerGet({\n          did: 'did:web:' + getAliasForRequest(req),\n        })\n        const didDoc = didDocForIdentifier(serverIdentifier)\n        res.json(didDoc)\n      } catch (e) {\n        console.error('Error resolving did:web:', e)\n        res.status(404).send('Unable to resolve DID document')\n      }\n    }\n  })\n\n  router.get(/^\\/(.+)\\/did.json$/, async (req: RequestWithAgentDIDManager, res) => {\n    if (req.agent) {\n      try {\n        const identifier = await req.agent.didManagerGet({\n          did: 'did:web:' + getAliasForRequest(req) + ':' + req.params[0].replace(/\\//g, ':'),\n        })\n        const didDoc = didDocForIdentifier(identifier)\n        res.json(didDoc)\n      } catch (e) {\n        console.error('Error resolving did:web:', e)\n        res.status(404).send('Unable to resolve DID document')\n      }\n    }\n  })\n\n  return router\n}\n"
  },
  {
    "path": "packages/remote-server/tsconfig.json",
    "content": "{\n  \"extends\": \"../tsconfig.settings.json\",\n  \"compilerOptions\": {\n    \"rootDir\": \"src\",\n    \"outDir\": \"build\",\n    \"declarationDir\": \"build\"\n  },\n  \"references\": [\n    {\n      \"path\": \"../core-types\"\n    },\n    {\n      \"path\": \"../remote-client\"\n    },\n    {\n      \"path\": \"../utils\"\n    }\n  ]\n}\n"
  },
  {
    "path": "packages/selective-disclosure/CHANGELOG.md",
    "content": "# Change Log\n\nAll notable changes to this project will be documented in this file.\nSee [Conventional Commits](https://conventionalcommits.org) for commit guidelines.\n\n# [7.0.0](https://github.com/decentralized-identity/veramo/compare/v6.0.2...v7.0.0) (2026-02-11)\n\n\n### Bug Fixes\n\n* **deps:** update dependency uuid to v11 ([#1431](https://github.com/decentralized-identity/veramo/issues/1431)) ([6ad84d9](https://github.com/decentralized-identity/veramo/commit/6ad84d91f02794e741e4b770e29e1ee9a93edcfb))\n* **deps:** update devdeps and bump typeorm to 0.3.20 ([#1272](https://github.com/decentralized-identity/veramo/issues/1272)) ([7d17f37](https://github.com/decentralized-identity/veramo/commit/7d17f37ea7cc4e73a8cdae028681ae1be5c4d11c))\n\n\n### Features\n\n* **credential-w3c:** refactor the ICredentialProvider API ([#1488](https://github.com/decentralized-identity/veramo/issues/1488)) ([cbd848d](https://github.com/decentralized-identity/veramo/commit/cbd848d4ce2b52497d99d335f1c93bd8b005cdb2))\n* **credential-w3c:** remove hardcoded proof formats ([#1395](https://github.com/decentralized-identity/veramo/issues/1395)) ([5b7d3fa](https://github.com/decentralized-identity/veramo/commit/5b7d3fad7d2ada4954f8020a6474df13d9fe51dc))\n\n\n### BREAKING CHANGES\n\n* **credential-w3c:** This changeset, along with the previous changes in #1395 modify the CredentialPlugin to support extensibility without modifications to the veramo repository. This plugin now acts as an orchestrator for other ICredentialProvider implementations that provide the actual support for various verifiable data formats. ICredentialProvider implementations can be implemented externally and used with this plugin.\n* **credential-w3c:** The credential plugins specializing in JSON-LD / EIP712 are no longer top level veramo plugins but are now managed by the `@veramo/credential-w3c` plugin which will be able to use multiple proof formats and multiplex accordingly. The constructor for the `CredentialPlugin` has changed to accept different implementations of proof formats.\n\n\n\n\n\n## [6.0.2](https://github.com/decentralized-identity/veramo/compare/v6.0.1...v6.0.2) (2026-01-16)\n\n**Note:** Version bump only for package @veramo/selective-disclosure\n\n\n\n\n\n## [6.0.1](https://github.com/decentralized-identity/veramo/compare/v6.0.0...v6.0.1) (2026-01-16)\n\n**Note:** Version bump only for package @veramo/selective-disclosure\n\n\n\n\n\n# [6.0.0](https://github.com/decentralized-identity/veramo/compare/v5.6.0...v6.0.0) (2024-04-02)\n\n\n### Bug Fixes\n\n* export const plugin schemas instead of defaults ([#1327](https://github.com/decentralized-identity/veramo/issues/1327)) ([7896cea](https://github.com/decentralized-identity/veramo/commit/7896ceaf2c79993eee44e46950814bea74bfe647)), closes [#1318](https://github.com/decentralized-identity/veramo/issues/1318) [#1317](https://github.com/decentralized-identity/veramo/issues/1317) [#1315](https://github.com/decentralized-identity/veramo/issues/1315)\n* **selective-disclosure:** deprecate the uPort SelectiveDisclosure plugin ([#1307](https://github.com/decentralized-identity/veramo/issues/1307)) ([71e313f](https://github.com/decentralized-identity/veramo/commit/71e313f894baaad08bf322f56b36d92d7c667ba9))\n\n\n### Code Refactoring\n\n* generate plugin schemas as TS instead of JSON ([#1315](https://github.com/decentralized-identity/veramo/issues/1315)) ([65c2d4b](https://github.com/decentralized-identity/veramo/commit/65c2d4bc814daa9a3a89f4f7b8e8c6973b8ce2f0)), closes [#1254](https://github.com/decentralized-identity/veramo/issues/1254)\n\n\n### Features\n\n* add Multikey support ([#1316](https://github.com/decentralized-identity/veramo/issues/1316)) ([165de35](https://github.com/decentralized-identity/veramo/commit/165de3549ccfd3d7c84514608ac3ea9e56a7b807))\n\n\n### BREAKING CHANGES\n\n* The `plugin.schema.json` files are now generated as `plugin.schema.ts`.\n\n\n\n\n\n# [5.6.0](https://github.com/decentralized-identity/veramo/compare/v5.5.3...v5.6.0) (2024-01-16)\n\n\n### Features\n\n* **remote-client:** allow dynamic headers param for AgentRestClient constructor ([#1314](https://github.com/decentralized-identity/veramo/issues/1314)) ([1b8a0a2](https://github.com/decentralized-identity/veramo/commit/1b8a0a2718dd63492ad3a312a6ebe5f6e7849935)), closes [#1313](https://github.com/decentralized-identity/veramo/issues/1313)\n\n\n\n\n\n## [5.5.3](https://github.com/decentralized-identity/veramo/compare/v5.5.2...v5.5.3) (2023-10-09)\n\n\n### Bug Fixes\n\n* use DIF URLs in packages ([#1271](https://github.com/decentralized-identity/veramo/issues/1271)) ([3dfc601](https://github.com/decentralized-identity/veramo/commit/3dfc6014cdee7902c59d8db76b4c8507b870f227))\n\n\n\n\n\n# [5.5.0](https://github.com/uport-project/veramo/compare/v5.4.1...v5.5.0) (2023-09-19)\n\n\n### Bug Fixes\n\n* **did-provider-key:** use compressed keys for creating Secp256k1 did:key ([#1217](https://github.com/uport-project/veramo/issues/1217)) ([ba8f6f5](https://github.com/uport-project/veramo/commit/ba8f6f5b9b701e57af86491504ecd209ca0c1c1d)), closes [#1213](https://github.com/uport-project/veramo/issues/1213)\n\n\n### Features\n\n* **core-types:** export a basic mapping between key types and algorithms ([57b6c58](https://github.com/uport-project/veramo/commit/57b6c583138b0f8f283f4f00b27573529f394a7a))\n* **selective-disclosure:** support multiple key types for generating requests ([3406a04](https://github.com/uport-project/veramo/commit/3406a04d0ee3c2b637abd774d3cd3fda78fd413d)), closes [#946](https://github.com/uport-project/veramo/issues/946)\n\n\n\n\n\n## [5.4.1](https://github.com/uport-project/veramo/compare/v5.4.0...v5.4.1) (2023-08-04)\n\n\n### Bug Fixes\n\n* **ci:** benign change meant to tag all packages for another patch release ([#1211](https://github.com/uport-project/veramo/issues/1211)) ([41b5c90](https://github.com/uport-project/veramo/commit/41b5c90277171b7b38c5cf49ca01db5cf75b6300))\n\n\n\n\n\n# [5.4.0](https://github.com/uport-project/veramo/compare/v5.3.0...v5.4.0) (2023-08-01)\n\n\n### Features\n\n* **credential-w3c:** allow issuers with query parameters for credentials and presentations ([#1207](https://github.com/uport-project/veramo/issues/1207)) ([688f59d](https://github.com/uport-project/veramo/commit/688f59d6b492bc25bc51bbe73be969d6c30a958d)), closes [#1201](https://github.com/uport-project/veramo/issues/1201)\n* **did-comm:** add support for the AES based content and key encryption algorithms ([#1180](https://github.com/uport-project/veramo/issues/1180)) ([5294a81](https://github.com/uport-project/veramo/commit/5294a812ee578c0712b54f216416c3ef78c848da))\n\n\n\n\n\n# [5.3.0](https://github.com/uport-project/veramo/compare/v5.2.0...v5.3.0) (2023-07-27)\n\n**Note:** Version bump only for package @veramo/selective-disclosure\n\n\n\n\n\n# [5.2.0](https://github.com/uport-project/veramo/compare/v5.1.4...v5.2.0) (2023-05-02)\n\n**Note:** Version bump only for package @veramo/selective-disclosure\n\n\n\n\n\n## [5.1.2](https://github.com/uport-project/veramo/compare/v5.1.1...v5.1.2) (2023-02-25)\n\n**Note:** Version bump only for package @veramo/selective-disclosure\n\n\n\n\n\n# [5.1.0](https://github.com/uport-project/veramo/compare/v5.0.0...v5.1.0) (2023-02-24)\n\n\n### Features\n\n* **core-types:** allow inline [@context](https://github.com/context) for Credentials and Presentations ([#1119](https://github.com/uport-project/veramo/issues/1119)) ([44bb365](https://github.com/uport-project/veramo/commit/44bb36503b635ee1f5431cb4bf28c7a9ba111156)), closes [#1073](https://github.com/uport-project/veramo/issues/1073)\n\n\n\n\n\n# [5.0.0](https://github.com/uport-project/veramo/compare/v4.3.0...v5.0.0) (2023-02-09)\n\n\n### Build System\n\n* convert veramo modules to ESM instead of CommonJS ([#1103](https://github.com/uport-project/veramo/issues/1103)) ([b5cea3c](https://github.com/uport-project/veramo/commit/b5cea3c0d80d900a47bd1d9eea68f84b70a35e7b)), closes [#1099](https://github.com/uport-project/veramo/issues/1099)\n\n\n### Features\n\n* isolate `core-types` package from `core` ([#1116](https://github.com/uport-project/veramo/issues/1116)) ([ba7a303](https://github.com/uport-project/veramo/commit/ba7a303de91cf4cc568a3af1ddf8ca98ed022e9f))\n\n\n### BREAKING CHANGES\n\n* this is a breaking change as modules will have to be imported differently: \n* https://www.typescriptlang.org/docs/handbook/esm-node.html\n* https://nodejs.org/api/esm.html\n* https://caniuse.com/?search=modules\n\ntest(did-provider-ion): skip a couple of tests that fail with unreasonable errors\nchore: use ubuntu-latest on CI\nfix: temporarily remove puppeteer tests\nfix: use craco for test-react-app to enable babel config\ntest: fix unit and integration tests (browser tests still broken)\nfix: fix some build issues that prevented tests from working\nfix: missing deps flagged by pnpm\n\n\n\n\n\n# [4.3.0](https://github.com/uport-project/veramo/compare/v4.2.0...v4.3.0) (2023-01-27)\n\n**Note:** Version bump only for package @veramo/selective-disclosure\n\n\n\n\n\n# [4.2.0](https://github.com/uport-project/veramo/compare/v4.1.2...v4.2.0) (2022-12-05)\n\n\n### Bug Fixes\n\n* **deps:** bump dependencies ([701b8ed](https://github.com/uport-project/veramo/commit/701b8edf981ea11c7ddb6a81d2817dbbdbb022f3))\n\n\n\n\n\n## [4.1.1](https://github.com/uport-project/veramo/compare/v4.1.0...v4.1.1) (2022-11-01)\n\n**Note:** Version bump only for package @veramo/selective-disclosure\n\n\n\n\n\n# [4.1.0](https://github.com/uport-project/veramo/compare/v4.0.2...v4.1.0) (2022-10-31)\n\n\n### Bug Fixes\n\n* **deps:** Update dependency ethr-did-resolver to v7 ([#1038](https://github.com/uport-project/veramo/issues/1038)) ([d421c0f](https://github.com/uport-project/veramo/commit/d421c0f9f5934829df2930e58e98bcfce813ce84))\n\n\n\n\n\n## [4.0.2](https://github.com/uport-project/veramo/compare/v4.0.1...v4.0.2) (2022-10-04)\n\n\n### Bug Fixes\n\n* **data-store:** use looser typeorm version range to fix [#1013](https://github.com/uport-project/veramo/issues/1013) ([#1016](https://github.com/uport-project/veramo/issues/1016)) ([83807f3](https://github.com/uport-project/veramo/commit/83807f31f845c8a0116f0300c51735ec406d9dd4))\n* **deps:** update dependency uuid to v9 ([4ff90a5](https://github.com/uport-project/veramo/commit/4ff90a58f5993880635f2b39c73edadaf3149066))\n\n\n\n\n\n## [4.0.1](https://github.com/uport-project/veramo/compare/v4.0.0...v4.0.1) (2022-09-23)\n\n**Note:** Version bump only for package @veramo/selective-disclosure\n\n\n\n\n\n# [4.0.0](https://github.com/uport-project/veramo/compare/v3.1.5...v4.0.0) (2022-09-22)\n\n\n### Bug Fixes\n\n* **deps:** Bump `did-jwt`, `did-jwt-vc` as direct package deps ([#955](https://github.com/uport-project/veramo/issues/955)) ([e57edb3](https://github.com/uport-project/veramo/commit/e57edb34cfbaee6bba1d944497d688104f32c698))\n* **deps:** update dependency did-jwt to v5.12.0 ([5b414d7](https://github.com/uport-project/veramo/commit/5b414d7d720e7c59cf3f56c35da5fe247e21bf26))\n* **deps:** use did-jwt v6 and ethr-did-resolver v6 ([#925](https://github.com/uport-project/veramo/issues/925)) ([0c77d03](https://github.com/uport-project/veramo/commit/0c77d03ec5ec9e2091de3f74f67ab86a22cde197)), closes [#923](https://github.com/uport-project/veramo/issues/923) [#848](https://github.com/uport-project/veramo/issues/848)\n* **did-resolver:** use interface `Resolvable` instead of the `Resolver` class ([9c2e59f](https://github.com/uport-project/veramo/commit/9c2e59f3f23f808511c6c0e8e440b4d53ba5cb00))\n* **docs:** fix relevant errors and warnings in TSDoc to enable proper docs generation on `[@next](https://github.com/next)` branch ([79c3872](https://github.com/uport-project/veramo/commit/79c387230219c92c1951d19b8ddf716308a46c5b))\n* update and fix inline documentation of all exported types ([#921](https://github.com/uport-project/veramo/issues/921)) ([63e64e0](https://github.com/uport-project/veramo/commit/63e64e0e2693808c4704dca8cc511dc0bab3f3b1))\n\n\n### Features\n\n* add support for serviceEndpoint property as defined in latest DID Spec ([#988](https://github.com/uport-project/veramo/issues/988)) ([9bed70b](https://github.com/uport-project/veramo/commit/9bed70ba658aed34a97944e0dee27bca6c81d700))\n* **credential-status:** expect revoked boolean property from StatusMethods ([e00daa4](https://github.com/uport-project/veramo/commit/e00daa47865ea42d7bd8667f37c6e12fc21fd4b9))\n* **credential-w3c:** add ICredentialPlugin interface in core package ([#1001](https://github.com/uport-project/veramo/issues/1001)) ([7b6d195](https://github.com/uport-project/veramo/commit/7b6d1950364c8b741dd958d29e506b95fa5b1cec)), closes [#941](https://github.com/uport-project/veramo/issues/941)\n* **credential-w3c:** align verification API between formats ([#996](https://github.com/uport-project/veramo/issues/996)) ([b987fc0](https://github.com/uport-project/veramo/commit/b987fc0903a31d3bbffb43fef872be4d6c62c2ad)), closes [#935](https://github.com/uport-project/veramo/issues/935) [#954](https://github.com/uport-project/veramo/issues/954) [#375](https://github.com/uport-project/veramo/issues/375) [#989](https://github.com/uport-project/veramo/issues/989)\n* **date-store-json:** add JSON object storage implementation ([#819](https://github.com/uport-project/veramo/issues/819)) ([934b34a](https://github.com/uport-project/veramo/commit/934b34a18b194928f90e7797289cc6f2243789ec))\n\n\n### BREAKING CHANGES\n\n* the `did-resolver` and connected libraries change the data-type for `ServiceEndpoint` to `Service` and the previous semantic has changed. Services can have multiple endpoints, not just a single string.\n\n\n\n\n\n## [3.1.4](https://github.com/uport-project/veramo/compare/v3.1.3...v3.1.4) (2022-06-02)\n\n**Note:** Version bump only for package @veramo/selective-disclosure\n\n\n\n\n\n## [3.1.3](https://github.com/uport-project/veramo/compare/v3.1.2...v3.1.3) (2022-06-01)\n\n**Note:** Version bump only for package @veramo/selective-disclosure\n\n\n\n\n\n# [3.1.0](https://github.com/uport-project/veramo/compare/v3.0.0...v3.1.0) (2021-11-12)\n\n\n### Bug Fixes\n\n* **data-store:** add support for entityPrefix ([#725](https://github.com/uport-project/veramo/issues/725)) ([801bb95](https://github.com/uport-project/veramo/commit/801bb95ddd22abaa61c938b025834132d4e8d3be)), closes [#724](https://github.com/uport-project/veramo/issues/724)\n* **deps:** update dependency did-jwt to v5.10.0 ([8424291](https://github.com/uport-project/veramo/commit/842429176b7e3a2433dcb0341cdadb5e5fcd71f0))\n* **deps:** update dependency did-jwt to v5.9.0 ([b9af0af](https://github.com/uport-project/veramo/commit/b9af0af9034297316313ac8f5d41f08e06c5a1ab))\n* **deps:** update did-libraries ([417dc5d](https://github.com/uport-project/veramo/commit/417dc5dd157ee259b6f89f4987f1ecca444fb1d4))\n\n\n### Features\n\n* **did-comm:** didcomm messaging using did:ethr ([#744](https://github.com/uport-project/veramo/issues/744)) ([1be5e04](https://github.com/uport-project/veramo/commit/1be5e04e09112c0823d776fe2d55117d71a7b448)), closes [#743](https://github.com/uport-project/veramo/issues/743)\n\n\n\n\n\n# [3.0.0](https://github.com/uport-project/veramo/compare/v2.1.3...v3.0.0) (2021-09-20)\n\n\n### Bug Fixes\n\n* **deps:** update all non-major dependencies ([8fc5312](https://github.com/uport-project/veramo/commit/8fc53120498ce2982e8ec640e00bbb03f6f4204e))\n\n\n\n\n\n# [2.1.0](https://github.com/uport-project/veramo/compare/v2.0.1...v2.1.0) (2021-08-11)\n\n\n### Bug Fixes\n\n* **credentials-w3c:** accept Presentations without Credentials ([#616](https://github.com/uport-project/veramo/issues/616)) ([2389cd0](https://github.com/uport-project/veramo/commit/2389cd0df080e968ee320d66fabf2e8a7b51ba47))\n\n\n\n\n\n# [2.0.0](https://github.com/uport-project/veramo/compare/v1.2.2...v2.0.0) (2021-07-14)\n\n\n### Bug Fixes\n\n* **deps:** bump did-jwt to 5.4.0 ([#528](https://github.com/uport-project/veramo/issues/528)) ([65f22cf](https://github.com/uport-project/veramo/commit/65f22cf6dcca48b5bb35331894536a2a567a1189))\n* **deps:** update all non-major dependencies ([9f40f7d](https://github.com/uport-project/veramo/commit/9f40f7d8b2a67e112b7ef2322ba887ee9033646c))\n* **deps:** update dependency did-jwt to v5.5.2 ([ae0661f](https://github.com/uport-project/veramo/commit/ae0661fc5b225f80ebb102db60d55822b4786bce))\n* use optional chaining in SDR message handler ([#561](https://github.com/uport-project/veramo/issues/561)) ([ab24877](https://github.com/uport-project/veramo/commit/ab24877f941c37f1042fdc23683b1292b7f5bdc7)), closes [#560](https://github.com/uport-project/veramo/issues/560)\n\n\n### Features\n\n* **key-manager:** add generic signing capabilities ([#529](https://github.com/uport-project/veramo/issues/529)) ([5f10a1b](https://github.com/uport-project/veramo/commit/5f10a1bcea214cb593de12fa6ec3a91b3cb712bb)), closes [#522](https://github.com/uport-project/veramo/issues/522)\n* **sdr:** return UniqueVerifiableCredential for selective-disclosure ([#593](https://github.com/uport-project/veramo/issues/593)) ([9c6c090](https://github.com/uport-project/veramo/commit/9c6c0906607bc8f415042d3a855a2dd23a097725)), closes [#496](https://github.com/uport-project/veramo/issues/496)\n\n\n### BREAKING CHANGES\n\n* **sdr:** `getVerifiableCredentialsForSdr` and `validatePresentationAgainstSdr` now returns { hash: string, verifiableCredential: VerifiableCredential} instead of `VerifiableCredential`\n\n\n\n\n\n# [1.2.0](https://github.com/uport-project/veramo/compare/v1.1.2...v1.2.0) (2021-04-27)\n\n\n### Features\n\n* adapt to did core spec ([#430](https://github.com/uport-project/veramo/issues/430)) ([9712db0](https://github.com/uport-project/veramo/commit/9712db0eea1a3f48cf0665d66ae715ea0c23cd4a)), closes [#418](https://github.com/uport-project/veramo/issues/418) [#428](https://github.com/uport-project/veramo/issues/428) [#417](https://github.com/uport-project/veramo/issues/417) [#416](https://github.com/uport-project/veramo/issues/416) [#412](https://github.com/uport-project/veramo/issues/412) [#397](https://github.com/uport-project/veramo/issues/397) [#384](https://github.com/uport-project/veramo/issues/384) [#394](https://github.com/uport-project/veramo/issues/394)\n\n\n\n\n\n## [1.1.2](https://github.com/uport-project/veramo/compare/v1.1.1...v1.1.2) (2021-04-26)\n\n**Note:** Version bump only for package @veramo/selective-disclosure\n\n\n\n\n\n# [1.1.0](https://github.com/uport-project/veramo/compare/v1.0.1...v1.1.0) (2021-01-26)\n\n**Note:** Version bump only for package @veramo/selective-disclosure\n\n\n\n\n\n## 1.0.1 (2020-12-18)\n\n**Note:** Version bump only for package @veramo/selective-disclosure\n"
  },
  {
    "path": "packages/selective-disclosure/LICENSE",
    "content": "                                 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 2019 Consensys AG\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"
  },
  {
    "path": "packages/selective-disclosure/README.md",
    "content": "# Veramo selective disclosure plugin\n\nThis package provides a Veramo plugin that can create and receive selective disclosure requests.\n"
  },
  {
    "path": "packages/selective-disclosure/api-extractor.json",
    "content": "{\n  \"$schema\": \"https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json\",\n  \"apiReport\": {\n    \"enabled\": true,\n    \"reportFolder\": \"./api\",\n    \"reportTempFolder\": \"./api\"\n  },\n\n  \"docModel\": {\n    \"enabled\": true,\n    \"apiJsonFilePath\": \"./api/<unscopedPackageName>.api.json\"\n  },\n\n  \"dtsRollup\": {\n    \"enabled\": false\n  },\n  \"mainEntryPointFilePath\": \"<projectFolder>/build/index.d.ts\"\n}\n"
  },
  {
    "path": "packages/selective-disclosure/package.json",
    "content": "{\n  \"name\": \"@veramo/selective-disclosure\",\n  \"description\": \"Veramo plugin to enable the uPort selective disclosure protocol with W3C compatibility.\",\n  \"version\": \"7.0.0\",\n  \"main\": \"build/index.js\",\n  \"exports\": {\n    \".\": \"./build/index.js\"\n  },\n  \"types\": \"build/index.d.ts\",\n  \"scripts\": {\n    \"build\": \"tsc\",\n    \"generate-plugin-schema\": \"node ../cli/bin/veramo.js dev generate-plugin-schema\"\n  },\n  \"veramo\": {\n    \"pluginInterfaces\": {\n      \"ISelectiveDisclosure\": \"./src/types.ts\"\n    }\n  },\n  \"dependencies\": {\n    \"@veramo/core-types\": \"workspace:^\",\n    \"@veramo/message-handler\": \"workspace:^\",\n    \"@veramo/utils\": \"workspace:^\",\n    \"debug\": \"^4.3.3\",\n    \"did-jwt\": \"^8.0.0\",\n    \"uuid\": \"^11.0.0\"\n  },\n  \"devDependencies\": {\n    \"@types/debug\": \"4.1.8\",\n    \"@types/uuid\": \"9.0.2\",\n    \"typescript\": \"5.7.3\"\n  },\n  \"files\": [\n    \"build/**/*\",\n    \"src/**/*\",\n    \"README.md\",\n    \"LICENSE\"\n  ],\n  \"publishConfig\": {\n    \"access\": \"public\"\n  },\n  \"repository\": {\n    \"type\": \"git\",\n    \"url\": \"https://github.com/decentralized-identity/veramo.git\",\n    \"directory\": \"packages/selective-disclosure\"\n  },\n  \"author\": \"Consensys Mesh R&D <hello@veramo.io>\",\n  \"contributors\": [\n    \"Simonas Karuzas <simonas.karuzas@mesh.xyz>\",\n    \"Mircea Nistor <mircea.nistor@mesh.xyz>\"\n  ],\n  \"keywords\": [\n    \"Veramo\",\n    \"DID\",\n    \"Verifiable Credential\",\n    \"veramo-plugin\"\n  ],\n  \"license\": \"Apache-2.0\",\n  \"type\": \"module\",\n  \"moduleDirectories\": [\n    \"node_modules\",\n    \"src\"\n  ]\n}\n"
  },
  {
    "path": "packages/selective-disclosure/src/__tests__/validate-presentation.test.ts",
    "content": "import { IAgentContext, VerifiableCredential, VerifiablePresentation } from '../../../core-types/src'\nimport { ISelectiveDisclosureRequest } from '../types.js'\nimport { SelectiveDisclosure } from '../action-handler.js'\nimport { jest } from '@jest/globals'\n\nconst actionHandler = new SelectiveDisclosure()\n\nconst context = {\n  agent: {\n    execute: jest.fn(),\n    availableMethods: jest.fn(),\n    getSchema: jest.fn(),\n    emit: jest.fn(),\n  },\n} as IAgentContext<any>\n\ndescribe('@veramo/selective-disclosure-helper', () => {\n  it('should validate presentation for sdr', async () => {\n    const sdr: ISelectiveDisclosureRequest = {\n      issuer: 'did:example:123',\n      replyUrl: 'https://example.com/didcomm',\n      tag: 'session-123',\n      claims: [\n        {\n          reason: 'We are required by law to collect this information',\n          claimType: 'firstName',\n          essential: true,\n        },\n        {\n          reason: 'You can get %30 discount if you are a member of the club',\n          credentialContext: 'https://www.w3.org/2018/credentials/v1',\n          credentialType: 'ClubMembership',\n          claimType: 'status',\n          claimValue: 'member',\n          issuers: [\n            {\n              did: 'did:ethr:567',\n              url: 'https://join-the-club.partner1.com',\n            },\n            {\n              did: 'did:ethr:659',\n              url: 'https://ecosystem.io',\n            },\n          ],\n        },\n      ],\n      credentials: ['JWT-public-profile...'],\n    }\n\n    const did1 = 'did:example:555'\n    const did2 = 'did:ethr:659'\n\n    const credential1: VerifiableCredential = {\n      '@context': ['https://www.w3.org/2018/credentials/v1'],\n      type: ['VerifiableCredential'],\n      issuer: { id: did1 },\n      issuanceDate: '2012-12-19T06:01:17.171Z',\n      credentialSubject: {\n        id: did1,\n        firstName: 'Alice',\n        lastName: 'Smith',\n      },\n      proof: {\n        jwt: 'mock',\n      },\n    }\n\n    const credential2: VerifiableCredential = {\n      '@context': ['https://www.w3.org/2018/credentials/v1'],\n      type: ['VerifiableCredential', 'ClubMembership'],\n      issuer: { id: did2 },\n      issuanceDate: '2012-12-19T06:01:17.171Z',\n      credentialSubject: {\n        id: did1,\n        status: 'member',\n      },\n      proof: {\n        jwt: 'mock',\n      },\n    }\n\n    const presentation: VerifiablePresentation = {\n      holder: did1,\n      verifier: [did1],\n      type: ['VerifiablePresentation'],\n      '@context': ['https://www.w3.org/2018/credentials/v1'],\n      verifiableCredential: [credential1, credential2],\n      proof: {\n        jwt: 'mock',\n      },\n    }\n\n    const result = await actionHandler.validatePresentationAgainstSdr({ presentation, sdr }, context)\n\n    expect(result.claims[0].credentials[0].verifiableCredential.credentialSubject['firstName']).toEqual(\n      'Alice',\n    )\n    expect(result.valid).toEqual(true)\n  })\n\n  it('should invalidate presentation for sdr', async () => {\n    const sdr: ISelectiveDisclosureRequest = {\n      issuer: 'did:example:123',\n      claims: [\n        {\n          reason: 'We are required by law to collect this information',\n          claimType: 'firstName',\n          essential: true,\n        },\n      ],\n    }\n\n    const did1 = 'did:example:555'\n\n    const credential1: VerifiableCredential = {\n      '@context': ['https://www.w3.org/2018/credentials/v1'],\n      type: ['VerifiableCredential'],\n      issuer: { id: did1 },\n      issuanceDate: '2012-12-19T06:01:17.171Z',\n      credentialSubject: {\n        id: did1,\n        lastName: 'Smith',\n      },\n      proof: {\n        jwt: 'mock',\n      },\n    }\n\n    const presentation: VerifiablePresentation = {\n      holder: did1,\n      verifier: [did1],\n      type: ['VerifiablePresentation'],\n      '@context': ['https://www.w3.org/2018/credentials/v1'],\n      verifiableCredential: [credential1],\n      proof: {\n        jwt: 'mock',\n      },\n    }\n    const result = await actionHandler.validatePresentationAgainstSdr({ presentation, sdr }, context)\n\n    expect(result.valid).toEqual(false)\n  })\n})\n"
  },
  {
    "path": "packages/selective-disclosure/src/action-handler.ts",
    "content": "import {\n  FindArgs,\n  IAgentContext,\n  IAgentPlugin,\n  ICredentialIssuer,\n  IDataStoreORM,\n  IDIDManager,\n  IKey,\n  IKeyManager,\n  KEY_ALG_MAPPING,\n  TAlg,\n  TClaimsColumns,\n  VerifiableCredential,\n  VerifiablePresentation,\n} from '@veramo/core-types'\n\nimport {\n  ICreateProfileCredentialsArgs,\n  ICreateSelectiveDisclosureRequestArgs,\n  ICredentialsForSdr,\n  IGetVerifiableCredentialsForSdrArgs,\n  IPresentationValidationResult,\n  ISelectiveDisclosure,\n  ISelectiveDisclosureRequest,\n  IValidatePresentationAgainstSdrArgs,\n} from './types.js'\nimport { schema } from './plugin.schema.js'\nimport { createJWT } from 'did-jwt'\nimport Debug from 'debug'\nimport {\n  asArray,\n  bytesToBase64,\n  computeEntryHash,\n  decodeCredentialToObject,\n  extractIssuer,\n  intersect,\n} from '@veramo/utils'\n\n/**\n * This class adds support for creating\n * {@link https://github.com/uport-project/specs/blob/develop/flows/selectivedisclosure.md | uPort Selective Disclosure}\n * requests and interpret the responses received.\n *\n * This implementation of the uPort protocol uses\n * {@link https://www.w3.org/TR/vc-data-model/#presentations | W3C Presentation}\n * as the response encoding instead of a `shareReq`.\n *\n * @beta This API may change without a BREAKING CHANGE notice.\n *\n * @deprecated This plugin is deprecated as it implements a non-standard protocol created for the uPort project. It\n *   will be removed in a future release.\n */\nexport class SelectiveDisclosure implements IAgentPlugin {\n  readonly methods: ISelectiveDisclosure\n  readonly schema = schema.ISelectiveDisclosure\n\n  constructor() {\n    this.methods = {\n      createSelectiveDisclosureRequest: this.createSelectiveDisclosureRequest,\n      getVerifiableCredentialsForSdr: this.getVerifiableCredentialsForSdr,\n      validatePresentationAgainstSdr: this.validatePresentationAgainstSdr,\n      createProfilePresentation: this.createProfilePresentation,\n    }\n  }\n\n  /**\n   * Creates a Selective disclosure request, encoded as a JWT.\n   *\n   * @remarks See\n   *   {@link https://github.com/uport-project/specs/blob/develop/flows/selectivedisclosure.md | uPort Selective Disclosure}\n   *\n   * @param args - The param object with the properties necessary to create the request. See\n   *   {@link ISelectiveDisclosureRequest}\n   * @param context - *RESERVED* This is filled by the framework when the method is called.\n   *\n   * @beta This API may change without a BREAKING CHANGE notice.\n   */\n  async createSelectiveDisclosureRequest(\n    args: ICreateSelectiveDisclosureRequestArgs,\n    context: IAgentContext<IDIDManager & IKeyManager>,\n  ): Promise<string> {\n    try {\n      const identifier = await context.agent.didManagerGet({ did: args.data.issuer })\n      const data: Partial<ISelectiveDisclosureRequest> = args.data\n      delete data.issuer\n      Debug('veramo:selective-disclosure:create-sdr')('Signing SDR with', identifier.did)\n\n      // only these signature algorithms are supported\n      const algs: TAlg[] = ['ES256K', 'ES256K-R', 'EdDSA', 'ES256']\n\n      const key = identifier.keys.find((k: IKey) => {\n        return (\n          Object.keys(KEY_ALG_MAPPING).includes(k.type) &&\n          KEY_ALG_MAPPING[k.type] &&\n          intersect(intersect(k.meta?.algorithms, KEY_ALG_MAPPING[k.type]), algs).length > 0\n        )\n      })\n\n      if (!key) throw Error('Signing key not found')\n\n      const algorithm = KEY_ALG_MAPPING[key.type]?.[0]\n\n      if (!algorithm) throw Error('Unsupported key type')\n\n      const signer = (data: string | Uint8Array) => {\n        let dataString, encoding: 'base64' | undefined\n        if (typeof data === 'string') {\n          dataString = data\n          encoding = undefined\n        } else {\n          ;(dataString = bytesToBase64(data)), (encoding = 'base64')\n        }\n        return context.agent.keyManagerSign({ keyRef: key.kid, data: dataString, encoding, algorithm })\n      }\n      const jwt = await createJWT(\n        {\n          type: 'sdr',\n          ...data,\n        },\n        {\n          signer,\n          alg: algorithm,\n          issuer: identifier.did,\n        },\n      )\n      return jwt\n    } catch (error) {\n      return Promise.reject(error)\n    }\n  }\n\n  /**\n   * Gathers the required credentials necessary to fulfill a Selective Disclosure Request.\n   * It uses a {@link @veramo/core-types#IDataStoreORM} plugin implementation to query the local database for\n   * the required credentials.\n   *\n   * @param args - Contains the Request to be fulfilled and the DID of the subject\n   * @param context - *RESERVED* This is filled by the framework when the method is called.\n   *\n   * @beta This API may change without a BREAKING CHANGE notice.\n   */\n  async getVerifiableCredentialsForSdr(\n    args: IGetVerifiableCredentialsForSdrArgs,\n    context: IAgentContext<IDataStoreORM>,\n  ): Promise<ICredentialsForSdr[]> {\n    const result: ICredentialsForSdr[] = []\n    const findArgs: FindArgs<TClaimsColumns> = { where: [] }\n    for (const credentialRequest of args.sdr.claims) {\n      if (credentialRequest.claimType) {\n        findArgs.where?.push({ column: 'type', value: [credentialRequest.claimType] })\n      }\n\n      if (credentialRequest.claimValue) {\n        findArgs.where?.push({ column: 'value', value: [credentialRequest.claimValue] })\n      }\n\n      if (credentialRequest.issuers && credentialRequest.issuers.length > 0) {\n        findArgs.where?.push({ column: 'issuer', value: credentialRequest.issuers.map((i) => i.did) })\n      }\n\n      if (credentialRequest.credentialType) {\n        findArgs.where?.push({\n          column: 'credentialType',\n          value: ['%' + credentialRequest.credentialType + '%'],\n          op: 'Like',\n        })\n      }\n\n      if (credentialRequest.credentialContext) {\n        findArgs.where?.push({\n          column: 'context',\n          value: ['%' + credentialRequest.credentialContext + '%'],\n          op: 'Like',\n        })\n      }\n\n      if (args.did || args.sdr.subject) {\n        findArgs.where?.push({ column: 'subject', value: ['' + (args.did || args.sdr.subject)] })\n      }\n\n      const credentials = await context.agent.dataStoreORMGetVerifiableCredentialsByClaims(findArgs)\n\n      result.push({\n        ...credentialRequest,\n        credentials,\n      })\n    }\n    return result\n  }\n\n  /**\n   * Validates a\n   * {@link https://github.com/uport-project/specs/blob/develop/flows/selectivedisclosure.md | uPort Selective Disclosure response} encoded as a `Presentation`\n   *\n   * @param args - Contains the request and the response `Presentation` that needs to be checked.\n   * @param context - *RESERVED* This is filled by the framework when the method is called.\n   *\n   * @beta This API may change without a BREAKING CHANGE notice.\n   */\n  async validatePresentationAgainstSdr(\n    args: IValidatePresentationAgainstSdrArgs,\n    context: IAgentContext<{}>,\n  ): Promise<IPresentationValidationResult> {\n    let valid = true\n    let claims = []\n    for (const credentialRequest of args.sdr.claims) {\n      let credentials = (args.presentation?.verifiableCredential || [])\n        .map(decodeCredentialToObject)\n        .filter((credential: VerifiableCredential) => {\n          if (\n            credentialRequest.claimType &&\n            credentialRequest.claimValue &&\n            credential.credentialSubject[credentialRequest.claimType] !== credentialRequest.claimValue\n          ) {\n            return false\n          }\n\n          if (\n            credentialRequest.claimType &&\n            !credentialRequest.claimValue &&\n            credential.credentialSubject[credentialRequest.claimType] === undefined\n          ) {\n            return false\n          }\n\n          if (\n            credentialRequest.issuers &&\n            !credentialRequest.issuers\n              .map((i) => i.did)\n              .includes(extractIssuer(credential, { removeParameters: true }))\n          ) {\n            return false\n          }\n          if (\n            credentialRequest.credentialContext &&\n            !asArray(credential['@context'] || []).includes(credentialRequest.credentialContext)\n          ) {\n            return false\n          }\n\n          if (\n            credentialRequest.credentialType &&\n            !asArray(credential.type || []).includes(credentialRequest.credentialType)\n          ) {\n            return false\n          }\n\n          return true\n        })\n\n      if (credentialRequest.essential === true && credentials.length == 0) {\n        valid = false\n      }\n\n      claims.push({\n        ...credentialRequest,\n        credentials: credentials.map((vc) => ({\n          hash: computeEntryHash(vc),\n          verifiableCredential: vc,\n        })),\n      })\n    }\n    return { valid, claims }\n  }\n\n  /**\n   * Creates profile credentials\n   *\n   * @beta This API may change without a BREAKING CHANGE notice.\n   */\n  async createProfilePresentation(\n    args: ICreateProfileCredentialsArgs,\n    context: IAgentContext<ICredentialIssuer & IDIDManager>,\n  ): Promise<VerifiablePresentation> {\n    const identifier = await context.agent.didManagerGet({ did: args.holder })\n\n    const credentials = []\n\n    if (args.name) {\n      const credential = await context.agent.createVerifiableCredential({\n        credential: {\n          issuer: { id: identifier.did },\n          '@context': ['https://www.w3.org/2018/credentials/v1'],\n          type: ['VerifiableCredential', 'Profile'],\n          issuanceDate: new Date().toISOString(),\n          credentialSubject: {\n            id: identifier.did,\n            name: args.name,\n          },\n        },\n        proofFormat: 'jwt',\n      })\n\n      credentials.push(credential)\n    }\n\n    if (args.picture) {\n      const credential = await context.agent.createVerifiableCredential({\n        credential: {\n          issuer: { id: identifier.did },\n          type: ['Profile'],\n          credentialSubject: {\n            id: identifier.did,\n            picture: args.picture,\n          },\n        },\n        proofFormat: 'jwt',\n      })\n\n      credentials.push(credential)\n    }\n\n    if (args.url) {\n      const credential = await context.agent.createVerifiableCredential({\n        credential: {\n          issuer: { id: identifier.did },\n          type: ['Profile'],\n          credentialSubject: {\n            id: identifier.did,\n            url: args.url,\n          },\n        },\n        proofFormat: 'jwt',\n      })\n\n      credentials.push(credential)\n    }\n\n    const profile = await context.agent.createVerifiablePresentation({\n      presentation: {\n        verifier: args.holder ? [args.holder] : [],\n        holder: identifier.did,\n        type: ['Profile'],\n        verifiableCredential: credentials,\n      },\n      proofFormat: 'jwt',\n      save: args.save,\n    })\n\n    if (args.verifier && args.send) {\n      await context.agent.sendMessageDIDCommAlpha1({\n        save: args.save,\n        data: {\n          from: identifier.did,\n          to: args.verifier,\n          type: 'jwt',\n          body: profile.proof.jwt,\n        },\n      })\n    }\n\n    return profile\n  }\n}\n"
  },
  {
    "path": "packages/selective-disclosure/src/index.ts",
    "content": "/**\n * Provides a {@link @veramo/selective-disclosure#ISelectiveDisclosure | plugin} for the {@link @veramo/core#Agent}\n * that implements {@link @veramo/selective-disclosure#SelectiveDisclosure} interface.\n *\n * Provides a {@link @veramo/selective-disclosure#SdrMessageHandler | plugin} for the\n * {@link @veramo/message-handler#MessageHandler} that detects Selective Disclosure Request in a message\n *\n * @packageDocumentation\n */\nexport { SdrMessageHandler, MessageTypes } from './message-handler.js'\nexport { SelectiveDisclosure } from './action-handler.js'\nexport * from './types.js'\nexport { schema } from './plugin.schema.js'\n"
  },
  {
    "path": "packages/selective-disclosure/src/message-handler.ts",
    "content": "import { IAgentContext, IMessageHandler } from '@veramo/core-types'\nimport { Message, AbstractMessageHandler } from '@veramo/message-handler'\nimport { v4 as uuidv4 } from 'uuid'\n\nimport Debug from 'debug'\nimport { asArray, computeEntryHash } from '@veramo/utils'\n\nconst debug = Debug('veramo:selective-disclosure:message-handler')\n\n/**\n * Identifies a {@link @veramo/core-types#IMessage} that represents a Selective Disclosure Request\n *\n * @remarks See\n *   {@link https://github.com/uport-project/specs/blob/develop/messages/sharereq.md | uPort Selective Disclosure Request}\n * @beta This API may change without a BREAKING CHANGE notice.\n */\nexport const MessageTypes = {\n  sdr: 'sdr',\n}\n\n/**\n * A Veramo message handler plugin that can decode an incoming Selective Disclosure Response\n * into the internal Message representation.\n *\n * @beta This API may change without a BREAKING CHANGE notice.\n *\n * @deprecated This plugin is deprecated as it implements a non-standard protocol created for the uPort project. It\n *   will be removed in a future release.\n */\nexport class SdrMessageHandler extends AbstractMessageHandler {\n  async handle(message: Message, context: IAgentContext<IMessageHandler>): Promise<Message> {\n    const meta = message.getLastMetaData()\n\n    if (message?.data?.type == MessageTypes.sdr && message?.data?.claims) {\n      debug('Message type is', MessageTypes.sdr)\n\n      message.id = computeEntryHash(message.raw || message.id || uuidv4())\n      message.type = MessageTypes.sdr\n      message.from = message.data.iss\n\n      if (message.data.replyTo) {\n        message.replyTo = asArray(message.data.replyTo)\n      }\n\n      if (message.data.replyUrl) {\n        message.replyUrl = message.data.replyUrl\n      }\n\n      if (message.data.subject) {\n        message.to = message.data.subject\n      }\n\n      if (message.data.tag) {\n        message.threadId = message.data.tag\n      }\n      message.createdAt = this.timestampToDate(message.data.nbf || message.data.iat).toISOString()\n\n      if (\n        message.data.credentials &&\n        Array.isArray(message.data.credentials) &&\n        message.data.credentials.length > 0\n      ) {\n        debug('Verifying included credentials')\n        // FIXME\n        // message.credentials = []\n        // for (const raw of message.data.credentials) {\n        //   try {\n        //     const tmpMessage = await context.agent.handleMessage({ raw, save: false })\n        //     if (tmpMessage.credentials) {\n        //       message.credentials = [...message.credentials, ...tmpMessage.credentials]\n        //     }\n        //   } catch (e) {\n        //     // Unsupported message type, or some other error\n        //     debug(e)\n        //   }\n        // }\n      }\n      return message\n    }\n\n    return super.handle(message, context)\n  }\n\n  private timestampToDate(timestamp: number): Date {\n    const date = new Date(0)\n    date.setUTCSeconds(timestamp)\n    return date\n  }\n}\n"
  },
  {
    "path": "packages/selective-disclosure/src/plugin.schema.ts",
    "content": "export const schema = {\n  \"ISelectiveDisclosure\": {\n    \"components\": {\n      \"schemas\": {\n        \"ICreateProfileCredentialsArgs\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"holder\": {\n              \"type\": \"string\",\n              \"description\": \"Holder DID\"\n            },\n            \"verifier\": {\n              \"type\": \"string\",\n              \"description\": \"Optional. Verifier DID\"\n            },\n            \"name\": {\n              \"type\": \"string\",\n              \"description\": \"Optional. Name\"\n            },\n            \"picture\": {\n              \"type\": \"string\",\n              \"description\": \"Optional. Picture URL\"\n            },\n            \"url\": {\n              \"type\": \"string\",\n              \"description\": \"Optional. URL\"\n            },\n            \"save\": {\n              \"type\": \"boolean\",\n              \"description\": \"Save presentation\"\n            },\n            \"send\": {\n              \"type\": \"boolean\",\n              \"description\": \"Send presentation\"\n            }\n          },\n          \"required\": [\n            \"holder\",\n            \"save\",\n            \"send\"\n          ],\n          \"description\": \"Profile data\"\n        },\n        \"VerifiablePresentation\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"proof\": {\n              \"$ref\": \"#/components/schemas/ProofType\"\n            },\n            \"holder\": {\n              \"type\": \"string\"\n            },\n            \"verifiableCredential\": {\n              \"type\": \"array\",\n              \"items\": {\n                \"$ref\": \"#/components/schemas/W3CVerifiableCredential\"\n              }\n            },\n            \"type\": {\n              \"anyOf\": [\n                {\n                  \"type\": \"array\",\n                  \"items\": {\n                    \"type\": \"string\"\n                  }\n                },\n                {\n                  \"type\": \"string\"\n                }\n              ]\n            },\n            \"@context\": {\n              \"$ref\": \"#/components/schemas/ContextType\"\n            },\n            \"verifier\": {\n              \"type\": \"array\",\n              \"items\": {\n                \"type\": \"string\"\n              }\n            },\n            \"issuanceDate\": {\n              \"type\": \"string\"\n            },\n            \"expirationDate\": {\n              \"type\": \"string\"\n            },\n            \"id\": {\n              \"type\": \"string\"\n            }\n          },\n          \"required\": [\n            \"@context\",\n            \"holder\",\n            \"proof\"\n          ],\n          \"description\": \"Represents a signed Verifiable Presentation (includes proof), using a JSON representation. See  {@link https://www.w3.org/TR/vc-data-model/#presentations | VP data model }\"\n        },\n        \"ProofType\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"type\": {\n              \"type\": \"string\"\n            },\n            \"proofValue\": {\n              \"type\": \"string\"\n            }\n          },\n          \"description\": \"A proof property of a  {@link  VerifiableCredential }  or  {@link  VerifiablePresentation }\"\n        },\n        \"W3CVerifiableCredential\": {\n          \"anyOf\": [\n            {\n              \"$ref\": \"#/components/schemas/VerifiableCredential\"\n            },\n            {\n              \"$ref\": \"#/components/schemas/CompactJWT\"\n            }\n          ],\n          \"description\": \"Represents a signed Verifiable Credential (includes proof), in either JSON or compact JWT format. See  {@link https://www.w3.org/TR/vc-data-model/#credentials | VC data model }  See  {@link https://www.w3.org/TR/vc-data-model-1.1/#proof-formats | proof formats }\"\n        },\n        \"VerifiableCredential\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"proof\": {\n              \"$ref\": \"#/components/schemas/ProofType\"\n            },\n            \"issuer\": {\n              \"$ref\": \"#/components/schemas/IssuerType\"\n            },\n            \"credentialSubject\": {\n              \"$ref\": \"#/components/schemas/CredentialSubject\"\n            },\n            \"type\": {\n              \"anyOf\": [\n                {\n                  \"type\": \"array\",\n                  \"items\": {\n                    \"type\": \"string\"\n                  }\n                },\n                {\n                  \"type\": \"string\"\n                }\n              ]\n            },\n            \"@context\": {\n              \"$ref\": \"#/components/schemas/ContextType\"\n            },\n            \"issuanceDate\": {\n              \"type\": \"string\"\n            },\n            \"expirationDate\": {\n              \"type\": \"string\"\n            },\n            \"credentialStatus\": {\n              \"$ref\": \"#/components/schemas/CredentialStatusReference\"\n            },\n            \"id\": {\n              \"type\": \"string\"\n            }\n          },\n          \"required\": [\n            \"@context\",\n            \"credentialSubject\",\n            \"issuanceDate\",\n            \"issuer\",\n            \"proof\"\n          ],\n          \"description\": \"Represents a signed Verifiable Credential payload (includes proof), using a JSON representation. See  {@link https://www.w3.org/TR/vc-data-model/#credentials | VC data model }\"\n        },\n        \"IssuerType\": {\n          \"anyOf\": [\n            {\n              \"type\": \"object\",\n              \"properties\": {\n                \"id\": {\n                  \"type\": \"string\"\n                }\n              },\n              \"required\": [\n                \"id\"\n              ]\n            },\n            {\n              \"type\": \"string\"\n            }\n          ],\n          \"description\": \"The issuer of a  {@link  VerifiableCredential }  or the holder of a  {@link  VerifiablePresentation } .\\n\\nThe value of the issuer property MUST be either a URI or an object containing an id property. It is RECOMMENDED that the URI in the issuer or its id be one which, if de-referenced, results in a document containing machine-readable information about the issuer that can be used to verify the information expressed in the credential.\\n\\nSee  {@link https://www.w3.org/TR/vc-data-model/#issuer | Issuer data model }\"\n        },\n        \"CredentialSubject\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"id\": {\n              \"type\": \"string\"\n            }\n          },\n          \"description\": \"The value of the credentialSubject property is defined as a set of objects that contain one or more properties that are each related to a subject of the verifiable credential. Each object MAY contain an id.\\n\\nSee  {@link https://www.w3.org/TR/vc-data-model/#credential-subject | Credential Subject }\"\n        },\n        \"ContextType\": {\n          \"anyOf\": [\n            {\n              \"type\": \"string\"\n            },\n            {\n              \"type\": \"object\"\n            },\n            {\n              \"type\": \"array\",\n              \"items\": {\n                \"anyOf\": [\n                  {\n                    \"type\": \"string\"\n                  },\n                  {\n                    \"type\": \"object\"\n                  }\n                ]\n              }\n            }\n          ],\n          \"description\": \"The data type for `@context` properties of credentials, presentations, etc.\"\n        },\n        \"CredentialStatusReference\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"id\": {\n              \"type\": \"string\"\n            },\n            \"type\": {\n              \"type\": \"string\"\n            }\n          },\n          \"required\": [\n            \"id\",\n            \"type\"\n          ],\n          \"description\": \"Used for the discovery of information about the current status of a verifiable credential, such as whether it is suspended or revoked. The precise contents of the credential status information are determined by the specific `credentialStatus` type  definition and vary depending on factors such as whether it is simple to implement or if it is privacy-enhancing.\\n\\nSee  {@link https://www.w3.org/TR/vc-data-model/#status | Credential Status }\"\n        },\n        \"CompactJWT\": {\n          \"type\": \"string\",\n          \"description\": \"Represents a Json Web Token in compact form. \\\"header.payload.signature\\\"\"\n        },\n        \"ICreateSelectiveDisclosureRequestArgs\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"data\": {\n              \"$ref\": \"#/components/schemas/ISelectiveDisclosureRequest\"\n            }\n          },\n          \"required\": [\n            \"data\"\n          ],\n          \"description\": \"Contains the parameters of a Selective Disclosure Request.\"\n        },\n        \"ISelectiveDisclosureRequest\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"issuer\": {\n              \"type\": \"string\",\n              \"description\": \"The issuer of the request\"\n            },\n            \"subject\": {\n              \"type\": \"string\",\n              \"description\": \"The target of the request\"\n            },\n            \"replyUrl\": {\n              \"type\": \"string\",\n              \"description\": \"The URL where the response should be sent back\"\n            },\n            \"tag\": {\n              \"type\": \"string\"\n            },\n            \"claims\": {\n              \"type\": \"array\",\n              \"items\": {\n                \"$ref\": \"#/components/schemas/ICredentialRequestInput\"\n              },\n              \"description\": \"A list of claims that are being requested\"\n            },\n            \"credentials\": {\n              \"type\": \"array\",\n              \"items\": {\n                \"type\": \"string\"\n              },\n              \"description\": \"A list of issuer credentials that the target will use to establish trust\"\n            }\n          },\n          \"required\": [\n            \"issuer\",\n            \"claims\"\n          ],\n          \"description\": \"Represents the Selective Disclosure request parameters.\"\n        },\n        \"ICredentialRequestInput\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"reason\": {\n              \"type\": \"string\",\n              \"description\": \"Motive for requiring this credential.\"\n            },\n            \"essential\": {\n              \"type\": \"boolean\",\n              \"description\": \"If it is essential. A response that does not include this credential is not sufficient.\"\n            },\n            \"credentialType\": {\n              \"type\": \"string\",\n              \"description\": \"The credential type. See  {@link https://www.w3.org/TR/vc-data-model/#types | W3C Credential Types }\"\n            },\n            \"credentialContext\": {\n              \"type\": \"string\",\n              \"description\": \"The credential context. See  {@link https://www.w3.org/TR/vc-data-model/#contexts | W3C Credential Context }\"\n            },\n            \"claimType\": {\n              \"type\": \"string\",\n              \"description\": \"The name of the claim property that the credential should express.\"\n            },\n            \"claimValue\": {\n              \"type\": \"string\",\n              \"description\": \"The value of the claim that the credential should express.\"\n            },\n            \"issuers\": {\n              \"type\": \"array\",\n              \"items\": {\n                \"$ref\": \"#/components/schemas/Issuer\"\n              },\n              \"description\": \"A list of accepted Issuers for this credential.\"\n            }\n          },\n          \"required\": [\n            \"claimType\"\n          ],\n          \"description\": \"Describes a particular credential that is being requested\"\n        },\n        \"Issuer\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"did\": {\n              \"type\": \"string\",\n              \"description\": \"The DID of the issuer of a requested credential.\"\n            },\n            \"url\": {\n              \"type\": \"string\",\n              \"description\": \"A URL where a credential of that type can be obtained.\"\n            }\n          },\n          \"required\": [\n            \"did\",\n            \"url\"\n          ],\n          \"description\": \"Used for requesting Credentials using Selective Disclosure. Represents an accepted issuer of a credential.\"\n        },\n        \"IGetVerifiableCredentialsForSdrArgs\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"sdr\": {\n              \"type\": \"object\",\n              \"properties\": {\n                \"subject\": {\n                  \"type\": \"string\",\n                  \"description\": \"The target of the request\"\n                },\n                \"replyUrl\": {\n                  \"type\": \"string\",\n                  \"description\": \"The URL where the response should be sent back\"\n                },\n                \"tag\": {\n                  \"type\": \"string\"\n                },\n                \"claims\": {\n                  \"type\": \"array\",\n                  \"items\": {\n                    \"$ref\": \"#/components/schemas/ICredentialRequestInput\"\n                  },\n                  \"description\": \"A list of claims that are being requested\"\n                },\n                \"credentials\": {\n                  \"type\": \"array\",\n                  \"items\": {\n                    \"type\": \"string\"\n                  },\n                  \"description\": \"A list of issuer credentials that the target will use to establish trust\"\n                }\n              },\n              \"required\": [\n                \"claims\"\n              ],\n              \"description\": \"The Selective Disclosure Request (issuer is omitted)\"\n            },\n            \"did\": {\n              \"type\": \"string\",\n              \"description\": \"The DID of the subject\"\n            }\n          },\n          \"required\": [\n            \"sdr\"\n          ],\n          \"description\": \"Encapsulates the params needed to gather credentials to fulfill a Selective disclosure request.\"\n        },\n        \"ICredentialsForSdr\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"reason\": {\n              \"type\": \"string\",\n              \"description\": \"Motive for requiring this credential.\"\n            },\n            \"essential\": {\n              \"type\": \"boolean\",\n              \"description\": \"If it is essential. A response that does not include this credential is not sufficient.\"\n            },\n            \"credentialType\": {\n              \"type\": \"string\",\n              \"description\": \"The credential type. See  {@link https://www.w3.org/TR/vc-data-model/#types | W3C Credential Types }\"\n            },\n            \"credentialContext\": {\n              \"type\": \"string\",\n              \"description\": \"The credential context. See  {@link https://www.w3.org/TR/vc-data-model/#contexts | W3C Credential Context }\"\n            },\n            \"claimType\": {\n              \"type\": \"string\",\n              \"description\": \"The name of the claim property that the credential should express.\"\n            },\n            \"claimValue\": {\n              \"type\": \"string\",\n              \"description\": \"The value of the claim that the credential should express.\"\n            },\n            \"issuers\": {\n              \"type\": \"array\",\n              \"items\": {\n                \"$ref\": \"#/components/schemas/Issuer\"\n              },\n              \"description\": \"A list of accepted Issuers for this credential.\"\n            },\n            \"credentials\": {\n              \"type\": \"array\",\n              \"items\": {\n                \"$ref\": \"#/components/schemas/UniqueVerifiableCredential\"\n              }\n            }\n          },\n          \"required\": [\n            \"claimType\",\n            \"credentials\"\n          ],\n          \"description\": \"The credentials that make up a response of a Selective Disclosure\"\n        },\n        \"UniqueVerifiableCredential\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"hash\": {\n              \"type\": \"string\"\n            },\n            \"verifiableCredential\": {\n              \"$ref\": \"#/components/schemas/VerifiableCredential\"\n            }\n          },\n          \"required\": [\n            \"hash\",\n            \"verifiableCredential\"\n          ],\n          \"description\": \"Represents the result of a Query for  {@link  VerifiableCredential } s\\n\\nSee  {@link  IDataStoreORM.dataStoreORMGetVerifiableCredentials }  See  {@link  IDataStoreORM.dataStoreORMGetVerifiableCredentialsByClaims }\"\n        },\n        \"IValidatePresentationAgainstSdrArgs\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"presentation\": {\n              \"$ref\": \"#/components/schemas/VerifiablePresentation\"\n            },\n            \"sdr\": {\n              \"$ref\": \"#/components/schemas/ISelectiveDisclosureRequest\"\n            }\n          },\n          \"required\": [\n            \"presentation\",\n            \"sdr\"\n          ],\n          \"description\": \"A tuple used to verify a Selective Disclosure Response. Encapsulates the response(`presentation`) and the corresponding request (`sdr`) that made it.\"\n        },\n        \"IPresentationValidationResult\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"valid\": {\n              \"type\": \"boolean\"\n            },\n            \"claims\": {\n              \"type\": \"array\",\n              \"items\": {\n                \"$ref\": \"#/components/schemas/ICredentialsForSdr\"\n              }\n            }\n          },\n          \"required\": [\n            \"valid\",\n            \"claims\"\n          ],\n          \"description\": \"The result of a selective disclosure response validation.\"\n        }\n      },\n      \"methods\": {\n        \"createProfilePresentation\": {\n          \"description\": \"\",\n          \"arguments\": {\n            \"$ref\": \"#/components/schemas/ICreateProfileCredentialsArgs\"\n          },\n          \"returnType\": {\n            \"$ref\": \"#/components/schemas/VerifiablePresentation\"\n          }\n        },\n        \"createSelectiveDisclosureRequest\": {\n          \"description\": \"\",\n          \"arguments\": {\n            \"$ref\": \"#/components/schemas/ICreateSelectiveDisclosureRequestArgs\"\n          },\n          \"returnType\": {\n            \"type\": \"string\"\n          }\n        },\n        \"getVerifiableCredentialsForSdr\": {\n          \"description\": \"\",\n          \"arguments\": {\n            \"$ref\": \"#/components/schemas/IGetVerifiableCredentialsForSdrArgs\"\n          },\n          \"returnType\": {\n            \"type\": \"array\",\n            \"items\": {\n              \"$ref\": \"#/components/schemas/ICredentialsForSdr\"\n            }\n          }\n        },\n        \"validatePresentationAgainstSdr\": {\n          \"description\": \"\",\n          \"arguments\": {\n            \"$ref\": \"#/components/schemas/IValidatePresentationAgainstSdrArgs\"\n          },\n          \"returnType\": {\n            \"$ref\": \"#/components/schemas/IPresentationValidationResult\"\n          }\n        }\n      }\n    }\n  }\n}"
  },
  {
    "path": "packages/selective-disclosure/src/types.ts",
    "content": "import {\n  IAgentContext,\n  ICredentialIssuer,\n  IDataStoreORM,\n  IDIDManager,\n  IKeyManager,\n  IPluginMethodMap,\n  UniqueVerifiableCredential,\n  VerifiablePresentation,\n} from '@veramo/core-types'\n\n/**\n * Used for requesting Credentials using Selective Disclosure.\n * Represents an accepted issuer of a credential.\n *\n * @beta This API may change without a BREAKING CHANGE notice.\n */\nexport interface Issuer {\n  /**\n   * The DID of the issuer of a requested credential.\n   */\n  did: string\n\n  /**\n   * A URL where a credential of that type can be obtained.\n   */\n  url: string\n}\n\n/**\n * Represents the Selective Disclosure request parameters.\n *\n * @remarks See\n *   {@link https://github.com/uport-project/specs/blob/develop/messages/sharereq.md | Selective Disclosure Request}\n *\n * @beta This API may change without a BREAKING CHANGE notice. */\nexport interface ISelectiveDisclosureRequest {\n  /**\n   * The issuer of the request\n   */\n  issuer: string\n  /**\n   * The target of the request\n   */\n  subject?: string\n  /**\n   * The URL where the response should be sent back\n   */\n  replyUrl?: string\n\n  tag?: string\n\n  /**\n   * A list of claims that are being requested\n   */\n  claims: ICredentialRequestInput[]\n\n  /**\n   * A list of issuer credentials that the target will use to establish trust\n   */\n  credentials?: string[]\n}\n\n/**\n * Describes a particular credential that is being requested\n *\n * @remarks See\n *   {@link https://github.com/uport-project/specs/blob/develop/messages/sharereq.md | Selective Disclosure Request}\n *\n * @beta This API may change without a BREAKING CHANGE notice. */\nexport interface ICredentialRequestInput {\n  /**\n   * Motive for requiring this credential.\n   */\n  reason?: string\n\n  /**\n   * If it is essential. A response that does not include this credential is not sufficient.\n   */\n  essential?: boolean\n\n  /**\n   * The credential type. See {@link https://www.w3.org/TR/vc-data-model/#types | W3C Credential Types}\n   */\n  credentialType?: string\n\n  /**\n   * The credential context. See {@link https://www.w3.org/TR/vc-data-model/#contexts | W3C Credential Context}\n   */\n  credentialContext?: string\n\n  /**\n   * The name of the claim property that the credential should express.\n   */\n  claimType: string\n\n  /**\n   * The value of the claim that the credential should express.\n   */\n  claimValue?: string\n\n  /**\n   * A list of accepted Issuers for this credential.\n   */\n  issuers?: Issuer[]\n}\n\n/**\n * The credentials that make up a response of a Selective Disclosure\n *\n * @remarks See\n *   {@link https://github.com/uport-project/specs/blob/develop/messages/sharereq.md | Selective Disclosure Request}\n *\n * @beta This API may change without a BREAKING CHANGE notice.\n */\nexport interface ICredentialsForSdr extends ICredentialRequestInput {\n  credentials: UniqueVerifiableCredential[]\n}\n\n/**\n * The result of a selective disclosure response validation.\n *\n * @beta This API may change without a BREAKING CHANGE notice.\n */\nexport interface IPresentationValidationResult {\n  valid: boolean\n  claims: ICredentialsForSdr[]\n}\n\n/**\n * Contains the parameters of a Selective Disclosure Request.\n *\n * @remarks See\n *   {@link https://github.com/uport-project/specs/blob/develop/messages/sharereq.md | Selective Disclosure Request}\n *   specs\n *\n * @beta This API may change without a BREAKING CHANGE notice.\n */\nexport interface ICreateSelectiveDisclosureRequestArgs {\n  data: ISelectiveDisclosureRequest\n}\n\n/**\n * Encapsulates the params needed to gather credentials to fulfill a Selective disclosure request.\n *\n * @remarks See\n *   {@link https://github.com/uport-project/specs/blob/develop/messages/sharereq.md | Selective Disclosure Request}\n *   specs\n *\n * @beta This API may change without a BREAKING CHANGE notice.\n */\nexport interface IGetVerifiableCredentialsForSdrArgs {\n  /**\n   * The Selective Disclosure Request (issuer is omitted)\n   */\n  sdr: Omit<ISelectiveDisclosureRequest, 'issuer'>\n\n  /**\n   * The DID of the subject\n   */\n  did?: string\n}\n\n/**\n * A tuple used to verify a Selective Disclosure Response.\n * Encapsulates the response(`presentation`) and the corresponding request (`sdr`) that made it.\n *\n * @beta This API may change without a BREAKING CHANGE notice.\n */\nexport interface IValidatePresentationAgainstSdrArgs {\n  presentation: VerifiablePresentation\n  sdr: ISelectiveDisclosureRequest\n}\n\n/**\n * Profile data\n *\n * @beta This API may change without a BREAKING CHANGE notice.\n */\nexport interface ICreateProfileCredentialsArgs {\n  /**\n   * Holder DID\n   */\n  holder: string\n  /**\n   * Optional. Verifier DID\n   */\n  verifier?: string\n  /**\n   * Optional. Name\n   */\n  name?: string\n  /**\n   * Optional. Picture URL\n   */\n  picture?: string\n  /**\n   * Optional. URL\n   */\n  url?: string\n  /**\n   * Save presentation\n   */\n  save: boolean\n  /**\n   * Send presentation\n   */\n  send: boolean\n}\n\n/**\n * Describes the interface of a Selective Disclosure plugin.\n *\n * @remarks See\n *   {@link https://github.com/uport-project/specs/blob/develop/messages/sharereq.md | Selective Disclosure Request}\n *\n * @beta This API may change without a BREAKING CHANGE notice.\n */\nexport interface ISelectiveDisclosure extends IPluginMethodMap {\n  createSelectiveDisclosureRequest(\n    args: ICreateSelectiveDisclosureRequestArgs,\n    context: IAgentContext<IDIDManager & IKeyManager>,\n  ): Promise<string>\n\n  getVerifiableCredentialsForSdr(\n    args: IGetVerifiableCredentialsForSdrArgs,\n    context: IAgentContext<IDataStoreORM>,\n  ): Promise<Array<ICredentialsForSdr>>\n\n  validatePresentationAgainstSdr(\n    args: IValidatePresentationAgainstSdrArgs,\n    context: IAgentContext<{}>,\n  ): Promise<IPresentationValidationResult>\n\n  createProfilePresentation(\n    args: ICreateProfileCredentialsArgs,\n    context: IAgentContext<ICredentialIssuer & IDIDManager>,\n  ): Promise<VerifiablePresentation>\n}\n"
  },
  {
    "path": "packages/selective-disclosure/tsconfig.json",
    "content": "{\n  \"extends\": \"../tsconfig.settings.json\",\n  \"compilerOptions\": {\n    \"rootDir\": \"src\",\n    \"outDir\": \"build\",\n    \"declarationDir\": \"build\",\n    \"skipLibCheck\": true\n  },\n  \"references\": [\n    {\n      \"path\": \"../core-types\"\n    },\n    {\n      \"path\": \"../message-handler\"\n    },\n    {\n      \"path\": \"../utils\"\n    }\n  ],\n  \"include\": [\"./**/*.ts\"]\n}\n"
  },
  {
    "path": "packages/test-react-app/.eslintrc.json",
    "content": "{\n  \"env\": {\n    \"jest\": true,\n    \"node\": true,\n    \"browser\": true\n  },\n  \"globals\": {\n    \"page\": true,\n    \"browser\": true,\n    \"context\": true,\n    \"jestPuppeteer\": true\n  },\n  \"parserOptions\": {\n    \"sourceType\": \"module\",\n    \"ecmaVersion\": 2020,\n    \"ecmaFeatures\": {\n      \"jsx\": true,\n      \"modules\": true,\n      \"experimentalObjectRestSpread\": true\n    }\n  },\n  \"plugins\": [\n    \"react\",\n    \"@typescript-eslint\"\n  ],\n  \"extends\": [\n    \"eslint:recommended\",\n    \"plugin:react/recommended\",\n    \"plugin:@typescript-eslint/eslint-recommended\",\n    \"plugin:@typescript-eslint/recommended\"\n  ],\n  \"ignorePatterns\": [\"**/*.browser-test.ts\"]\n}\n"
  },
  {
    "path": "packages/test-react-app/CHANGELOG.md",
    "content": "# Change Log\n\nAll notable changes to this project will be documented in this file.\nSee [Conventional Commits](https://conventionalcommits.org) for commit guidelines.\n\n# [7.0.0](https://github.com/decentralized-identity/veramo/compare/v6.0.2...v7.0.0) (2026-02-11)\n\n\n### Bug Fixes\n\n* **ci:** update jest puppeteer config ([#1437](https://github.com/decentralized-identity/veramo/issues/1437)) ([dbb2880](https://github.com/decentralized-identity/veramo/commit/dbb28800d04fd5cf330318cc678664570682856b))\n* **deps:** bump ethr-did-resolver to v11 ([#1422](https://github.com/decentralized-identity/veramo/issues/1422)) ([2f0b06d](https://github.com/decentralized-identity/veramo/commit/2f0b06ddcce87dfeea1d5ab843eb33276dac071d))\n* **deps:** update devdeps and bump typeorm to 0.3.20 ([#1272](https://github.com/decentralized-identity/veramo/issues/1272)) ([7d17f37](https://github.com/decentralized-identity/veramo/commit/7d17f37ea7cc4e73a8cdae028681ae1be5c4d11c))\n* **deps:** update react monorepo to v19 ([#1443](https://github.com/decentralized-identity/veramo/issues/1443)) ([3fab85f](https://github.com/decentralized-identity/veramo/commit/3fab85f5189301d29b24feea5772ec022a9a8329))\n\n\n### Features\n\n* **credential-w3c:** refactor the ICredentialProvider API ([#1488](https://github.com/decentralized-identity/veramo/issues/1488)) ([cbd848d](https://github.com/decentralized-identity/veramo/commit/cbd848d4ce2b52497d99d335f1c93bd8b005cdb2))\n* **credential-w3c:** remove hardcoded proof formats ([#1395](https://github.com/decentralized-identity/veramo/issues/1395)) ([5b7d3fa](https://github.com/decentralized-identity/veramo/commit/5b7d3fad7d2ada4954f8020a6474df13d9fe51dc))\n\n\n### BREAKING CHANGES\n\n* **credential-w3c:** This changeset, along with the previous changes in #1395 modify the CredentialPlugin to support extensibility without modifications to the veramo repository. This plugin now acts as an orchestrator for other ICredentialProvider implementations that provide the actual support for various verifiable data formats. ICredentialProvider implementations can be implemented externally and used with this plugin.\n* **credential-w3c:** The credential plugins specializing in JSON-LD / EIP712 are no longer top level veramo plugins but are now managed by the `@veramo/credential-w3c` plugin which will be able to use multiple proof formats and multiplex accordingly. The constructor for the `CredentialPlugin` has changed to accept different implementations of proof formats.\n\n\n\n\n\n## [6.0.2](https://github.com/decentralized-identity/veramo/compare/v6.0.1...v6.0.2) (2026-01-16)\n\n**Note:** Version bump only for package @veramo/test-react-app\n\n\n\n\n\n## [6.0.1](https://github.com/decentralized-identity/veramo/compare/v6.0.0...v6.0.1) (2026-01-16)\n\n\n### Bug Fixes\n\n* **ci:** update jest puppeteer config ([#1437](https://github.com/decentralized-identity/veramo/issues/1437)) ([437ecc5](https://github.com/decentralized-identity/veramo/commit/437ecc5e04a16d7eb0407b4e7b749461eaa52e6c))\n\n\n\n\n\n# [6.0.0](https://github.com/decentralized-identity/veramo/compare/v5.6.0...v6.0.0) (2024-04-02)\n\n\n### Bug Fixes\n\n* **credential-w3c:** forward DID resolution options to the resolver ([#1344](https://github.com/decentralized-identity/veramo/issues/1344)) ([0c22cc6](https://github.com/decentralized-identity/veramo/commit/0c22cc6a79e974214500e4440b0ea2977012377d)), closes [#1343](https://github.com/decentralized-identity/veramo/issues/1343)\n\n\n\n\n\n# [5.6.0](https://github.com/decentralized-identity/veramo/compare/v5.5.3...v5.6.0) (2024-01-16)\n\n\n### Features\n\n* **remote-client:** allow dynamic headers param for AgentRestClient constructor ([#1314](https://github.com/decentralized-identity/veramo/issues/1314)) ([1b8a0a2](https://github.com/decentralized-identity/veramo/commit/1b8a0a2718dd63492ad3a312a6ebe5f6e7849935)), closes [#1313](https://github.com/decentralized-identity/veramo/issues/1313)\n\n\n\n\n\n## [5.5.3](https://github.com/decentralized-identity/veramo/compare/v5.5.2...v5.5.3) (2023-10-09)\n\n**Note:** Version bump only for package @veramo/test-react-app\n\n\n\n\n\n## [5.5.2](https://github.com/uport-project/veramo/compare/v5.5.1...v5.5.2) (2023-10-06)\n\n**Note:** Version bump only for package @veramo/test-react-app\n\n\n\n\n\n## [5.5.1](https://github.com/uport-project/veramo/compare/v5.5.0...v5.5.1) (2023-09-21)\n\n**Note:** Version bump only for package @veramo/test-react-app\n\n\n\n\n\n# [5.5.0](https://github.com/uport-project/veramo/compare/v5.4.1...v5.5.0) (2023-09-19)\n\n\n### Bug Fixes\n\n* **data-store:** order skip take in orm and json ([#1243](https://github.com/uport-project/veramo/issues/1243)) ([28c1224](https://github.com/uport-project/veramo/commit/28c12247c4e4b5c94e5e92b481e3ccc71b2c4ec6))\n* **did-provider-key:** use compressed keys for creating Secp256k1 did:key ([#1217](https://github.com/uport-project/veramo/issues/1217)) ([ba8f6f5](https://github.com/uport-project/veramo/commit/ba8f6f5b9b701e57af86491504ecd209ca0c1c1d)), closes [#1213](https://github.com/uport-project/veramo/issues/1213)\n\n\n\n\n\n## [5.4.1](https://github.com/uport-project/veramo/compare/v5.4.0...v5.4.1) (2023-08-04)\n\n**Note:** Version bump only for package @veramo/test-react-app\n\n\n\n\n\n# [5.4.0](https://github.com/uport-project/veramo/compare/v5.3.0...v5.4.0) (2023-08-01)\n\n\n### Features\n\n* **did-comm:** add support for the AES based content and key encryption algorithms ([#1180](https://github.com/uport-project/veramo/issues/1180)) ([5294a81](https://github.com/uport-project/veramo/commit/5294a812ee578c0712b54f216416c3ef78c848da))\n\n\n\n\n\n# [5.3.0](https://github.com/uport-project/veramo/compare/v5.2.0...v5.3.0) (2023-07-27)\n\n**Note:** Version bump only for package @veramo/test-react-app\n\n\n\n\n\n# [5.2.0](https://github.com/uport-project/veramo/compare/v5.1.4...v5.2.0) (2023-05-02)\n\n**Note:** Version bump only for package @veramo/test-react-app\n\n\n\n\n\n## [5.1.4](https://github.com/uport-project/veramo/compare/v5.1.3...v5.1.4) (2023-03-16)\n\n**Note:** Version bump only for package @veramo/test-react-app\n\n\n\n\n\n## [5.1.3](https://github.com/uport-project/veramo/compare/v5.1.2...v5.1.3) (2023-03-16)\n\n\n### Bug Fixes\n\n* **cli:** load server config asynchronously ([#1145](https://github.com/uport-project/veramo/issues/1145)) ([2a0aef1](https://github.com/uport-project/veramo/commit/2a0aef1e1911ffba85c043a878f60d7bc672e86a)), closes [#1144](https://github.com/uport-project/veramo/issues/1144)\n\n\n\n\n\n## [5.1.2](https://github.com/uport-project/veramo/compare/v5.1.1...v5.1.2) (2023-02-25)\n\n**Note:** Version bump only for package @veramo/test-react-app\n\n\n\n\n\n## [5.1.1](https://github.com/uport-project/veramo/compare/v5.1.0...v5.1.1) (2023-02-25)\n\n**Note:** Version bump only for package @veramo/test-react-app\n\n\n\n\n\n# [5.1.0](https://github.com/uport-project/veramo/compare/v5.0.0...v5.1.0) (2023-02-24)\n\n\n### Bug Fixes\n\n* P256 key parity corrections ([#1137](https://github.com/uport-project/veramo/issues/1137)) ([d0eca2b](https://github.com/uport-project/veramo/commit/d0eca2b3cd9ca6741f7f056e28bb9799910bc5ec)), closes [#1136](https://github.com/uport-project/veramo/issues/1136) [#1135](https://github.com/uport-project/veramo/issues/1135)\n\n\n### Features\n\n* **did-provider-jwk:** add did:jwk method support ([#1128](https://github.com/uport-project/veramo/issues/1128)) ([0a22d9c](https://github.com/uport-project/veramo/commit/0a22d9c2426c69c95263b2f0b36617794b59be62))\n\n\n\n\n\n# [5.0.0](https://github.com/uport-project/veramo/compare/v4.3.0...v5.0.0) (2023-02-09)\n\n\n### Build System\n\n* convert veramo modules to ESM instead of CommonJS ([#1103](https://github.com/uport-project/veramo/issues/1103)) ([b5cea3c](https://github.com/uport-project/veramo/commit/b5cea3c0d80d900a47bd1d9eea68f84b70a35e7b)), closes [#1099](https://github.com/uport-project/veramo/issues/1099)\n\n\n### Features\n\n* isolate `core-types` package from `core` ([#1116](https://github.com/uport-project/veramo/issues/1116)) ([ba7a303](https://github.com/uport-project/veramo/commit/ba7a303de91cf4cc568a3af1ddf8ca98ed022e9f))\n\n\n### BREAKING CHANGES\n\n* this is a breaking change as modules will have to be imported differently: \n* https://www.typescriptlang.org/docs/handbook/esm-node.html\n* https://nodejs.org/api/esm.html\n* https://caniuse.com/?search=modules\n\ntest(did-provider-ion): skip a couple of tests that fail with unreasonable errors\nchore: use ubuntu-latest on CI\nfix: temporarily remove puppeteer tests\nfix: use craco for test-react-app to enable babel config\ntest: fix unit and integration tests (browser tests still broken)\nfix: fix some build issues that prevented tests from working\nfix: missing deps flagged by pnpm\n\n\n\n\n\n# [4.3.0](https://github.com/uport-project/veramo/compare/v4.2.0...v4.3.0) (2023-01-27)\n\n**Note:** Version bump only for package @veramo/test-react-app\n\n\n\n\n\n# [4.2.0](https://github.com/uport-project/veramo/compare/v4.1.2...v4.2.0) (2022-12-05)\n\n\n### Bug Fixes\n\n* **credential-ld:** simplify signature suite use of Uint8Array ([49a10ec](https://github.com/uport-project/veramo/commit/49a10ecc29d56118ac09c5df73fed885fe6988c1))\n* **deps:** bump dependencies ([701b8ed](https://github.com/uport-project/veramo/commit/701b8edf981ea11c7ddb6a81d2817dbbdbb022f3))\n* **deps:** Update dependency ethr-did-resolver to v8 ([f475dbc](https://github.com/uport-project/veramo/commit/f475dbc1c2dbb4b7f6b3396c3e6947eac2931736))\n\n\n### Features\n\n* **credential-ld:** add `Ed25519Signature2020` & `JsonWebSignature2020` experimental support ([#1030](https://github.com/uport-project/veramo/issues/1030)) ([fbf7d48](https://github.com/uport-project/veramo/commit/fbf7d483c3549ec45df84472824395903128d66e)), closes [#1003](https://github.com/uport-project/veramo/issues/1003)\n* **did-provider-pkh:** implement did:pkh support. ([#1052](https://github.com/uport-project/veramo/issues/1052)) ([5ad0bfb](https://github.com/uport-project/veramo/commit/5ad0bfb713dca8fd24b99ddf053335340a39e7b3)), closes [#1024](https://github.com/uport-project/veramo/issues/1024)\n\n\n\n\n\n## [4.1.2](https://github.com/uport-project/veramo/compare/v4.1.1...v4.1.2) (2022-11-03)\n\n**Note:** Version bump only for package @veramo/test-react-app\n\n\n\n\n\n## [4.1.1](https://github.com/uport-project/veramo/compare/v4.1.0...v4.1.1) (2022-11-01)\n\n**Note:** Version bump only for package @veramo/test-react-app\n\n\n\n\n\n# [4.1.0](https://github.com/uport-project/veramo/compare/v4.0.2...v4.1.0) (2022-10-31)\n\n\n### Bug Fixes\n\n* **deps:** Update dependency ethr-did-resolver to v7 ([#1038](https://github.com/uport-project/veramo/issues/1038)) ([d421c0f](https://github.com/uport-project/veramo/commit/d421c0f9f5934829df2930e58e98bcfce813ce84))\n* remove deprecated testnets ([#1028](https://github.com/uport-project/veramo/issues/1028)) ([2823738](https://github.com/uport-project/veramo/commit/28237383d0cc2eb20bcf8e10562221ea2ab32f94)), closes [#1025](https://github.com/uport-project/veramo/issues/1025)\n\n\n\n\n\n## [4.0.2](https://github.com/uport-project/veramo/compare/v4.0.1...v4.0.2) (2022-10-04)\n\n\n### Bug Fixes\n\n* **data-store:** use looser typeorm version range to fix [#1013](https://github.com/uport-project/veramo/issues/1013) ([#1016](https://github.com/uport-project/veramo/issues/1016)) ([83807f3](https://github.com/uport-project/veramo/commit/83807f31f845c8a0116f0300c51735ec406d9dd4))\n\n\n\n\n\n## [4.0.1](https://github.com/uport-project/veramo/compare/v4.0.0...v4.0.1) (2022-09-23)\n\n**Note:** Version bump only for package @veramo/test-react-app\n\n\n\n\n\n# [4.0.0](https://github.com/uport-project/veramo/compare/v3.1.5...v4.0.0) (2022-09-22)\n\n\n### Bug Fixes\n\n* **deps:** update did-libraries ([219cde2](https://github.com/uport-project/veramo/commit/219cde250e8d4f06d7978afcc38a04471342fd21))\n* **deps:** use did-jwt v6 and ethr-did-resolver v6 ([#925](https://github.com/uport-project/veramo/issues/925)) ([0c77d03](https://github.com/uport-project/veramo/commit/0c77d03ec5ec9e2091de3f74f67ab86a22cde197)), closes [#923](https://github.com/uport-project/veramo/issues/923) [#848](https://github.com/uport-project/veramo/issues/848)\n* update and fix inline documentation of all exported types ([#921](https://github.com/uport-project/veramo/issues/921)) ([63e64e0](https://github.com/uport-project/veramo/commit/63e64e0e2693808c4704dca8cc511dc0bab3f3b1))\n\n\n### Features\n\n* add support for serviceEndpoint property as defined in latest DID Spec ([#988](https://github.com/uport-project/veramo/issues/988)) ([9bed70b](https://github.com/uport-project/veramo/commit/9bed70ba658aed34a97944e0dee27bca6c81d700))\n* **credential-ld:** add support for browser environments ([#916](https://github.com/uport-project/veramo/issues/916)) ([435e4d2](https://github.com/uport-project/veramo/commit/435e4d260b1774f96b182c1a75ab2f1c993f2291))\n* **credential-w3c:** add ICredentialPlugin interface in core package ([#1001](https://github.com/uport-project/veramo/issues/1001)) ([7b6d195](https://github.com/uport-project/veramo/commit/7b6d1950364c8b741dd958d29e506b95fa5b1cec)), closes [#941](https://github.com/uport-project/veramo/issues/941)\n* **did-provider-ethr:** use multiple networks per EthrDIDProvider ([#969](https://github.com/uport-project/veramo/issues/969)) ([0a88058](https://github.com/uport-project/veramo/commit/0a88058a5efddfe09f9f35510cc1bbc21149bf18)), closes [#968](https://github.com/uport-project/veramo/issues/968) [#893](https://github.com/uport-project/veramo/issues/893)\n* **kms-web3:** add a KMS implementation backed by a web3 provider ([#924](https://github.com/uport-project/veramo/issues/924)) ([14f71af](https://github.com/uport-project/veramo/commit/14f71afbb72dca8274790d3b20b518ddfe4f2585)), closes [#688](https://github.com/uport-project/veramo/issues/688)\n\n\n### BREAKING CHANGES\n\n* the `did-resolver` and connected libraries change the data-type for `ServiceEndpoint` to `Service` and the previous semantic has changed. Services can have multiple endpoints, not just a single string.\n"
  },
  {
    "path": "packages/test-react-app/Readme.md",
    "content": "# test-react-app\n\nThis package is only meant to be used as a testing ground to check compatibility of Veramo core dependencies with a\nbrowser environment. This is not really meant sample code."
  },
  {
    "path": "packages/test-react-app/config/jest/babelTransform.cjs",
    "content": "'use strict';\n\nconst babelJest = require('babel-jest').default;\n\nconst hasJsxRuntime = (() => {\n  if (process.env.DISABLE_NEW_JSX_TRANSFORM === 'true') {\n    return false;\n  }\n\n  try {\n    require.resolve('react/jsx-runtime');\n    return true;\n  } catch (e) {\n    return false;\n  }\n})();\n\nmodule.exports = babelJest.createTransformer({\n  presets: [\n    [\n      require.resolve('babel-preset-react-app'),\n      {\n        runtime: hasJsxRuntime ? 'automatic' : 'classic',\n      },\n    ],\n  ],\n  babelrc: false,\n  configFile: false,\n});"
  },
  {
    "path": "packages/test-react-app/craco.config.cjs",
    "content": "const webpack = require('webpack')\n\nmodule.exports = {\n  babel: {\n    plugins: ['@babel/plugin-syntax-import-assertions'],\n  },\n  webpack: {\n    configure: (webpackConfig) => {\n      // Add ProvidePlugin for global process availability\n      webpackConfig.plugins = [\n        ...webpackConfig.plugins,\n        new webpack.ProvidePlugin({\n          process: 'process/browser',\n        }),\n      ]\n\n      return webpackConfig\n    },\n  },\n}\n"
  },
  {
    "path": "packages/test-react-app/headless-tests/browserAgent.browser-test.ts",
    "content": "import { getAgent, setup } from '../src/veramo/setup.js'\n\nimport keyManager from '../../../__tests__/shared/keyManager.js'\nimport didManager from '../../../__tests__/shared/didManager.js'\nimport verifiableDataJWT from '../../../__tests__/shared/verifiableDataJWT.js'\nimport verifiableDataLD from '../../../__tests__/shared/verifiableDataLD.js'\nimport handleSdrMessage from '../../../__tests__/shared/handleSdrMessage.js'\nimport resolveDid from '../../../__tests__/shared/resolveDid.js'\nimport webDidFlow from '../../../__tests__/shared/webDidFlow.js'\nimport saveClaims from '../../../__tests__/shared/saveClaims.js'\nimport documentationExamples from '../../../__tests__/shared/documentationExamples.js'\nimport didCommPacking from '../../../__tests__/shared/didCommPacking.js'\nimport messageHandler from '../../../__tests__/shared/messageHandler.js'\nimport utils from '../../../__tests__/shared/utils.js'\n\nimport { jest } from '@jest/globals'\n\nconst JEST_TIMEOUT = 3 * 60 * 1000\njest.setTimeout(JEST_TIMEOUT)\n\ndescribe('Browser integration tests', () => {\n  describe('shared tests', () => {\n    const testContext = { getAgent, setup, tearDown: async () => true }\n    verifiableDataJWT(testContext)\n    verifiableDataLD(testContext)\n    handleSdrMessage(testContext)\n    resolveDid(testContext)\n    webDidFlow(testContext)\n    saveClaims(testContext)\n    documentationExamples(testContext)\n    keyManager(testContext)\n    didManager(testContext)\n    messageHandler(testContext)\n    utils(testContext)\n    didCommPacking(testContext)\n  })\n\n  // // https://github.com/smooth-code/jest-puppeteer/issues/503 prevents us from using puppeteer currently\n  describe('should initialize in the react app', () => {\n    beforeAll(async () => {\n      await page.goto('http://localhost:3000')\n    })\n    it('should get didDoc data and match the snapshot', async () => {\n      /**\n       * this is a test case snapshot, provided by documentation on\n       * https://veramo.io/docs/react_tutorials/react_setup_resolver,\n       * to check if the app is returning the same results as expected.\n       */\n      let resultSnapshot = {\n        didDocumentMetadata: {},\n        didResolutionMetadata: {\n          contentType: 'application/did+ld+json',\n        },\n        didDocument: {\n          '@context': expect.anything(),\n          id: 'did:ethr:ganache:0x6acf3bb1ef0ee84559de2bc2bd9d91532062a730',\n          verificationMethod: [\n            {\n              id: 'did:ethr:ganache:0x6acf3bb1ef0ee84559de2bc2bd9d91532062a730#controller',\n              type: 'EcdsaSecp256k1RecoveryMethod2020',\n              controller: 'did:ethr:ganache:0x6acf3bb1ef0ee84559de2bc2bd9d91532062a730',\n              blockchainAccountId: 'eip155:1337:0x6AcF3bB1eF0eE84559De2bC2Bd9D91532062a730',\n            },\n          ],\n          authentication: ['did:ethr:ganache:0x6acf3bb1ef0ee84559de2bc2bd9d91532062a730#controller'],\n          assertionMethod: ['did:ethr:ganache:0x6acf3bb1ef0ee84559de2bc2bd9d91532062a730#controller'],\n        },\n      }\n\n      await page.waitForSelector('#result', { timeout: JEST_TIMEOUT }).then(async (element) => {\n        let result = await element!.evaluate((el) => el.textContent)\n        let parsedResult = JSON.parse(result!)\n        expect(parsedResult).toMatchObject(resultSnapshot)\n      })\n    })\n\n    it('should get didDoc data based on invalid URL', async () => {\n      let resultSnapshot = {\n        didDocumentMetadata: {},\n        didResolutionMetadata: {\n          error: 'invalidDid',\n          message: 'Not a valid did:ethr: ganache:0x16acf3bb1ef0ee8459de2bc2bd9d91532062a7',\n        },\n        didDocument: null,\n      }\n\n      await page.waitForSelector('#invalid-result', { timeout: JEST_TIMEOUT }).then(async (element) => {\n        let result = await element!.evaluate((el) => el.textContent)\n        let parsedResult = JSON.parse(result!)\n        expect(parsedResult).toMatchObject(resultSnapshot)\n      })\n    })\n  })\n})\n"
  },
  {
    "path": "packages/test-react-app/jest-integration.config.cjs",
    "content": "const { defaults } = require('jest-config')\n\n/**\n * @type {import('jest-environment-puppeteer').JestPuppeteerConfig}\n */\nconst config = {\n  // preset path is relative to the rootDir when that is set\n  preset: '../jest-preset-puppeteer-esm/jest-preset.cjs',\n  rootDir: 'headless-tests',\n  moduleFileExtensions: [...defaults.moduleFileExtensions, 'mts'],\n  testRegex: './*\\\\.browser-test\\\\.(ts|tsx?)$',\n  transform: {\n    '^.+\\\\.m?tsx?$': ['ts-jest', { useESM: true }],\n  },\n  transformIgnorePatterns: [],\n  testTimeout: 30000,\n  collectCoverage: false,\n  coverageProvider: 'v8',\n  moduleNameMapper: {\n    '^(\\\\.{1,2}/.*)\\\\.js$': '$1',\n  },\n  cache: false,\n}\n\nmodule.exports = config\n"
  },
  {
    "path": "packages/test-react-app/jest-preset-puppeteer-esm/jest-preset.cjs",
    "content": "const { defaultsESM: tsJestPresetDefaultEsm } = require('ts-jest/presets')\nconst jestPuppeteerPreset = require('jest-puppeteer/jest-preset')\n\nmodule.exports = Object.assign(jestPuppeteerPreset, tsJestPresetDefaultEsm)\n"
  },
  {
    "path": "packages/test-react-app/jest-puppeteer.config.cjs",
    "content": "module.exports = {\n  launch: {\n    dumpio: true,\n    headless: true,\n    product: 'chrome',\n    args: ['--no-sandbox', '--disable-setuid-sandbox'],\n  },\n  browserContext: 'default',\n  server: {\n    command: 'pnpm start',\n    port: 3000,\n    launchTimeout: 30000,\n    debug: true,\n  },\n}\n"
  },
  {
    "path": "packages/test-react-app/package.json",
    "content": "{\n  \"name\": \"@veramo/test-react-app\",\n  \"description\": \"This package is only meant for testing that veramo core dependencies function in a react environment.\",\n  \"version\": \"7.0.0\",\n  \"private\": true,\n  \"dependencies\": {\n    \"@veramo/core\": \"workspace:*\",\n    \"@veramo/core-types\": \"workspace:*\",\n    \"@veramo/credential-jwt\": \"workspace:*\",\n    \"@veramo/credential-ld\": \"workspace:*\",\n    \"@veramo/credential-w3c\": \"workspace:*\",\n    \"@veramo/data-store\": \"workspace:*\",\n    \"@veramo/data-store-json\": \"workspace:*\",\n    \"@veramo/did-comm\": \"workspace:*\",\n    \"@veramo/did-jwt\": \"workspace:*\",\n    \"@veramo/did-manager\": \"workspace:*\",\n    \"@veramo/did-provider-ethr\": \"workspace:*\",\n    \"@veramo/did-provider-jwk\": \"workspace:*\",\n    \"@veramo/did-provider-key\": \"workspace:*\",\n    \"@veramo/did-provider-peer\": \"workspace:^\",\n    \"@veramo/did-provider-pkh\": \"workspace:*\",\n    \"@veramo/did-provider-web\": \"workspace:*\",\n    \"@veramo/did-resolver\": \"workspace:*\",\n    \"@veramo/key-manager\": \"workspace:*\",\n    \"@veramo/kms-local\": \"workspace:*\",\n    \"@veramo/kms-web3\": \"workspace:*\",\n    \"@veramo/message-handler\": \"workspace:*\",\n    \"@veramo/selective-disclosure\": \"workspace:*\",\n    \"@veramo/test-utils\": \"workspace:*\",\n    \"@veramo/url-handler\": \"workspace:*\",\n    \"@veramo/utils\": \"workspace:*\",\n    \"buffer\": \"npm:buffer\",\n    \"crypto\": \"npm:crypto-browserify\",\n    \"did-resolver\": \"^4.1.0\",\n    \"ethr-did-resolver\": \"^11.0.2\",\n    \"path\": \"npm:path-browserify\",\n    \"process\": \"npm:process\",\n    \"react\": \"19.0.0\",\n    \"react-dom\": \"19.0.0\",\n    \"stream\": \"npm:stream-browserify\",\n    \"typeorm\": \"^0.3.20\",\n    \"util\": \"npm:util\",\n    \"web-did-resolver\": \"^2.0.27\",\n    \"web-vitals\": \"^3.5.2\"\n  },\n  \"scripts\": {\n    \"start\": \"craco start\",\n    \"buildz\": \"craco build\",\n    \"ejectz\": \"react-scripts eject\",\n    \"lint\": \"eslint 'src/**/*.{js,jsx,ts,tsx}'\",\n    \"test:browser\": \"cross-env NODE_OPTIONS=\\\"--experimental-vm-modules --experimental-json-modules\\\" GENERATE_SOURCEMAP=false JEST_PUPPETEER_CONFIG=jest-puppeteer.config.cjs pnpm jest -c jest-integration.config.cjs\"\n  },\n  \"eslintConfig\": {\n    \"extends\": [\n      \"react-app\",\n      \"react-app/jest\"\n    ]\n  },\n  \"browserslist\": {\n    \"production\": [\n      \">0.2%\",\n      \"not dead\",\n      \"not op_mini all\"\n    ],\n    \"development\": [\n      \"last 1 chrome version\",\n      \"last 1 firefox version\",\n      \"last 1 safari version\"\n    ]\n  },\n  \"devDependencies\": {\n    \"@babel/plugin-syntax-import-assertions\": \"7.27.1\",\n    \"@babel/preset-typescript\": \"7.27.1\",\n    \"@craco/craco\": \"7.1.0\",\n    \"@types/eslint\": \"8.56.12\",\n    \"@types/eslint-scope\": \"3.7.7\",\n    \"@types/expect-puppeteer\": \"5.0.6\",\n    \"@types/jest\": \"29.5.12\",\n    \"@types/jest-environment-puppeteer\": \"5.0.6\",\n    \"@types/node\": \"20.17.4\",\n    \"@types/react\": \"18.3.12\",\n    \"@types/react-dom\": \"18.3.1\",\n    \"babel-jest\": \"29.7.0\",\n    \"babel-preset-react-app\": \"10.0.1\",\n    \"cross-env\": \"7.0.3\",\n    \"jest\": \"29.7.0\",\n    \"jest-config\": \"29.7.0\",\n    \"jest-environment-puppeteer\": \"11.0.0\",\n    \"jest-environment-puppeteer-jsdom\": \"6.0.0\",\n    \"jest-jasmine2\": \"29.7.0\",\n    \"jest-puppeteer\": \"11.0.0\",\n    \"puppeteer\": \"24.19.0\",\n    \"react-scripts\": \"5.0.1\",\n    \"ts-jest\": \"29.4.1\",\n    \"typescript\": \"5.7.3\"\n  },\n  \"type\": \"module\"\n}\n"
  },
  {
    "path": "packages/test-react-app/public/index.html",
    "content": "<!DOCTYPE html>\n<html lang=\"en\">\n  <head>\n    <meta charset=\"utf-8\" />\n    <link rel=\"icon\" href=\"%PUBLIC_URL%/favicon.ico\" />\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\" />\n    <meta name=\"theme-color\" content=\"#000000\" />\n    <meta\n      name=\"description\"\n      content=\"Web site created using create-react-app\"\n    />\n    <link rel=\"apple-touch-icon\" href=\"%PUBLIC_URL%/logo192.png\" />\n    <!--\n      manifest.json provides metadata used when your web app is installed on a\n      user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/\n    -->\n    <link rel=\"manifest\" href=\"%PUBLIC_URL%/manifest.json\" />\n    <!--\n      Notice the use of %PUBLIC_URL% in the tags above.\n      It will be replaced with the URL of the `public` folder during the build.\n      Only files inside the `public` folder can be referenced from the HTML.\n\n      Unlike \"/favicon.ico\" or \"favicon.ico\", \"%PUBLIC_URL%/favicon.ico\" will\n      work correctly both with client-side routing and a non-root public URL.\n      Learn how to configure a non-root public URL by running `npm run build`.\n    -->\n    <title>React App</title>\n  </head>\n  <body>\n    <noscript>You need to enable JavaScript to run this app.</noscript>\n    <div id=\"root\"></div>\n    <!--\n      This HTML file is a template.\n      If you open it directly in the browser, you will see an empty page.\n\n      You can add webfonts, meta tags, or analytics to this file.\n      The build step will place the bundled scripts into the <body> tag.\n\n      To begin the development, run `npm start` or `yarn start`.\n      To create a production bundle, use `npm run build` or `yarn build`.\n    -->\n  </body>\n</html>\n"
  },
  {
    "path": "packages/test-react-app/public/manifest.json",
    "content": "{\n  \"short_name\": \"React App\",\n  \"name\": \"Create React App Sample\",\n  \"icons\": [\n    {\n      \"src\": \"favicon.ico\",\n      \"sizes\": \"64x64 32x32 24x24 16x16\",\n      \"type\": \"image/x-icon\"\n    },\n    {\n      \"src\": \"logo192.png\",\n      \"type\": \"image/png\",\n      \"sizes\": \"192x192\"\n    },\n    {\n      \"src\": \"logo512.png\",\n      \"type\": \"image/png\",\n      \"sizes\": \"512x512\"\n    }\n  ],\n  \"start_url\": \".\",\n  \"display\": \"standalone\",\n  \"theme_color\": \"#000000\",\n  \"background_color\": \"#ffffff\"\n}\n"
  },
  {
    "path": "packages/test-react-app/public/robots.txt",
    "content": "# https://www.robotstxt.org/robotstxt.html\nUser-agent: *\nDisallow:\n"
  },
  {
    "path": "packages/test-react-app/src/App.css",
    "content": ".App {\n  text-align: center;\n}\n\n.App-logo {\n  height: 40vmin;\n  pointer-events: none;\n}\n\n@media (prefers-reduced-motion: no-preference) {\n  .App-logo {\n    animation: App-logo-spin infinite 20s linear;\n  }\n}\n\n.App-header {\n  background-color: #282c34;\n  min-height: 100vh;\n  display: flex;\n  flex-direction: column;\n  align-items: center;\n  justify-content: center;\n  font-size: 14px;\n  color: white;\n}\n\n.App-link {\n  color: #61dafb;\n}\n\n@keyframes App-logo-spin {\n  from {\n    transform: rotate(0deg);\n  }\n  to {\n    transform: rotate(360deg);\n  }\n}\n\npre {\n  font-family: monospace;\n  white-space: pre;\n}\n\npre {\n  text-align: left;\n  width: 90%;\n  background-color: #24232d;\n  color: #25c2a0;\n  padding: 15px;\n  overflow: scroll;\n}\n"
  },
  {
    "path": "packages/test-react-app/src/App.tsx",
    "content": "import * as React from 'react'\nimport './App.css'\nimport { getAgent, setup } from './veramo/setup'\nimport { DIDResolutionResult } from 'did-resolver'\nimport { VerifiableCredential } from '@veramo/core-types'\nimport { TAgent } from '@veramo/core-types'\n\nfunction App() {\n  const [didDoc, setDidDoc] = React.useState<DIDResolutionResult|undefined>(undefined)\n  const [invalidDidDoc, setInvalidDidDoc] = React.useState<DIDResolutionResult|undefined>(undefined)\n  const [credential, setCredential] = React.useState<VerifiableCredential|undefined>(undefined)\n  const [agent, setAgent] = React.useState<TAgent<any>|undefined>(undefined)\n  const [isSetupComplete, setIsSetupComplete] = React.useState(false)\n\n  React.useEffect(() => {\n    const initializeAgent = async () => {\n      try {\n        await setup()\n        const agentInstance = getAgent()\n        setAgent(agentInstance)\n        setIsSetupComplete(true)\n      } catch (error) {\n        console.error('Failed to setup agent:', error)\n      }\n    }\n\n    initializeAgent()\n  }, [])\n\n  const resolve = async () => {\n    if (!agent) return\n    const doc = await agent.resolveDid({\n      didUrl: 'did:ethr:ganache:0x6acf3bb1ef0ee84559de2bc2bd9d91532062a730',\n    })\n    setDidDoc(doc)\n  }\n\n  const resolveInvalid = async () => {\n    if (!agent) return\n    const doc = await agent.resolveDid({\n      didUrl: 'did:ethr:ganache:0x16acf3bb1ef0ee8459de2bc2bd9d91532062a7',\n    })\n    setInvalidDidDoc(doc)\n  }\n\n  const issueCredential = async () => {\n    if (!agent) return\n    const identifier = await agent.didManagerGetOrCreate({\n      alias: 'default',\n      provider: 'did:ethr:ganache',\n    })\n    const credential = await agent.createVerifiableCredential({\n      credential: {\n        issuer: { id: identifier.did },\n        issuanceDate: new Date().toISOString(),\n        type: ['VerifiableCredential', 'UniversityDegreeCredential'],\n        credentialSubject: {\n          id: 'did:example:ebfeb1f712ebc6f1c276e12ec21',\n          degree: {\n            type: 'BachelorDegree',\n            name: 'Bachelor of Science and Arts',\n          },\n        },\n      },\n      proofFormat: 'jwt',\n    })\n    const hash = await agent.dataStoreSaveVerifiableCredential({\n      verifiableCredential: credential,\n    })\n    console.log('Credential hash', hash)\n    setCredential(credential)\n  }\n\n  // Execute agent operations only after setup is complete\n  React.useEffect(() => {\n    if (isSetupComplete && agent) {\n      resolve()\n      resolveInvalid()\n      issueCredential()\n    }\n  }, [isSetupComplete, agent])\n\n  return (\n    <div className=\"App\">\n      <header className=\"App-header\">\n        {!isSetupComplete && <div>Setting up agent...</div>}\n        {didDoc && <pre id=\"result\">{JSON.stringify(didDoc, null, 2)}</pre>}\n        {credential && <pre >{JSON.stringify(credential, null, 2)}</pre>}\n        {invalidDidDoc && <pre id=\"invalid-result\">{JSON.stringify(invalidDidDoc, null, 2)}</pre>}\n      </header>\n    </div>\n  )\n}\n\nexport default App\n"
  },
  {
    "path": "packages/test-react-app/src/global.ts",
    "content": "import { Buffer } from \"buffer\";\nwindow.Buffer = window.Buffer || Buffer;"
  },
  {
    "path": "packages/test-react-app/src/index.css",
    "content": "body {\n  margin: 0;\n  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',\n    'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',\n    sans-serif;\n  -webkit-font-smoothing: antialiased;\n  -moz-osx-font-smoothing: grayscale;\n}\n\ncode {\n  font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',\n    monospace;\n}\n"
  },
  {
    "path": "packages/test-react-app/src/index.tsx",
    "content": "import * as React from 'react';\nimport { createRoot } from 'react-dom/client';\nimport './global'\nimport './index.css';\nimport App from './App';\nimport reportWebVitals from './reportWebVitals';\n\n\nconst container = document.getElementById('root');\nconst root = createRoot(container);\nroot.render(<React.StrictMode>\n  <App />\n</React.StrictMode>);\n\n// If you want to start measuring performance in your app, pass a function\n// to log results (for example: reportWebVitals(console.log))\n// or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals\nreportWebVitals();\n"
  },
  {
    "path": "packages/test-react-app/src/react-app-env.d.ts",
    "content": "/// <reference types=\"react-scripts\" />\n"
  },
  {
    "path": "packages/test-react-app/src/reportWebVitals.ts",
    "content": "import { ReportHandler } from 'web-vitals';\n\nconst reportWebVitals = (onPerfEntry?: ReportHandler) => {\n  if (onPerfEntry && onPerfEntry instanceof Function) {\n    import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => {\n      getCLS(onPerfEntry);\n      getFID(onPerfEntry);\n      getFCP(onPerfEntry);\n      getLCP(onPerfEntry);\n      getTTFB(onPerfEntry);\n    });\n  }\n};\n\nexport default reportWebVitals;\n"
  },
  {
    "path": "packages/test-react-app/src/setupTests.ts",
    "content": "// jest-dom adds custom jest matchers for asserting on DOM nodes.\n// allows you to do things like:\n// expect(element).toHaveTextContent(/react/i)\n// learn more: https://github.com/testing-library/jest-dom\nimport '@testing-library/jest-dom';\n"
  },
  {
    "path": "packages/test-react-app/src/test-utils/ethers-provider.ts",
    "content": "import { BrowserProvider, Eip1193Provider, Wallet } from 'ethers'\n\nexport function createEthersProvider(): BrowserProvider {\n  const privateKeyHex = '0x1da6847600b0ee25e9ad9a52abbd786dd2502fa4005dd5af9310b7cc7a3b25db'\n  const wallet = new Wallet(privateKeyHex)\n  const mockProvider = new MockWeb3Provider(wallet)\n  const provider = new BrowserProvider(mockProvider)\n  return provider\n}\n\nclass MockWeb3Provider implements Eip1193Provider {\n  constructor(private wallet: Wallet) {}\n\n  async request(request: { method: string; params?: any[] }): Promise<any> {\n    \n    switch(request.method) {\n      case 'personal_sign':\n        // @ts-ignore\n        return this.wallet.signMessage(request.params[1])\n        break\n      case 'eth_signTypedData_v4':\n        // @ts-ignore\n        const {domain, types, message} = JSON.parse(request.params[1])\n        delete(types.EIP712Domain)\n        return this.wallet.signTypedData(domain, types, message)\n      case 'eth_accounts':\n        return [await this.wallet.getAddress()]\n      case 'eth_chainId':\n        return \"1337\"\n      break\n      default:\n        throw Error(`not_available: method ${request.method}`)\n    }\n  }\n}\n"
  },
  {
    "path": "packages/test-react-app/src/test-utils/ganache-provider.ts",
    "content": "import type { JsonRpcError, JsonRpcPayload, JsonRpcResult } from 'ethers'\nimport { assertArgument, Contract, ContractFactory, JsonRpcApiProvider, Network } from 'ethers'\nimport { EthereumDIDRegistry } from 'ethr-did-resolver'\nimport type { EthereumProvider } from 'ganache'\nimport ganache from 'ganache'\n\nexport type GanacheConfig = Parameters<typeof ganache.provider>[0]\n\n/**\n * A JsonRpcApiProvider that connects to a local ganache instance.\n *\n * Code mostly copied from ethersjs test tooling\n * (https://github.com/ethers-io/ext-provider-ganache/blob/335566b563b0a48844e2427ff9e3cd809e37d2b8/src.ts/provider-ganache.ts#L30)\n */\nexport class GanacheProvider extends JsonRpcApiProvider {\n  readonly ganache: EthereumProvider\n\n  constructor(providerOrOptions?: EthereumProvider | GanacheConfig) {\n    let provider: EthereumProvider\n    // eslint-disable-next-line @typescript-eslint/no-explicit-any\n    if (providerOrOptions == null || typeof (<any>providerOrOptions).getOptions !== 'function') {\n      // eslint-disable-next-line @typescript-eslint/no-explicit-any\n      provider = ganache.provider(<any>providerOrOptions)\n    } else {\n      provider = <EthereumProvider>providerOrOptions\n    }\n\n    const network = new Network('testnet', provider.getOptions().chain.chainId)\n    super(network, {\n      staticNetwork: network,\n      batchMaxCount: 1,\n      batchStallTime: 0,\n      cacheTimeout: -1,\n    })\n\n    this.ganache = provider\n  }\n\n  async _send(payload: JsonRpcPayload | Array<JsonRpcPayload>): Promise<Array<JsonRpcResult | JsonRpcError>> {\n    assertArgument(!Array.isArray(payload), 'batch requests unsupported', 'UNSUPPORTED_OPERATION', {\n      operation: '_send',\n      info: { payload },\n    })\n\n    // eslint-disable-next-line @typescript-eslint/no-explicit-any\n    const result = await this.ganache.request(<any>payload)\n    return [{ id: payload.id, result }]\n  }\n}\n\n/**\n * Creates a Web3Provider that connects to a local ganache instance with a bunch of known keys and an ERC1056 contract.\n *\n * This provider can only be used in a single test suite, because of some concurrency issues with ganache.\n */\nexport async function createGanacheProvider(): Promise<{ provider: JsonRpcApiProvider; registry: string }> {\n  const provider = new GanacheProvider({\n    logging: { quiet: true },\n    accounts: [\n      {\n        secretKey: '0x278a5de700e29faae8e40e366ec5012b5ec63d36ec77e8a2417154cc1d25383f',\n        //  address: '0xf3beac30c498d9e26865f34fcaa57dbb935b0d74',\n        //  publicKey: '03fdd57adec3d438ea237fe46b33ee1e016eda6b585c3e27ea66686c2ea5358479'\n        balance: '0x1000000000000000000000',\n      },\n      {\n        secretKey: '0x0000000000000000000000000000000000000000000000000000000000000001',\n        //  address: '0x7e5f4552091a69125d5dfcb7b8c2659029395bdf',\n        //  publicKey: '0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798'\n        balance: '0x1000000000000000000000',\n      },\n      {\n        secretKey: '0x0000000000000000000000000000000000000000000000000000000000000002',\n        //  address: '0x2b5ad5c4795c026514f8317c7a215e218dccd6cf',\n        //  publicKey: '02c6047f9441ed7d6d3045406e95c07cd85c778e4b8cef3ca7abac09b95c709ee5'\n        balance: '0x1000000000000000000000',\n      },\n      {\n        secretKey: '0x0000000000000000000000000000000000000000000000000000000000000003',\n        //  address: '0x6813eb9362372eef6200f3b1dbc3f819671cba69',\n        //  publicKey: '02f9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9'\n        balance: '0x1000000000000000000000',\n      },\n      {\n        secretKey: '0x0000000000000000000000000000000000000000000000000000000000000004',\n        //  address: '0x1eff47bc3a10a45d4b230b5d10e37751fe6aa718',\n        //  publicKey: '02e493dbf1c10d80f3581e4904930b1404cc6c13900ee0758474fa94abe8c4cd13'\n        balance: '0x1000000000000000000000',\n      },\n      {\n        secretKey: '0x0000000000000000000000000000000000000000000000000000000000000005',\n        //  address: '0xe1ab8145f7e55dc933d51a18c793f901a3a0b276'\n        //  publicKey: '022f8bde4d1a07209355b4a7250a5c5128e88b84bddc619ab7cba8d569b240efe4'\n        balance: '0x1000000000000000000000',\n      },\n      {\n        secretKey: '0x0000000000000000000000000000000000000000000000000000000000000006',\n        balance: `0x1000000000000000000000`,\n      },\n    ],\n    // eslint-disable-next-line @typescript-eslint/no-explicit-any\n  } as any) // type error here due to mismatched constructor types in ethers and ganache\n  await provider.ready\n  const factory = ContractFactory.fromSolidity(EthereumDIDRegistry).connect(await provider.getSigner(0))\n\n  let registryContract: Contract = await factory.deploy()\n  registryContract = await registryContract.waitForDeployment()\n\n  const registry = await registryContract.getAddress()\n  return { provider, registry }\n}\n"
  },
  {
    "path": "packages/test-react-app/src/veramo/setup.ts",
    "content": "import {\n  ICredentialPlugin,\n  IDataStore,\n  IDataStoreORM,\n  IDIDManager,\n  IKeyManager,\n  IMessageHandler,\n  IResolver,\n  TAgent,\n} from '@veramo/core-types'\n\nimport { createAgent, IAgentOptions } from '@veramo/core'\n\nimport { DIDResolverPlugin } from '@veramo/did-resolver'\nimport { Resolver } from 'did-resolver'\nimport { getResolver as ethrDidResolver } from 'ethr-did-resolver'\nimport { getResolver as webDidResolver } from 'web-did-resolver'\nimport { MessageHandler } from '@veramo/message-handler'\nimport { KeyManager } from '@veramo/key-manager'\nimport { DIDManager } from '@veramo/did-manager'\nimport { JwtMessageHandler } from '@veramo/did-jwt'\nimport { CredentialPlugin, W3cMessageHandler } from '@veramo/credential-w3c'\nimport {\n  CredentialProviderLD,\n  LdDefaultContexts,\n  VeramoEcdsaSecp256k1RecoverySignature2020,\n  VeramoEd25519Signature2018,\n  VeramoEd25519Signature2020,\n  VeramoJsonWebSignature2020,\n} from '@veramo/credential-ld'\nimport { getDidKeyResolver, KeyDIDProvider } from '@veramo/did-provider-key'\nimport { getResolver as getDidPeerResolver, PeerDIDProvider } from '@veramo/did-provider-peer'\nimport { getDidPkhResolver, PkhDIDProvider } from '@veramo/did-provider-pkh'\nimport { getDidJwkResolver, JwkDIDProvider } from '@veramo/did-provider-jwk'\nimport { DIDComm, DIDCommMessageHandler, IDIDComm } from '@veramo/did-comm'\nimport { ISelectiveDisclosure, SdrMessageHandler, SelectiveDisclosure } from '@veramo/selective-disclosure'\nimport { KeyManagementSystem, SecretBox } from '@veramo/kms-local'\nimport { Web3KeyManagementSystem } from '@veramo/kms-web3'\nimport { EthrDIDProvider } from '@veramo/did-provider-ethr'\nimport { WebDIDProvider } from '@veramo/did-provider-web'\nimport { DataStoreJson, DIDStoreJson, KeyStoreJson, PrivateKeyStoreJson } from '@veramo/data-store-json'\nimport { FakeDidProvider, FakeDidResolver } from '@veramo/test-utils'\nimport { CredentialProviderJWT } from '@veramo/credential-jwt'\nimport { JsonRpcApiProvider } from 'ethers'\nimport { createGanacheProvider } from '../test-utils/ganache-provider'\n\nconst DB_SECRET_KEY = '29739248cad1bd1a0fc4d9b75cd4d2990de535baf5caadfdf8d8f86664aa83'\n\nlet memoryJsonStore = {\n  notifyUpdate: () => Promise.resolve(),\n}\n\nlet provider: JsonRpcApiProvider\nlet registry: string\n\nexport async function setup() {\n  memoryJsonStore = {\n    notifyUpdate: () => Promise.resolve(),\n  }\n  ;({ provider, registry } = await createGanacheProvider())\n  return true\n}\n\ntype InstalledPlugins = IResolver &\n  IKeyManager &\n  IDIDManager &\n  ICredentialPlugin &\n  IDataStoreORM &\n  IDataStore &\n  IMessageHandler &\n  ISelectiveDisclosure &\n  IDIDComm\n\nexport function getAgent(options?: IAgentOptions): TAgent<InstalledPlugins> {\n  const jwt = new CredentialProviderJWT()\n  const ld = new CredentialProviderLD({\n    contextMaps: [LdDefaultContexts],\n    suites: [\n      new VeramoEcdsaSecp256k1RecoverySignature2020(),\n      new VeramoEd25519Signature2018(),\n      new VeramoEd25519Signature2020(),\n      new VeramoJsonWebSignature2020(),\n    ],\n  })\n  const agent: TAgent<InstalledPlugins> = createAgent<InstalledPlugins>({\n    ...options,\n    plugins: [\n      new DIDResolverPlugin({\n        resolver: new Resolver({\n          ...ethrDidResolver({\n            networks: [\n              {\n                chainId: 1337,\n                name: 'ganache',\n                provider,\n                registry,\n              },\n            ],\n          }),\n          ...webDidResolver(),\n          ...getDidKeyResolver(),\n          ...getDidPeerResolver(),\n          ...getDidPkhResolver(),\n          ...getDidJwkResolver(),\n          ...new FakeDidResolver(() => agent as TAgent<IDIDManager>).getDidFakeResolver(),\n        }),\n      }),\n      new KeyManager({\n        store: new KeyStoreJson(memoryJsonStore),\n        kms: {\n          local: new KeyManagementSystem(\n            new PrivateKeyStoreJson(memoryJsonStore, new SecretBox(DB_SECRET_KEY)),\n          ),\n          web3: new Web3KeyManagementSystem({}),\n        },\n      }),\n      new DIDManager({\n        store: new DIDStoreJson(memoryJsonStore),\n        defaultProvider: 'did:pkh',\n        providers: {\n          'did:ethr': new EthrDIDProvider({\n            defaultKms: 'local',\n            ttl: 60 * 60 * 24 * 30 * 12 + 1,\n            networks: [\n              {\n                chainId: 1337,\n                name: 'ganache',\n                provider,\n                registry,\n              },\n            ],\n          }),\n          'did:web': new WebDIDProvider({\n            defaultKms: 'local',\n          }),\n          'did:key': new KeyDIDProvider({\n            defaultKms: 'local',\n          }),\n          'did:peer': new PeerDIDProvider({\n            defaultKms: 'local',\n          }),\n          'did:pkh': new PkhDIDProvider({\n            defaultKms: 'local',\n          }),\n          'did:jwk': new JwkDIDProvider({\n            defaultKms: 'local',\n          }),\n          'did:fake': new FakeDidProvider(),\n        },\n      }),\n      new DataStoreJson(memoryJsonStore),\n      new MessageHandler({\n        messageHandlers: [\n          new DIDCommMessageHandler(),\n          new JwtMessageHandler(),\n          new W3cMessageHandler(),\n          new SdrMessageHandler(),\n        ],\n      }),\n      new DIDComm(),\n      new CredentialPlugin([jwt, ld]),\n      new SelectiveDisclosure(),\n      ...(options?.plugins || []),\n    ],\n  })\n  return agent\n}\n"
  },
  {
    "path": "packages/test-react-app/tsconfig.json",
    "content": "{\n  \"extends\": \"../tsconfig.settings.json\",\n  \"compilerOptions\": {\n    \"lib\": [\"dom\", \"dom.iterable\", \"esnext\"],\n    \"types\": [\n      \"puppeteer\",\n      \"jest-environment-puppeteer\",\n      \"expect-puppeteer\"\n    ],\n    \"skipLibCheck\": true,\n    \"allowSyntheticDefaultImports\": true,\n    \"forceConsistentCasingInFileNames\": true,\n    \"moduleResolution\": \"node\",\n    \"isolatedModules\": true,\n    \"noEmit\": true,\n    \"jsx\": \"react-jsx\"\n  },\n  \"include\": [\n    \"src/**/*.ts[x]?\"\n  ],\n  \"references\": [\n    { \"path\": \"../core-types\" },\n    { \"path\": \"../core\" },\n    { \"path\": \"../credential-ld\" },\n    { \"path\": \"../credential-w3c\" },\n    { \"path\": \"../data-store\" },\n    { \"path\": \"../data-store-json\" },\n    { \"path\": \"../did-comm\" },\n    { \"path\": \"../did-discovery\" },\n    { \"path\": \"../did-jwt\" },\n    { \"path\": \"../did-manager\" },\n    { \"path\": \"../did-provider-ethr\" },\n    { \"path\": \"../did-provider-jwk\" },\n    { \"path\": \"../did-provider-key\" },\n    { \"path\": \"../did-provider-peer\" },\n    { \"path\": \"../did-provider-pkh\" },\n    { \"path\": \"../did-provider-web\" },\n    { \"path\": \"../did-resolver\" },\n    { \"path\": \"../key-manager\" },\n    { \"path\": \"../kms-local\" },\n    { \"path\": \"../message-handler\" },\n    { \"path\": \"../remote-client\" },\n    { \"path\": \"../remote-server\" },\n    { \"path\": \"../selective-disclosure\" },\n    { \"path\": \"../url-handler\" },\n    { \"path\": \"../test-utils\" },\n    { \"path\": \"../utils\" }\n  ]\n}\n"
  },
  {
    "path": "packages/test-utils/CHANGELOG.md",
    "content": "# Change Log\n\nAll notable changes to this project will be documented in this file.\nSee [Conventional Commits](https://conventionalcommits.org) for commit guidelines.\n\n# [7.0.0](https://github.com/decentralized-identity/veramo/compare/v6.0.2...v7.0.0) (2026-02-11)\n\n\n### Bug Fixes\n\n* **deps:** update devdeps and bump typeorm to 0.3.20 ([#1272](https://github.com/decentralized-identity/veramo/issues/1272)) ([7d17f37](https://github.com/decentralized-identity/veramo/commit/7d17f37ea7cc4e73a8cdae028681ae1be5c4d11c))\n\n\n\n\n\n## [6.0.2](https://github.com/decentralized-identity/veramo/compare/v6.0.1...v6.0.2) (2026-01-16)\n\n**Note:** Version bump only for package @veramo/test-utils\n\n\n\n\n\n## [6.0.1](https://github.com/decentralized-identity/veramo/compare/v6.0.0...v6.0.1) (2026-01-16)\n\n**Note:** Version bump only for package @veramo/test-utils\n\n\n\n\n\n# [6.0.0](https://github.com/decentralized-identity/veramo/compare/v5.6.0...v6.0.0) (2024-04-02)\n\n**Note:** Version bump only for package @veramo/test-utils\n\n\n\n\n\n# [5.6.0](https://github.com/decentralized-identity/veramo/compare/v5.5.3...v5.6.0) (2024-01-16)\n\n**Note:** Version bump only for package @veramo/test-utils\n\n\n\n\n\n## [5.5.3](https://github.com/decentralized-identity/veramo/compare/v5.5.2...v5.5.3) (2023-10-09)\n\n\n### Bug Fixes\n\n* use DIF URLs in packages ([#1271](https://github.com/decentralized-identity/veramo/issues/1271)) ([3dfc601](https://github.com/decentralized-identity/veramo/commit/3dfc6014cdee7902c59d8db76b4c8507b870f227))\n\n\n\n\n\n# [5.5.0](https://github.com/uport-project/veramo/compare/v5.4.1...v5.5.0) (2023-09-19)\n\n\n### Bug Fixes\n\n* **did-provider-key:** use compressed keys for creating Secp256k1 did:key ([#1217](https://github.com/uport-project/veramo/issues/1217)) ([ba8f6f5](https://github.com/uport-project/veramo/commit/ba8f6f5b9b701e57af86491504ecd209ca0c1c1d)), closes [#1213](https://github.com/uport-project/veramo/issues/1213)\n\n\n\n\n\n## [5.4.1](https://github.com/uport-project/veramo/compare/v5.4.0...v5.4.1) (2023-08-04)\n\n**Note:** Version bump only for package @veramo/test-utils\n\n\n\n\n\n# [5.4.0](https://github.com/uport-project/veramo/compare/v5.3.0...v5.4.0) (2023-08-01)\n\n\n### Features\n\n* **did-comm:** add support for the AES based content and key encryption algorithms ([#1180](https://github.com/uport-project/veramo/issues/1180)) ([5294a81](https://github.com/uport-project/veramo/commit/5294a812ee578c0712b54f216416c3ef78c848da))\n\n\n\n\n\n# [5.3.0](https://github.com/uport-project/veramo/compare/v5.2.0...v5.3.0) (2023-07-27)\n\n**Note:** Version bump only for package @veramo/test-utils\n\n\n\n\n\n# [5.2.0](https://github.com/uport-project/veramo/compare/v5.1.4...v5.2.0) (2023-05-02)\n\n\n### Bug Fixes\n\n* **credential-ld:** fix Ed25519Signature2020 verification ([#1166](https://github.com/uport-project/veramo/issues/1166)) ([c965fd5](https://github.com/uport-project/veramo/commit/c965fd502f652c9929ae4753c56ebbe351447733))\n\n\n\n\n\n## [5.1.2](https://github.com/uport-project/veramo/compare/v5.1.1...v5.1.2) (2023-02-25)\n\n**Note:** Version bump only for package @veramo/test-utils\n\n\n\n\n\n# [5.1.0](https://github.com/uport-project/veramo/compare/v5.0.0...v5.1.0) (2023-02-24)\n\n**Note:** Version bump only for package @veramo/test-utils\n\n\n\n\n\n# [5.0.0](https://github.com/uport-project/veramo/compare/v4.3.0...v5.0.0) (2023-02-09)\n\n\n### Build System\n\n* convert veramo modules to ESM instead of CommonJS ([#1103](https://github.com/uport-project/veramo/issues/1103)) ([b5cea3c](https://github.com/uport-project/veramo/commit/b5cea3c0d80d900a47bd1d9eea68f84b70a35e7b)), closes [#1099](https://github.com/uport-project/veramo/issues/1099)\n\n\n### Features\n\n* isolate `core-types` package from `core` ([#1116](https://github.com/uport-project/veramo/issues/1116)) ([ba7a303](https://github.com/uport-project/veramo/commit/ba7a303de91cf4cc568a3af1ddf8ca98ed022e9f))\n\n\n### BREAKING CHANGES\n\n* this is a breaking change as modules will have to be imported differently: \n* https://www.typescriptlang.org/docs/handbook/esm-node.html\n* https://nodejs.org/api/esm.html\n* https://caniuse.com/?search=modules\n\ntest(did-provider-ion): skip a couple of tests that fail with unreasonable errors\nchore: use ubuntu-latest on CI\nfix: temporarily remove puppeteer tests\nfix: use craco for test-react-app to enable babel config\ntest: fix unit and integration tests (browser tests still broken)\nfix: fix some build issues that prevented tests from working\nfix: missing deps flagged by pnpm\n\n\n\n\n\n# [4.3.0](https://github.com/uport-project/veramo/compare/v4.2.0...v4.3.0) (2023-01-27)\n\n**Note:** Version bump only for package @veramo/test-utils\n\n\n\n\n\n# [4.2.0](https://github.com/uport-project/veramo/compare/v4.1.2...v4.2.0) (2022-12-05)\n\n\n### Bug Fixes\n\n* **deps:** bump dependencies ([701b8ed](https://github.com/uport-project/veramo/commit/701b8edf981ea11c7ddb6a81d2817dbbdbb022f3))\n\n\n\n\n\n## [4.1.1](https://github.com/uport-project/veramo/compare/v4.1.0...v4.1.1) (2022-11-01)\n\n**Note:** Version bump only for package @veramo/test-utils\n\n\n\n\n\n# [4.1.0](https://github.com/uport-project/veramo/compare/v4.0.2...v4.1.0) (2022-10-31)\n\n\n### Bug Fixes\n\n* **deps:** Update dependency ethr-did-resolver to v7 ([#1038](https://github.com/uport-project/veramo/issues/1038)) ([d421c0f](https://github.com/uport-project/veramo/commit/d421c0f9f5934829df2930e58e98bcfce813ce84))\n\n\n\n\n\n## [4.0.2](https://github.com/uport-project/veramo/compare/v4.0.1...v4.0.2) (2022-10-04)\n\n**Note:** Version bump only for package @veramo/test-utils\n\n\n\n\n\n# [4.0.0](https://github.com/uport-project/veramo/compare/v3.1.5...v4.0.0) (2022-09-22)\n\n\n### Bug Fixes\n\n* **deps:** update did-libraries ([219cde2](https://github.com/uport-project/veramo/commit/219cde250e8d4f06d7978afcc38a04471342fd21))\n* **deps:** use did-jwt v6 and ethr-did-resolver v6 ([#925](https://github.com/uport-project/veramo/issues/925)) ([0c77d03](https://github.com/uport-project/veramo/commit/0c77d03ec5ec9e2091de3f74f67ab86a22cde197)), closes [#923](https://github.com/uport-project/veramo/issues/923) [#848](https://github.com/uport-project/veramo/issues/848)\n\n\n### Features\n\n* add support for serviceEndpoint property as defined in latest DID Spec ([#988](https://github.com/uport-project/veramo/issues/988)) ([9bed70b](https://github.com/uport-project/veramo/commit/9bed70ba658aed34a97944e0dee27bca6c81d700))\n* **credential-ld:** add support for browser environments ([#916](https://github.com/uport-project/veramo/issues/916)) ([435e4d2](https://github.com/uport-project/veramo/commit/435e4d260b1774f96b182c1a75ab2f1c993f2291))\n* **data-store:** use DataSource instead of Connection ([#970](https://github.com/uport-project/veramo/issues/970)) ([3377930](https://github.com/uport-project/veramo/commit/3377930189bcbd43dfd155992093d2bbeb883335)), closes [#947](https://github.com/uport-project/veramo/issues/947)\n* **did-manager:** add`didManagerUpdate` method for full DID document updates ([#974](https://github.com/uport-project/veramo/issues/974)) ([5682b25](https://github.com/uport-project/veramo/commit/5682b2566b7c4f8f9bfda10e8d06a8d2624c2a1b)), closes [#971](https://github.com/uport-project/veramo/issues/971) [#960](https://github.com/uport-project/veramo/issues/960) [#948](https://github.com/uport-project/veramo/issues/948)\n\n\n### BREAKING CHANGES\n\n* the `did-resolver` and connected libraries change the data-type for `ServiceEndpoint` to `Service` and the previous semantic has changed. Services can have multiple endpoints, not just a single string.\n"
  },
  {
    "path": "packages/test-utils/LICENSE",
    "content": "                                 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 2022 Consensys AG\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"
  },
  {
    "path": "packages/test-utils/README.md",
    "content": "# Veramo test-utils\n\nHelper methods for Veramo integration tests. This package is NOT meant to be used in production.\n"
  },
  {
    "path": "packages/test-utils/package.json",
    "content": "{\n  \"name\": \"@veramo/test-utils\",\n  \"private\": true,\n  \"description\": \"Helper methods for Veramo integration tests. This package is not meant to be used in production.\",\n  \"version\": \"7.0.0\",\n  \"main\": \"build/index.js\",\n  \"exports\": \"./build/index.js\",\n  \"types\": \"build/index.d.ts\",\n  \"scripts\": {\n    \"build\": \"tsc\"\n  },\n  \"dependencies\": {\n    \"@veramo/core-types\": \"workspace:*\",\n    \"@veramo/did-discovery\": \"workspace:*\",\n    \"@veramo/did-manager\": \"workspace:*\",\n    \"@veramo/utils\": \"workspace:*\",\n    \"did-resolver\": \"^4.1.0\"\n  },\n  \"devDependencies\": {\n    \"typescript\": \"5.7.3\"\n  },\n  \"files\": [\n    \"build/**/*\",\n    \"src/**/*\",\n    \"README.md\",\n    \"LICENSE\"\n  ],\n  \"publishConfig\": {\n    \"access\": \"public\"\n  },\n  \"repository\": {\n    \"type\": \"git\",\n    \"url\": \"https://github.com/decentralized-identity/veramo.git\",\n    \"directory\": \"packages/test-utils\"\n  },\n  \"author\": \"Consensys Mesh R&D <hello@veramo.io>\",\n  \"contributors\": [\n    \"Mircea Nistor <mircea.nistor@mesh.xyz>\"\n  ],\n  \"license\": \"Apache-2.0\",\n  \"keywords\": [\n    \"Veramo\",\n    \"test\",\n    \"jest\",\n    \"util\"\n  ],\n  \"type\": \"module\",\n  \"moduleDirectories\": [\n    \"node_modules\",\n    \"src\"\n  ]\n}\n"
  },
  {
    "path": "packages/test-utils/src/broken-did-discovery.ts",
    "content": "import { IAgentContext, } from '@veramo/core-types'\nimport {\n  AbstractDidDiscoveryProvider,\n  IDIDDiscoveryDiscoverDidArgs,\n  IDIDDiscoveryProviderResult\n} from \"@veramo/did-discovery\";\n\n/**\n * A DID Discovery provider that throws an error for a particular query, used to test error handling.\n */\nexport class BrokenDiscoveryProvider implements AbstractDidDiscoveryProvider {\n  readonly name = 'broken-discovery'\n\n  async discoverDid(\n    args: IDIDDiscoveryDiscoverDidArgs,\n    context: IAgentContext<any>,\n  ): Promise<IDIDDiscoveryProviderResult> {\n    if (args.query.match(/broken/)) {\n      throw new Error(`test_error: let's see how the plugin handles provider errors`)\n    }\n    return { matches: [], provider: this.name }\n  }\n}\n"
  },
  {
    "path": "packages/test-utils/src/example-did.ts",
    "content": "import {\n  IAgentContext,\n  IDIDManager,\n  IIdentifier,\n  IKey,\n  IKeyManager,\n  IService,\n  TAgent,\n} from '@veramo/core-types'\nimport { AbstractIdentifierProvider } from '@veramo/did-manager'\nimport { _NormalizedVerificationMethod } from '@veramo/utils'\nimport {\n  DIDResolutionOptions,\n  DIDResolutionResult,\n  DIDResolver,\n  ParsedDID,\n  Resolvable,\n  VerificationMethod,\n} from 'did-resolver'\n\n/**\n * A DID method that uses the information stored by the DID manager to resolve\n */\nexport class ExampleDidProvider extends AbstractIdentifierProvider {\n  private defaultKms: string\n\n  constructor({ defaultKms }: { defaultKms: string } = { defaultKms: 'local' }) {\n    super()\n    this.defaultKms = defaultKms\n  }\n\n  async createIdentifier(\n    { kms, alias, options }: { kms?: string; alias?: string; options?: any },\n    context: IAgentContext<IKeyManager>,\n  ): Promise<Omit<IIdentifier, 'provider'>> {\n    const key = await context.agent.keyManagerCreate({\n      kms: kms || this.defaultKms,\n      type: options?.type || 'Secp256k1',\n    })\n\n    const identifier: Omit<IIdentifier, 'provider'> = {\n      did: 'did:example:' + alias,\n      controllerKeyId: key.kid,\n      keys: [key],\n      services: [],\n    }\n    return identifier\n  }\n\n  async updateIdentifier(args: { did: string; kms?: string | undefined; alias?: string | undefined; options?: any }, context: IAgentContext<IKeyManager>): Promise<IIdentifier> {\n    throw new Error('FakeDIDProvider updateIdentifier not supported yet.')\n  }\n\n  async deleteIdentifier(identifier: IIdentifier, context: IAgentContext<IKeyManager>): Promise<boolean> {\n    for (const { kid } of identifier.keys) {\n      await context.agent.keyManagerDelete({ kid })\n    }\n    return true\n  }\n\n  async addKey(\n    { identifier, key, options }: { identifier: IIdentifier; key: IKey; options?: any },\n    context: IAgentContext<IKeyManager>,\n  ): Promise<any> {\n    return { success: true }\n  }\n\n  async addService(\n    { identifier, service, options }: { identifier: IIdentifier; service: IService; options?: any },\n    context: IAgentContext<IKeyManager>,\n  ): Promise<any> {\n    return { success: true }\n  }\n\n  async removeKey(\n    args: { identifier: IIdentifier; kid: string; options?: any },\n    context: IAgentContext<IKeyManager>,\n  ): Promise<any> {\n    return { success: true }\n  }\n\n  async removeService(\n    args: { identifier: IIdentifier; id: string; options?: any },\n    context: IAgentContext<IKeyManager>,\n  ): Promise<any> {\n    return { success: true }\n  }\n}\n"
  },
  {
    "path": "packages/test-utils/src/fake-did.ts",
    "content": "import {\n  IAgentContext,\n  IDIDManager,\n  IIdentifier,\n  IKey,\n  IKeyManager,\n  IService,\n  TAgent,\n} from '@veramo/core-types'\nimport { AbstractIdentifierProvider } from '@veramo/did-manager'\nimport { _NormalizedVerificationMethod } from '@veramo/utils'\nimport {\n  DIDResolutionOptions,\n  DIDResolutionResult,\n  DIDResolver,\n  ParsedDID,\n  Resolvable,\n  VerificationMethod,\n} from 'did-resolver'\n\n/**\n * A DID method that uses the information stored by the DID manager to resolve\n */\nexport class FakeDidProvider extends AbstractIdentifierProvider {\n  private defaultKms: string\n\n  constructor({ defaultKms }: { defaultKms: string } = { defaultKms: 'local' }) {\n    super()\n    this.defaultKms = defaultKms\n  }\n\n  async createIdentifier(\n    { kms, alias, options }: { kms?: string; alias?: string; options?: any },\n    context: IAgentContext<IKeyManager>,\n  ): Promise<Omit<IIdentifier, 'provider'>> {\n    const key = await context.agent.keyManagerCreate({\n      kms: kms || this.defaultKms,\n      type: options?.type || 'Secp256k1',\n    })\n\n    const identifier: Omit<IIdentifier, 'provider'> = {\n      did: 'did:fake:' + alias,\n      controllerKeyId: key.kid,\n      keys: [key],\n      services: [],\n    }\n    return identifier\n  }\n\n  async updateIdentifier(\n    args: {\n      did: string\n      kms?: string | undefined\n      alias?: string | undefined\n      options?: any\n    },\n    context: IAgentContext<IKeyManager>,\n  ): Promise<IIdentifier> {\n    throw new Error('FakeDIDProvider updateIdentifier not supported yet.')\n  }\n\n  async deleteIdentifier(identifier: IIdentifier, context: IAgentContext<IKeyManager>): Promise<boolean> {\n    for (const { kid } of identifier.keys) {\n      await context.agent.keyManagerDelete({ kid })\n    }\n    return true\n  }\n\n  async addKey(\n    { identifier, key, options }: { identifier: IIdentifier; key: IKey; options?: any },\n    context: IAgentContext<IKeyManager>,\n  ): Promise<any> {\n    return { success: true }\n  }\n\n  async addService(\n    { identifier, service, options }: { identifier: IIdentifier; service: IService; options?: any },\n    context: IAgentContext<IKeyManager>,\n  ): Promise<any> {\n    return { success: true }\n  }\n\n  async removeKey(\n    args: { identifier: IIdentifier; kid: string; options?: any },\n    context: IAgentContext<IKeyManager>,\n  ): Promise<any> {\n    return { success: true }\n  }\n\n  async removeService(\n    args: { identifier: IIdentifier; id: string; options?: any },\n    context: IAgentContext<IKeyManager>,\n  ): Promise<any> {\n    return { success: true }\n  }\n}\n\nexport class FakeDidResolver {\n  getAgent: () => TAgent<IDIDManager>\n  private force2020: boolean\n\n  constructor(getAgent: () => TAgent<IDIDManager>, force2020: boolean = false) {\n    this.getAgent = getAgent\n    this.force2020 = force2020\n  }\n\n  resolveFakeDid: DIDResolver = async (\n    didUrl: string,\n    _parsed: ParsedDID,\n    _resolver: Resolvable,\n    options: DIDResolutionOptions,\n  ): Promise<DIDResolutionResult> => {\n    try {\n      const contexts = new Set<string>()\n      const agent = this.getAgent()\n      const identifier = await agent.didManagerGet({ did: _parsed.did })\n      const did = _parsed.did\n      const verificationMethod: VerificationMethod[] = identifier.keys.map((key) => {\n        const vm: _NormalizedVerificationMethod = { ...key, controller: did, id: `${did}#${key.kid}` }\n        switch (key.type) {\n          case 'Secp256k1':\n            vm.type = 'EcdsaSecp256k1VerificationKey2019'\n            contexts.add('https://w3id.org/security/v2')\n            contexts.add('https://w3id.org/security/suites/secp256k1recovery-2020/v2')\n            break\n          case 'Ed25519':\n            if (this.force2020) {\n              vm.type = 'Ed25519VerificationKey2020'\n              contexts.add('https://w3id.org/security/suites/ed25519-2020/v1')\n            } else {\n              vm.type = 'Ed25519VerificationKey2018'\n              contexts.add('https://w3id.org/security/suites/ed25519-2018/v1')\n            }\n            break\n          case 'X25519':\n            if (this.force2020) {\n              vm.type = 'X25519KeyAgreementKey2020'\n              contexts.add('https://w3id.org/security/suites/x25519-2020/v1')\n            } else {\n              vm.type = 'X25519KeyAgreementKey2019'\n              contexts.add('https://w3id.org/security/suites/x25519-2019/v1')\n            }\n            break\n          default:\n            break\n        }\n        const { meta, description, kid, ...result } = vm as any\n        return result\n      })\n      const vmIds = verificationMethod.map((vm) => vm.id)\n      const service = identifier.services.map((service) => {\n        service.id = `${did}#${service.id}`\n        delete service.description\n        return service\n      })\n\n      const didResolution: DIDResolutionResult = {\n        didResolutionMetadata: {},\n        didDocument: {\n          '@context': ['https://www.w3.org/ns/did/v1', ...contexts],\n          id: did,\n          service,\n          verificationMethod,\n          keyAgreement: vmIds,\n          authentication: vmIds,\n          assertionMethod: vmIds,\n        },\n        didDocumentMetadata: {},\n      }\n      return didResolution\n    } catch (err: any) {\n      return {\n        didDocumentMetadata: {},\n        didResolutionMetadata: { error: 'invalidDid', message: err.toString() },\n        didDocument: null,\n      }\n    }\n  }\n\n  getDidFakeResolver() {\n    return { fake: this.resolveFakeDid.bind(this) }\n  }\n}\n"
  },
  {
    "path": "packages/test-utils/src/index.ts",
    "content": "/**\n * Contains helper methods for Veramo integration tests.\n *\n * NOT to be used in production.\n *\n * @packageDocumentation\n */\n\nexport * from './fake-did.js'\nexport * from './example-did.js'\nexport * from './broken-did-discovery.js'\n"
  },
  {
    "path": "packages/test-utils/tsconfig.json",
    "content": "{\n  \"extends\": \"../tsconfig.settings.json\",\n  \"compilerOptions\": {\n    \"rootDir\": \"src\",\n    \"outDir\": \"build\",\n    \"declarationDir\": \"build\"\n  },\n  \"references\": [\n    { \"path\": \"../core-types\" },\n    { \"path\": \"../did-discovery\" },\n    { \"path\": \"../did-manager\" },\n    { \"path\": \"../utils\" }\n  ]\n}\n"
  },
  {
    "path": "packages/tsconfig.settings.json",
    "content": "{\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"preserveConstEnums\": true,\n    \"sourceMap\": true,\n    \"target\": \"ES2022\",\n    \"module\": \"ESNext\",\n    \"moduleResolution\": \"Node\",\n    \"esModuleInterop\": true,\n    \"downlevelIteration\": true,\n    \"declarationMap\": true,\n    \"declaration\": true,\n    \"composite\": true,\n    \"emitDecoratorMetadata\": true,\n    \"useUnknownInCatchVariables\": false,\n    \"experimentalDecorators\": true,\n    \"resolveJsonModule\": true,\n    \"allowSyntheticDefaultImports\": true,\n    \"skipLibCheck\": true,\n    \"types\": [\n      \"jest\"\n    ]\n  },\n  \"ts-node\": {\n    \"compilerOptions\": {\n      \"module\": \"CommonJS\"\n    }\n  },\n  \"exclude\": [\n    \"**/__tests__/**/*\",\n    \"**/build/**/*\"\n  ]\n}\n"
  },
  {
    "path": "packages/url-handler/CHANGELOG.md",
    "content": "# Change Log\n\nAll notable changes to this project will be documented in this file.\nSee [Conventional Commits](https://conventionalcommits.org) for commit guidelines.\n\n# [7.0.0](https://github.com/decentralized-identity/veramo/compare/v6.0.2...v7.0.0) (2026-02-11)\n\n\n### Bug Fixes\n\n* **deps:** update devdeps and bump typeorm to 0.3.20 ([#1272](https://github.com/decentralized-identity/veramo/issues/1272)) ([7d17f37](https://github.com/decentralized-identity/veramo/commit/7d17f37ea7cc4e73a8cdae028681ae1be5c4d11c))\n\n\n\n\n\n## [6.0.2](https://github.com/decentralized-identity/veramo/compare/v6.0.1...v6.0.2) (2026-01-16)\n\n**Note:** Version bump only for package @veramo/url-handler\n\n\n\n\n\n## [6.0.1](https://github.com/decentralized-identity/veramo/compare/v6.0.0...v6.0.1) (2026-01-16)\n\n**Note:** Version bump only for package @veramo/url-handler\n\n\n\n\n\n# [6.0.0](https://github.com/decentralized-identity/veramo/compare/v5.6.0...v6.0.0) (2024-04-02)\n\n**Note:** Version bump only for package @veramo/url-handler\n\n\n\n\n\n# [5.6.0](https://github.com/decentralized-identity/veramo/compare/v5.5.3...v5.6.0) (2024-01-16)\n\n**Note:** Version bump only for package @veramo/url-handler\n\n\n\n\n\n## [5.5.3](https://github.com/decentralized-identity/veramo/compare/v5.5.2...v5.5.3) (2023-10-09)\n\n\n### Bug Fixes\n\n* use DIF URLs in packages ([#1271](https://github.com/decentralized-identity/veramo/issues/1271)) ([3dfc601](https://github.com/decentralized-identity/veramo/commit/3dfc6014cdee7902c59d8db76b4c8507b870f227))\n\n\n\n\n\n# [5.5.0](https://github.com/uport-project/veramo/compare/v5.4.1...v5.5.0) (2023-09-19)\n\n\n### Bug Fixes\n\n* **deps:** update dependency cross-fetch to v4 ([1c14d34](https://github.com/uport-project/veramo/commit/1c14d34f48a51bef373541e84ed89f2f44711406))\n* **did-provider-key:** use compressed keys for creating Secp256k1 did:key ([#1217](https://github.com/uport-project/veramo/issues/1217)) ([ba8f6f5](https://github.com/uport-project/veramo/commit/ba8f6f5b9b701e57af86491504ecd209ca0c1c1d)), closes [#1213](https://github.com/uport-project/veramo/issues/1213)\n\n\n\n\n\n## [5.4.1](https://github.com/uport-project/veramo/compare/v5.4.0...v5.4.1) (2023-08-04)\n\n\n### Bug Fixes\n\n* **ci:** benign change meant to tag all packages for another patch release ([#1211](https://github.com/uport-project/veramo/issues/1211)) ([41b5c90](https://github.com/uport-project/veramo/commit/41b5c90277171b7b38c5cf49ca01db5cf75b6300))\n\n\n\n\n\n# [5.4.0](https://github.com/uport-project/veramo/compare/v5.3.0...v5.4.0) (2023-08-01)\n\n**Note:** Version bump only for package @veramo/url-handler\n\n\n\n\n\n# [5.3.0](https://github.com/uport-project/veramo/compare/v5.2.0...v5.3.0) (2023-07-27)\n\n**Note:** Version bump only for package @veramo/url-handler\n\n\n\n\n\n## [5.1.2](https://github.com/uport-project/veramo/compare/v5.1.1...v5.1.2) (2023-02-25)\n\n**Note:** Version bump only for package @veramo/url-handler\n\n\n\n\n\n# [5.1.0](https://github.com/uport-project/veramo/compare/v5.0.0...v5.1.0) (2023-02-24)\n\n**Note:** Version bump only for package @veramo/url-handler\n\n\n\n\n\n# [5.0.0](https://github.com/uport-project/veramo/compare/v4.3.0...v5.0.0) (2023-02-09)\n\n\n### Build System\n\n* convert veramo modules to ESM instead of CommonJS ([#1103](https://github.com/uport-project/veramo/issues/1103)) ([b5cea3c](https://github.com/uport-project/veramo/commit/b5cea3c0d80d900a47bd1d9eea68f84b70a35e7b)), closes [#1099](https://github.com/uport-project/veramo/issues/1099)\n\n\n### Features\n\n* isolate `core-types` package from `core` ([#1116](https://github.com/uport-project/veramo/issues/1116)) ([ba7a303](https://github.com/uport-project/veramo/commit/ba7a303de91cf4cc568a3af1ddf8ca98ed022e9f))\n\n\n### BREAKING CHANGES\n\n* this is a breaking change as modules will have to be imported differently: \n* https://www.typescriptlang.org/docs/handbook/esm-node.html\n* https://nodejs.org/api/esm.html\n* https://caniuse.com/?search=modules\n\ntest(did-provider-ion): skip a couple of tests that fail with unreasonable errors\nchore: use ubuntu-latest on CI\nfix: temporarily remove puppeteer tests\nfix: use craco for test-react-app to enable babel config\ntest: fix unit and integration tests (browser tests still broken)\nfix: fix some build issues that prevented tests from working\nfix: missing deps flagged by pnpm\n\n\n\n\n\n# [4.3.0](https://github.com/uport-project/veramo/compare/v4.2.0...v4.3.0) (2023-01-27)\n\n**Note:** Version bump only for package @veramo/url-handler\n\n\n\n\n\n# [4.2.0](https://github.com/uport-project/veramo/compare/v4.1.2...v4.2.0) (2022-12-05)\n\n\n### Bug Fixes\n\n* **deps:** bump dependencies ([701b8ed](https://github.com/uport-project/veramo/commit/701b8edf981ea11c7ddb6a81d2817dbbdbb022f3))\n\n\n\n\n\n## [4.1.1](https://github.com/uport-project/veramo/compare/v4.1.0...v4.1.1) (2022-11-01)\n\n**Note:** Version bump only for package @veramo/url-handler\n\n\n\n\n\n# [4.1.0](https://github.com/uport-project/veramo/compare/v4.0.2...v4.1.0) (2022-10-31)\n\n**Note:** Version bump only for package @veramo/url-handler\n\n\n\n\n\n# [4.0.0](https://github.com/uport-project/veramo/compare/v3.1.5...v4.0.0) (2022-09-22)\n\n\n### Bug Fixes\n\n* **credential-ld:** fix EcdsaSecp256k1RecoverySignature2020 suite context ([#909](https://github.com/uport-project/veramo/issues/909)) ([48fbee3](https://github.com/uport-project/veramo/commit/48fbee3e62eab3df4225ae0bdb3a92f5665eb171))\n* **did-resolver:** use interface `Resolvable` instead of the `Resolver` class ([9c2e59f](https://github.com/uport-project/veramo/commit/9c2e59f3f23f808511c6c0e8e440b4d53ba5cb00))\n* update and fix inline documentation of all exported types ([#921](https://github.com/uport-project/veramo/issues/921)) ([63e64e0](https://github.com/uport-project/veramo/commit/63e64e0e2693808c4704dca8cc511dc0bab3f3b1))\n\n\n### Features\n\n* **credential-ld:** add support for browser environments ([#916](https://github.com/uport-project/veramo/issues/916)) ([435e4d2](https://github.com/uport-project/veramo/commit/435e4d260b1774f96b182c1a75ab2f1c993f2291))\n\n\n\n\n\n## [3.1.3](https://github.com/uport-project/veramo/compare/v3.1.2...v3.1.3) (2022-06-01)\n\n**Note:** Version bump only for package @veramo/url-handler\n\n\n\n\n\n# [3.1.0](https://github.com/uport-project/veramo/compare/v3.0.0...v3.1.0) (2021-11-12)\n\n**Note:** Version bump only for package @veramo/url-handler\n\n\n\n\n\n# [3.0.0](https://github.com/uport-project/veramo/compare/v2.1.3...v3.0.0) (2021-09-20)\n\n**Note:** Version bump only for package @veramo/url-handler\n\n\n\n\n\n# [2.1.0](https://github.com/uport-project/veramo/compare/v2.0.1...v2.1.0) (2021-08-11)\n\n**Note:** Version bump only for package @veramo/url-handler\n\n\n\n\n\n# [2.0.0](https://github.com/uport-project/veramo/compare/v1.2.2...v2.0.0) (2021-07-14)\n\n**Note:** Version bump only for package @veramo/url-handler\n\n\n\n\n\n# [1.2.0](https://github.com/uport-project/veramo/compare/v1.1.2...v1.2.0) (2021-04-27)\n\n\n### Bug Fixes\n\n* **deps:** update all non-major dependencies ([#462](https://github.com/uport-project/veramo/issues/462)) ([4a2b206](https://github.com/uport-project/veramo/commit/4a2b20633810b45a155bf2149cbff57d157bda3c))\n\n\n### Features\n\n* **url-handler:** allow for URL redirects ([#362](https://github.com/uport-project/veramo/issues/362)) ([#366](https://github.com/uport-project/veramo/issues/366)) ([92a86d6](https://github.com/uport-project/veramo/commit/92a86d6f8cf652e731ca662085efe78aeab198eb))\n\n\n\n\n\n# [1.1.0](https://github.com/uport-project/veramo/compare/v1.0.1...v1.1.0) (2021-01-26)\n\n**Note:** Version bump only for package @veramo/url-handler\n\n\n\n\n\n## 1.0.1 (2020-12-18)\n\n**Note:** Version bump only for package @veramo/url-handler\n"
  },
  {
    "path": "packages/url-handler/LICENSE",
    "content": "                                 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 2019 Consensys AG\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"
  },
  {
    "path": "packages/url-handler/README.md",
    "content": "# Veramo URL handler\n\nThis is an implementation of `AbstractMessageHandler` that can interpret messages presented as a URL.\n\nThis is done either by attempting to extract a `c_i` param from the URL query string or by fetching the given URL. This also looks for a URL redirect and attempts to extract the parameter from the redirected URL.\n"
  },
  {
    "path": "packages/url-handler/api-extractor.json",
    "content": "{\n  \"$schema\": \"https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json\",\n  \"apiReport\": {\n    \"enabled\": true,\n    \"reportFolder\": \"./api\",\n    \"reportTempFolder\": \"./api\"\n  },\n\n  \"docModel\": {\n    \"enabled\": true,\n    \"apiJsonFilePath\": \"./api/<unscopedPackageName>.api.json\"\n  },\n\n  \"dtsRollup\": {\n    \"enabled\": false\n  },\n  \"mainEntryPointFilePath\": \"<projectFolder>/build/index.d.ts\"\n}\n"
  },
  {
    "path": "packages/url-handler/package.json",
    "content": "{\n  \"name\": \"@veramo/url-handler\",\n  \"description\": \"Veramo message handler plugin to decode URL messages.\",\n  \"version\": \"7.0.0\",\n  \"main\": \"build/index.js\",\n  \"exports\": \"./build/index.js\",\n  \"types\": \"build/index.d.ts\",\n  \"scripts\": {\n    \"build\": \"tsc\",\n    \"extract-api\": \"node ../cli/bin/veramo.js dev extract-api\"\n  },\n  \"dependencies\": {\n    \"@veramo/core-types\": \"workspace:^\",\n    \"@veramo/message-handler\": \"workspace:^\",\n    \"cross-fetch\": \"^4.0.0\",\n    \"debug\": \"^4.3.3\",\n    \"url-parse\": \"^1.5.4\"\n  },\n  \"devDependencies\": {\n    \"@types/debug\": \"4.1.8\",\n    \"@types/url-parse\": \"1.4.8\",\n    \"jest-fetch-mock\": \"3.0.3\",\n    \"typescript\": \"5.7.3\"\n  },\n  \"files\": [\n    \"build/**/*\",\n    \"src/**/*\",\n    \"README.md\",\n    \"LICENSE\"\n  ],\n  \"publishConfig\": {\n    \"access\": \"public\"\n  },\n  \"repository\": {\n    \"type\": \"git\",\n    \"url\": \"https://github.com/decentralized-identity/veramo.git\",\n    \"directory\": \"packages/url-handler\"\n  },\n  \"author\": \"Consensys Mesh R&D <hello@veramo.io>\",\n  \"contributors\": [\n    \"Simonas Karuzas <simonas.karuzas@mesh.xyz>\",\n    \"Mircea Nistor <mircea.nistor@mesh.xyz>\"\n  ],\n  \"keywords\": [\n    \"Veramo\",\n    \"DID\",\n    \"Verifiable Credential\",\n    \"veramo-plugin\"\n  ],\n  \"license\": \"Apache-2.0\",\n  \"type\": \"module\",\n  \"moduleDirectories\": [\n    \"node_modules\",\n    \"src\"\n  ]\n}\n"
  },
  {
    "path": "packages/url-handler/src/__tests__/message-handler.test.ts",
    "content": "import { Message } from '../../../message-handler/src'\nimport { UrlMessageHandler } from '../message-handler.js'\nimport fetchMock, { MockParams } from 'jest-fetch-mock'\n\nfetchMock.enableMocks()\nimport { jest } from '@jest/globals'\nimport { IAgentContext } from \"../../../core-types/src\";\n\nconst context = {\n  agent: {\n    execute: jest.fn(),\n    availableMethods: jest.fn(),\n    getSchema: jest.fn(),\n    emit: jest.fn(),\n  },\n} as IAgentContext<{}>\n\ndescribe('@veramo/url-handler', () => {\n  const messageHandler = new UrlMessageHandler()\n\n  it('should reject unknown message type', async () => {\n    const message = new Message({ raw: 'test', metaData: [{ type: 'test' }] })\n    await expect(messageHandler.handle(message, context)).rejects.toThrow('Unsupported message type')\n  })\n\n  it('should transform message after standard URL', async () => {\n    const JWT =\n      'eyJ0eXAiOiJKV1QiLCJhbGciOiJFUzI1NkstUiJ9.eyJpYXQiOjE1NzU5Njc1MzEsInR5cGUiOiJzZHIiLCJ0YWciOiJzZXNzaW9uLTEyMyIsImNsYWltcyI6W3sicmVhc29uIjoiV2UgbmVlZCB5b3VyIG5hbWUiLCJjbGFpbVR5cGUiOiJuYW1lIn1dLCJpc3MiOiJkaWQ6ZXRocjoweDViMmIwMzM1Mzk4NDM2MDFmYjgxZGYxNzA0OTE4NzA0ZmQwMTQxZmEifQ.KoHbpJ5HkLLIw8iEqsu2Jql9m5dbydNy2zO53GKuIbwfPOW842_IPXw2zwVtj0FcEuHUkzhx-bhS28Zhmvkv2gE'\n    const message = new Message({\n      raw: 'https://identifier.foundation/ssi/?c_i=' + JWT,\n      metaData: [\n        {\n          type: 'QRCode',\n        },\n      ],\n    })\n    await expect(messageHandler.handle(message, context)).rejects.toThrow('Unsupported message type')\n    expect(message.raw).toEqual(JWT)\n  })\n\n  it('should try to load data from URL if URL is not standard', async () => {\n    const message = new Message({ raw: 'https://example.com/public-profile.jwt' })\n    fetchMock.mockResponse('mockbody')\n    expect.assertions(2)\n\n    await expect(messageHandler.handle(message, context)).rejects.toThrow('Unsupported message type')\n\n    expect(message.raw).toEqual('mockbody')\n  })\n\n  it('should try to load data from redirected URL query', async () => {\n    const message = new Message({ raw: 'https://example.com/public-profile.jwt' })\n    fetchMock.mockResponse('mockbody', {\n      counter: 1,\n      url: 'https://some.other.site.example.com?c_i=asdf',\n    } as MockParams)\n    expect.assertions(2)\n\n    await expect(messageHandler.handle(message, context)).rejects.toThrow('Unsupported message type')\n\n    expect(message.raw).toEqual('asdf')\n  })\n\n  it('should try to load data from redirected URL body', async () => {\n    const message = new Message({ raw: 'https://example.com/public-profile.jwt' })\n    fetchMock.mockResponse('otherbody', {\n      counter: 1,\n      url: 'https://some.other.example.com/cred.jwt',\n    } as MockParams)\n    expect.assertions(2)\n\n    await expect(messageHandler.handle(message, context)).rejects.toThrow('Unsupported message type')\n\n    expect(message.raw).toEqual('otherbody')\n  })\n})\n"
  },
  {
    "path": "packages/url-handler/src/index.ts",
    "content": "/**\n * Provides a {@link @veramo/url-handler#UrlMessageHandler | plugin } for the\n * {@link @veramo/message-handler#MessageHandler} that can extract a raw message from a URL query string or by fetching.\n *\n * @packageDocumentation\n */\nexport { UrlMessageHandler } from './message-handler.js'\n"
  },
  {
    "path": "packages/url-handler/src/message-handler.ts",
    "content": "import { IAgentContext } from '@veramo/core-types'\nimport { Message, AbstractMessageHandler } from '@veramo/message-handler'\nimport parse from 'url-parse'\n\nimport Debug from 'debug'\n\nconst debug = Debug('veramo:url:message-handler')\n\n/**\n * An implementation of {@link @veramo/message-handler#AbstractMessageHandler | AbstractMessageHandler} that can\n * extract a message from a URL.\n *\n * @public\n */\nexport class UrlMessageHandler extends AbstractMessageHandler {\n  async handle(message: Message, context: IAgentContext<{}>): Promise<Message> {\n    if (message.raw) {\n      const parsed = parse(message.raw, {}, true)\n      if (parsed && parsed.query && parsed.query.c_i) {\n        debug('Detected standard URL')\n        message.raw = parsed.query.c_i\n        message.addMetaData({ type: 'URL', value: parsed.origin + parsed.pathname })\n      } else if (parsed?.hostname) {\n        try {\n          const url = message.raw\n          debug('Fetching URL', url)\n          const response = await fetch(url)\n          if (response?.url && response.url !== url) {\n            debug('Detected redirect URL')\n            const parsed2 = parse(response.url, {}, true)\n            if (parsed2 && parsed2.query && parsed2.query.c_i) {\n              message.raw = parsed2.query.c_i\n              message.addMetaData({ type: 'URL', value: parsed2.origin + parsed2.pathname })\n            } else {\n              message.raw = await response.text()\n              message.addMetaData({ type: 'URL', value: url })\n            }\n          } else {\n            message.raw = await response.text()\n            message.addMetaData({ type: 'URL', value: url })\n          }\n        } catch (e: any) {\n          console.log(e)\n          debug(e.message)\n        }\n      }\n    }\n    return super.handle(message, context)\n  }\n}\n"
  },
  {
    "path": "packages/url-handler/tsconfig.json",
    "content": "{\n  \"extends\": \"../tsconfig.settings.json\",\n  \"compilerOptions\": {\n    \"rootDir\": \"src\",\n    \"outDir\": \"build\",\n    \"declarationDir\": \"build\",\n    \"lib\": [\n      \"dom\",\n      \"esnext\"\n    ]\n  },\n  \"references\": [\n    {\"path\": \"../core-types\"},\n    {\"path\": \"../message-handler\"}\n  ]\n}\n"
  },
  {
    "path": "packages/utils/CHANGELOG.md",
    "content": "# Change Log\n\nAll notable changes to this project will be documented in this file.\nSee [Conventional Commits](https://conventionalcommits.org) for commit guidelines.\n\n# [7.0.0](https://github.com/decentralized-identity/veramo/compare/v6.0.2...v7.0.0) (2026-02-11)\n\n\n### Bug Fixes\n\n* **did-comm:** remove isomorphic-webcrypto dependency ([#1401](https://github.com/decentralized-identity/veramo/issues/1401)) ([85cc1ce](https://github.com/decentralized-identity/veramo/commit/85cc1ce1d567afcbc42e0fd89eb2515505044c83)), closes [#1381](https://github.com/decentralized-identity/veramo/issues/1381) [#1387](https://github.com/decentralized-identity/veramo/issues/1387)\n* **utils:** fix inconsistent DID parameter handling ([#1466](https://github.com/decentralized-identity/veramo/issues/1466)) ([0bb103f](https://github.com/decentralized-identity/veramo/commit/0bb103f0c8c16bcbaace68b34bbb33c424b6b2ce))\n\n\n### Features\n\n* **credential-w3c:** refactor the ICredentialProvider API ([#1488](https://github.com/decentralized-identity/veramo/issues/1488)) ([cbd848d](https://github.com/decentralized-identity/veramo/commit/cbd848d4ce2b52497d99d335f1c93bd8b005cdb2))\n* **credential-w3c:** remove hardcoded proof formats ([#1395](https://github.com/decentralized-identity/veramo/issues/1395)) ([5b7d3fa](https://github.com/decentralized-identity/veramo/commit/5b7d3fad7d2ada4954f8020a6474df13d9fe51dc))\n* improve key creation/import options when creating identifiers ([#1423](https://github.com/decentralized-identity/veramo/issues/1423)) ([12aa854](https://github.com/decentralized-identity/veramo/commit/12aa854baa384805f4cae6360720f2e9a5a484aa))\n\n\n### BREAKING CHANGES\n\n* **credential-w3c:** This changeset, along with the previous changes in #1395 modify the CredentialPlugin to support extensibility without modifications to the veramo repository. This plugin now acts as an orchestrator for other ICredentialProvider implementations that provide the actual support for various verifiable data formats. ICredentialProvider implementations can be implemented externally and used with this plugin.\n* **credential-w3c:** The credential plugins specializing in JSON-LD / EIP712 are no longer top level veramo plugins but are now managed by the `@veramo/credential-w3c` plugin which will be able to use multiple proof formats and multiplex accordingly. The constructor for the `CredentialPlugin` has changed to accept different implementations of proof formats.\n\n\n\n\n\n## [6.0.2](https://github.com/decentralized-identity/veramo/compare/v6.0.1...v6.0.2) (2026-01-16)\n\n**Note:** Version bump only for package @veramo/utils\n\n\n\n\n\n## [6.0.1](https://github.com/decentralized-identity/veramo/compare/v6.0.0...v6.0.1) (2026-01-16)\n\n**Note:** Version bump only for package @veramo/utils\n\n\n\n\n\n# [6.0.0](https://github.com/decentralized-identity/veramo/compare/v5.6.0...v6.0.0) (2024-04-02)\n\n\n### Bug Fixes\n\n* **credential-w3c:** forward DID resolution options to the resolver ([#1344](https://github.com/decentralized-identity/veramo/issues/1344)) ([0c22cc6](https://github.com/decentralized-identity/veramo/commit/0c22cc6a79e974214500e4440b0ea2977012377d)), closes [#1343](https://github.com/decentralized-identity/veramo/issues/1343)\n* **deps:** update dependency multiformats to v13 ([c384fb9](https://github.com/decentralized-identity/veramo/commit/c384fb92c628bf700b51f2549532e38aa39e1073))\n* **deps:** Update did-vc-libraries ([ba966d5](https://github.com/decentralized-identity/veramo/commit/ba966d5fe450145f51e9c9b46f8aa53f74b117d2))\n* **utils:** get chainId for any did method ([#1334](https://github.com/decentralized-identity/veramo/issues/1334)) ([d5375bd](https://github.com/decentralized-identity/veramo/commit/d5375bd03e814a2d3fcd96274607f880db77fbe3))\n\n\n### Features\n\n* add Multikey support ([#1316](https://github.com/decentralized-identity/veramo/issues/1316)) ([165de35](https://github.com/decentralized-identity/veramo/commit/165de3549ccfd3d7c84514608ac3ea9e56a7b807))\n* **utils:** export createJWK ([#1325](https://github.com/decentralized-identity/veramo/issues/1325)) ([610ee66](https://github.com/decentralized-identity/veramo/commit/610ee6603a3ee6c4d37a36eb0f700e803beca786)), closes [#1324](https://github.com/decentralized-identity/veramo/issues/1324)\n\n\n### BREAKING CHANGES\n\n* **utils:** The `getChainIdForDidEthr` method has been renamed to `getChainId`\n\n\n\n\n\n# [5.6.0](https://github.com/decentralized-identity/veramo/compare/v5.5.3...v5.6.0) (2024-01-16)\n\n\n### Features\n\n* **remote-client:** allow dynamic headers param for AgentRestClient constructor ([#1314](https://github.com/decentralized-identity/veramo/issues/1314)) ([1b8a0a2](https://github.com/decentralized-identity/veramo/commit/1b8a0a2718dd63492ad3a312a6ebe5f6e7849935)), closes [#1313](https://github.com/decentralized-identity/veramo/issues/1313)\n\n\n\n\n\n## [5.5.3](https://github.com/decentralized-identity/veramo/compare/v5.5.2...v5.5.3) (2023-10-09)\n\n\n### Bug Fixes\n\n* use DIF URLs in packages ([#1271](https://github.com/decentralized-identity/veramo/issues/1271)) ([3dfc601](https://github.com/decentralized-identity/veramo/commit/3dfc6014cdee7902c59d8db76b4c8507b870f227))\n\n\n\n\n\n# [5.5.0](https://github.com/uport-project/veramo/compare/v5.4.1...v5.5.0) (2023-09-19)\n\n\n### Bug Fixes\n\n* **deps:** update dependency cross-fetch to v4 ([1c14d34](https://github.com/uport-project/veramo/commit/1c14d34f48a51bef373541e84ed89f2f44711406))\n* **did-provider-key:** use compressed keys for creating Secp256k1 did:key ([#1217](https://github.com/uport-project/veramo/issues/1217)) ([ba8f6f5](https://github.com/uport-project/veramo/commit/ba8f6f5b9b701e57af86491504ecd209ca0c1c1d)), closes [#1213](https://github.com/uport-project/veramo/issues/1213)\n\n\n### Features\n\n* **core-types:** export a basic mapping between key types and algorithms ([57b6c58](https://github.com/uport-project/veramo/commit/57b6c583138b0f8f283f4f00b27573529f394a7a))\n\n\n\n\n\n## [5.4.1](https://github.com/uport-project/veramo/compare/v5.4.0...v5.4.1) (2023-08-04)\n\n\n### Bug Fixes\n\n* **ci:** benign change meant to tag all packages for another patch release ([#1211](https://github.com/uport-project/veramo/issues/1211)) ([41b5c90](https://github.com/uport-project/veramo/commit/41b5c90277171b7b38c5cf49ca01db5cf75b6300))\n\n\n\n\n\n# [5.4.0](https://github.com/uport-project/veramo/compare/v5.3.0...v5.4.0) (2023-08-01)\n\n\n### Features\n\n* **credential-w3c:** allow issuers with query parameters for credentials and presentations ([#1207](https://github.com/uport-project/veramo/issues/1207)) ([688f59d](https://github.com/uport-project/veramo/commit/688f59d6b492bc25bc51bbe73be969d6c30a958d)), closes [#1201](https://github.com/uport-project/veramo/issues/1201)\n* **did-comm:** add support for the AES based content and key encryption algorithms ([#1180](https://github.com/uport-project/veramo/issues/1180)) ([5294a81](https://github.com/uport-project/veramo/commit/5294a812ee578c0712b54f216416c3ef78c848da))\n\n\n\n\n\n# [5.3.0](https://github.com/uport-project/veramo/compare/v5.2.0...v5.3.0) (2023-07-27)\n\n\n### Bug Fixes\n\n* **deps:** update dependency multiformats to v12 ([11fa7c3](https://github.com/uport-project/veramo/commit/11fa7c340da78101ea5e974e8ae0f90193933976))\n* support publicKeyJwk when comparing blockchainAccountId ([#1194](https://github.com/uport-project/veramo/issues/1194)) ([9110688](https://github.com/uport-project/veramo/commit/9110688cc02707d0c5ac06fe52916b7910b2d99c))\n\n\n\n\n\n# [5.2.0](https://github.com/uport-project/veramo/compare/v5.1.4...v5.2.0) (2023-05-02)\n\n\n### Bug Fixes\n\n* **credential-ld:** fix Ed25519Signature2020 verification ([#1166](https://github.com/uport-project/veramo/issues/1166)) ([c965fd5](https://github.com/uport-project/veramo/commit/c965fd502f652c9929ae4753c56ebbe351447733))\n\n\n### Features\n\n* add did-peer provider and resolver ([#1156](https://github.com/uport-project/veramo/issues/1156)) ([9502063](https://github.com/uport-project/veramo/commit/95020632f741bd4640b3496b7b1bf19f5e6641d0))\n\n\n\n\n\n## [5.1.2](https://github.com/uport-project/veramo/compare/v5.1.1...v5.1.2) (2023-02-25)\n\n**Note:** Version bump only for package @veramo/utils\n\n\n\n\n\n# [5.1.0](https://github.com/uport-project/veramo/compare/v5.0.0...v5.1.0) (2023-02-24)\n\n\n### Features\n\n* **core-types:** allow inline [@context](https://github.com/context) for Credentials and Presentations ([#1119](https://github.com/uport-project/veramo/issues/1119)) ([44bb365](https://github.com/uport-project/veramo/commit/44bb36503b635ee1f5431cb4bf28c7a9ba111156)), closes [#1073](https://github.com/uport-project/veramo/issues/1073)\n\n\n\n\n\n# [5.0.0](https://github.com/uport-project/veramo/compare/v4.3.0...v5.0.0) (2023-02-09)\n\n\n### Build System\n\n* convert veramo modules to ESM instead of CommonJS ([#1103](https://github.com/uport-project/veramo/issues/1103)) ([b5cea3c](https://github.com/uport-project/veramo/commit/b5cea3c0d80d900a47bd1d9eea68f84b70a35e7b)), closes [#1099](https://github.com/uport-project/veramo/issues/1099)\n\n\n### Features\n\n* isolate `core-types` package from `core` ([#1116](https://github.com/uport-project/veramo/issues/1116)) ([ba7a303](https://github.com/uport-project/veramo/commit/ba7a303de91cf4cc568a3af1ddf8ca98ed022e9f))\n\n\n### BREAKING CHANGES\n\n* this is a breaking change as modules will have to be imported differently: \n* https://www.typescriptlang.org/docs/handbook/esm-node.html\n* https://nodejs.org/api/esm.html\n* https://caniuse.com/?search=modules\n\ntest(did-provider-ion): skip a couple of tests that fail with unreasonable errors\nchore: use ubuntu-latest on CI\nfix: temporarily remove puppeteer tests\nfix: use craco for test-react-app to enable babel config\ntest: fix unit and integration tests (browser tests still broken)\nfix: fix some build issues that prevented tests from working\nfix: missing deps flagged by pnpm\n\n\n\n\n\n# [4.3.0](https://github.com/uport-project/veramo/compare/v4.2.0...v4.3.0) (2023-01-27)\n\n\n### Bug Fixes\n\n* **utils:** convert JWK with curv `Ed25519` to `X25519` ([#1078](https://github.com/uport-project/veramo/issues/1078)) ([deb546b](https://github.com/uport-project/veramo/commit/deb546ba94fa1dc51662adddbe303d63a0e7ce12))\n\n\n### Features\n\n* **utils:** add publicKeyJwk as valid verificationMethod in getEthereumAddress ([#1096](https://github.com/uport-project/veramo/issues/1096)) ([a4209f5](https://github.com/uport-project/veramo/commit/a4209f5ffc95d9fde6bbdb9df6d16e8d961341f6))\n\n\n\n\n\n# [4.2.0](https://github.com/uport-project/veramo/compare/v4.1.2...v4.2.0) (2022-12-05)\n\n\n### Bug Fixes\n\n* **utils:** correctly extract publicKeyHex from [Ed/X]25519 2020 keys ([#1076](https://github.com/uport-project/veramo/issues/1076)) ([c73002c](https://github.com/uport-project/veramo/commit/c73002c97d8c688e343aba65efd4c8e857a96522)), closes [#1067](https://github.com/uport-project/veramo/issues/1067)\n\n\n### Features\n\n* **credential-ld:** add `Ed25519Signature2020` & `JsonWebSignature2020` experimental support ([#1030](https://github.com/uport-project/veramo/issues/1030)) ([fbf7d48](https://github.com/uport-project/veramo/commit/fbf7d483c3549ec45df84472824395903128d66e)), closes [#1003](https://github.com/uport-project/veramo/issues/1003)\n\n\n\n\n\n## [4.1.1](https://github.com/uport-project/veramo/compare/v4.1.0...v4.1.1) (2022-11-01)\n\n**Note:** Version bump only for package @veramo/utils\n\n\n\n\n\n# [4.1.0](https://github.com/uport-project/veramo/compare/v4.0.2...v4.1.0) (2022-10-31)\n\n\n### Bug Fixes\n\n* **deps:** Update dependency ethr-did-resolver to v7 ([#1038](https://github.com/uport-project/veramo/issues/1038)) ([d421c0f](https://github.com/uport-project/veramo/commit/d421c0f9f5934829df2930e58e98bcfce813ce84))\n* remove deprecated testnets ([#1028](https://github.com/uport-project/veramo/issues/1028)) ([2823738](https://github.com/uport-project/veramo/commit/28237383d0cc2eb20bcf8e10562221ea2ab32f94)), closes [#1025](https://github.com/uport-project/veramo/issues/1025)\n\n\n\n\n\n## [4.0.2](https://github.com/uport-project/veramo/compare/v4.0.1...v4.0.2) (2022-10-04)\n\n\n### Bug Fixes\n\n* **credential-eip712:** add support for all did methods that use secp256k ([#1011](https://github.com/uport-project/veramo/issues/1011)) ([9940068](https://github.com/uport-project/veramo/commit/99400689dec9ea00131cf914d1999357b716612c)), closes [#991](https://github.com/uport-project/veramo/issues/991)\n* **deps:** update dependency uuid to v9 ([4ff90a5](https://github.com/uport-project/veramo/commit/4ff90a58f5993880635f2b39c73edadaf3149066))\n\n\n\n\n\n# [4.0.0](https://github.com/uport-project/veramo/compare/v3.1.5...v4.0.0) (2022-09-22)\n\n\n### Bug Fixes\n\n* **credential-ld:** include credential context and fix context loader Map ([ef7797d](https://github.com/uport-project/veramo/commit/ef7797d4c5f20b22e4e39a5ad60a851fa1c4f2ed))\n* **credential-status:** check credential status for all credential types ([#949](https://github.com/uport-project/veramo/issues/949)) ([877c513](https://github.com/uport-project/veramo/commit/877c513a5bc253ed30c74ace00ce988197d12a2d)), closes [#934](https://github.com/uport-project/veramo/issues/934)\n* **deps:** Bump `did-jwt`, `did-jwt-vc` as direct package deps ([#955](https://github.com/uport-project/veramo/issues/955)) ([e57edb3](https://github.com/uport-project/veramo/commit/e57edb34cfbaee6bba1d944497d688104f32c698))\n* **deps:** Update dependency did-jwt-vc to v3 ([014c1ab](https://github.com/uport-project/veramo/commit/014c1ab974647d44d7ef1de0f931625348c4c98b))\n* **deps:** update did-libraries ([219cde2](https://github.com/uport-project/veramo/commit/219cde250e8d4f06d7978afcc38a04471342fd21))\n* **deps:** use did-jwt v6 and ethr-did-resolver v6 ([#925](https://github.com/uport-project/veramo/issues/925)) ([0c77d03](https://github.com/uport-project/veramo/commit/0c77d03ec5ec9e2091de3f74f67ab86a22cde197)), closes [#923](https://github.com/uport-project/veramo/issues/923) [#848](https://github.com/uport-project/veramo/issues/848)\n* **did-resolver:** use interface `Resolvable` instead of the `Resolver` class ([9c2e59f](https://github.com/uport-project/veramo/commit/9c2e59f3f23f808511c6c0e8e440b4d53ba5cb00))\n* **docs:** fix relevant errors and warnings in TSDoc to enable proper docs generation on `[@next](https://github.com/next)` branch ([79c3872](https://github.com/uport-project/veramo/commit/79c387230219c92c1951d19b8ddf716308a46c5b))\n* **kms-web3:** use ethers _signTypedData ([#939](https://github.com/uport-project/veramo/issues/939)) ([f198997](https://github.com/uport-project/veramo/commit/f198997d08f65b758bd9471bd4cf170ac8620e82)), closes [#938](https://github.com/uport-project/veramo/issues/938)\n* update and fix inline documentation of all exported types ([#921](https://github.com/uport-project/veramo/issues/921)) ([63e64e0](https://github.com/uport-project/veramo/commit/63e64e0e2693808c4704dca8cc511dc0bab3f3b1))\n\n\n### Features\n\n* add support for serviceEndpoint property as defined in latest DID Spec ([#988](https://github.com/uport-project/veramo/issues/988)) ([9bed70b](https://github.com/uport-project/veramo/commit/9bed70ba658aed34a97944e0dee27bca6c81d700))\n* **credential-ld:** add support for browser environments ([#916](https://github.com/uport-project/veramo/issues/916)) ([435e4d2](https://github.com/uport-project/veramo/commit/435e4d260b1774f96b182c1a75ab2f1c993f2291))\n* **credential-w3c:** align verification API between formats ([#996](https://github.com/uport-project/veramo/issues/996)) ([b987fc0](https://github.com/uport-project/veramo/commit/b987fc0903a31d3bbffb43fef872be4d6c62c2ad)), closes [#935](https://github.com/uport-project/veramo/issues/935) [#954](https://github.com/uport-project/veramo/issues/954) [#375](https://github.com/uport-project/veramo/issues/375) [#989](https://github.com/uport-project/veramo/issues/989)\n* **kms-web3:** add a KMS implementation backed by a web3 provider ([#924](https://github.com/uport-project/veramo/issues/924)) ([14f71af](https://github.com/uport-project/veramo/commit/14f71afbb72dca8274790d3b20b518ddfe4f2585)), closes [#688](https://github.com/uport-project/veramo/issues/688)\n* **utils:** add 2 utility functions for inspecting ethr dids ([#842](https://github.com/uport-project/veramo/issues/842)) ([473e7fa](https://github.com/uport-project/veramo/commit/473e7fa08e33b3fb643bcc11cd1e3f6094099d7d))\n\n\n### BREAKING CHANGES\n\n* the `did-resolver` and connected libraries change the data-type for `ServiceEndpoint` to `Service` and the previous semantic has changed. Services can have multiple endpoints, not just a single string.\n"
  },
  {
    "path": "packages/utils/LICENSE",
    "content": "                                 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 2021 Consensys AG\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"
  },
  {
    "path": "packages/utils/README.md",
    "content": "# Veramo utils\n\nA package with helper methods.\n"
  },
  {
    "path": "packages/utils/api-extractor.json",
    "content": "{\n  \"$schema\": \"https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json\",\n  \"apiReport\": {\n    \"enabled\": true,\n    \"reportFolder\": \"./api\",\n    \"reportTempFolder\": \"./api\"\n  },\n\n  \"docModel\": {\n    \"enabled\": true,\n    \"apiJsonFilePath\": \"./api/<unscopedPackageName>.api.json\"\n  },\n\n  \"dtsRollup\": {\n    \"enabled\": false\n  },\n  \"mainEntryPointFilePath\": \"<projectFolder>/build/index.d.ts\"\n}\n"
  },
  {
    "path": "packages/utils/package.json",
    "content": "{\n  \"name\": \"@veramo/utils\",\n  \"description\": \"Helper methods for Veramo plugins\",\n  \"version\": \"7.0.0\",\n  \"main\": \"build/index.js\",\n  \"exports\": \"./build/index.js\",\n  \"types\": \"build/index.d.ts\",\n  \"scripts\": {\n    \"build\": \"tsc\",\n    \"extract-api\": \"node ../cli/bin/veramo.js dev extract-api\"\n  },\n  \"dependencies\": {\n    \"@ipld/dag-pb\": \"^4.0.5\",\n    \"@noble/curves\": \"^1.4.2\",\n    \"@veramo/core-types\": \"workspace:^\",\n    \"credential-status\": \"^3.0.0\",\n    \"cross-fetch\": \"^4.0.0\",\n    \"debug\": \"^4.3.3\",\n    \"did-jwt\": \"^8.0.0\",\n    \"did-jwt-vc\": \"^4.0.0\",\n    \"did-resolver\": \"^4.1.0\",\n    \"ethers\": \"^6.13.4\",\n    \"ipfs-unixfs\": \"^11.1.0\",\n    \"multiformats\": \"^13.0.0\",\n    \"uint8arrays\": \"^4.0.6\"\n  },\n  \"devDependencies\": {\n    \"@types/debug\": \"4.1.8\",\n    \"@types/uuid\": \"9.0.2\"\n  },\n  \"files\": [\n    \"build/**/*\",\n    \"src/**/*\",\n    \"README.md\",\n    \"LICENSE\"\n  ],\n  \"publishConfig\": {\n    \"access\": \"public\"\n  },\n  \"repository\": {\n    \"type\": \"git\",\n    \"url\": \"https://github.com/decentralized-identity/veramo.git\",\n    \"directory\": \"packages/utils\"\n  },\n  \"author\": \"Consensys Mesh R&D <hello@veramo.io>\",\n  \"contributors\": [\n    \"Mircea Nistor <mircea.nistor@mesh.xyz>\",\n    \"Simonas Karuzas <simonas.karuzas@mesh.xyz>\"\n  ],\n  \"keywords\": [\n    \"Veramo\",\n    \"DID\",\n    \"Verifiable Credential\",\n    \"veramo-plugin\",\n    \"utils\",\n    \"encoding\",\n    \"crypto\"\n  ],\n  \"license\": \"Apache-2.0\",\n  \"type\": \"module\",\n  \"moduleDirectories\": [\n    \"node_modules\",\n    \"src\"\n  ]\n}\n"
  },
  {
    "path": "packages/utils/src/__tests__/credential-utils.test.ts",
    "content": "import {\n  computeEntryHash,\n  decodeCredentialToObject,\n  decodePresentationToObject,\n  extractIssuer,\n  processEntryToArray,\n  removeDIDParameters,\n} from '../credential-utils.js'\n\ndescribe('@veramo/utils credential utils', () => {\n  it('processEntryToArray', () => {\n    expect(processEntryToArray('a')).toEqual(['a'])\n    expect(processEntryToArray(['a'])).toEqual(['a'])\n    expect(processEntryToArray(['a', 'b'])).toEqual(['a', 'b'])\n    expect(processEntryToArray(['a', 'b'])).toEqual(['a', 'b'])\n    expect(processEntryToArray(undefined)).toEqual([])\n    expect(processEntryToArray(null)).toEqual([])\n    expect(processEntryToArray(undefined, 'start')).toEqual(['start'])\n    expect(processEntryToArray(null, 'start')).toEqual(['start'])\n    expect(processEntryToArray(['a', 'start'], 'start')).toEqual(['start', 'a'])\n    expect(processEntryToArray(['a', 'start', null, undefined, 'b', 'a'] as any, 'start')).toEqual([\n      'start',\n      'a',\n      'b',\n    ])\n  })\n\n  it('decodeCredentialToObject', () => {\n    const jwt =\n      'eyJ0eXAiOiJKV1QiLCJhbGciOiJFUzI1NkstUiJ9.eyJpYXQiOjE1ODI2MTk2NzYsInN1YiI6ImRpZDpldGhyOnJpbmtlYnk6MHgzYzM1N2JhNDU4OTMzYTE5YzFkZjFjN2Y2YjQ3M2IzMzAyYmJiZTYxIiwidmMiOnsiQGNvbnRleHQiOlsiaHR0cHM6Ly93d3cudzMub3JnLzIwMTgvY3JlZGVudGlhbHMvdjEiXSwidHlwZSI6WyJWZXJpZmlhYmxlQ3JlZGVudGlhbCJdLCJjcmVkZW50aWFsU3ViamVjdCI6eyJuYW1lIjoiQWxpY2UifX0sImlzcyI6ImRpZDpldGhyOnJpbmtlYnk6MHgzYzM1N2JhNDU4OTMzYTE5YzFkZjFjN2Y2YjQ3M2IzMzAyYmJiZTYxIn0.IGF1LFOc4_PcGVeq7Yw7OGz4Gj7xXZK6p8bP9CSEIXz7mNFPM0v0nuevTZ47a0I8XgLfCFNkUrIIscjH8MFx_wE'\n    const normalizedCred = {\n      credentialSubject: {\n        name: 'Alice',\n        id: 'did:ethr:rinkeby:0x3c357ba458933a19c1df1c7f6b473b3302bbbe61',\n      },\n      issuer: { id: 'did:ethr:rinkeby:0x3c357ba458933a19c1df1c7f6b473b3302bbbe61' },\n      type: ['VerifiableCredential'],\n      '@context': ['https://www.w3.org/2018/credentials/v1'],\n      issuanceDate: '2020-02-25T08:34:36.000Z',\n      proof: {\n        type: 'JwtProof2020',\n        jwt,\n      },\n    }\n    const ldCred = {\n      issuer: { id: 'did:key:z6MkvGFkoFarw7pXRBkKqZKwDcc2L3U4AZC1RtBiceicUHqn' },\n      '@context': ['https://www.w3.org/2018/credentials/v1', 'https://veramo.io/contexts/profile/v1'],\n      type: ['VerifiableCredential', 'Profile'],\n      issuanceDate: '2021-11-23T15:06:12.820Z',\n      credentialSubject: {\n        id: 'did:key:z6MkvGFkoFarw7pXRBkKqZKwDcc2L3U4AZC1RtBiceicUHqn',\n        name: 'Martin, the great',\n      },\n      proof: {\n        type: 'Ed25519Signature2018',\n        created: '2021-11-23T15:06:12Z',\n        verificationMethod:\n          'did:key:z6MkvGFkoFarw7pXRBkKqZKwDcc2L3U4AZC1RtBiceicUHqn#z6MkvGFkoFarw7pXRBkKqZKwDcc2L3U4AZC1RtBiceicUHqn',\n        proofPurpose: 'assertionMethod',\n        jws: 'eyJhbGciOiJFZERTQSIsImI2NCI6ZmFsc2UsImNyaXQiOlsiYjY0Il19..wKMmMZNdIgL_19HYJgpRL9SeKVzYT85S-ZyVdF3IMiaiL8nhX8i48D82TQtuQlTT960h_TOQ18fQFula6QxADA',\n      },\n    }\n    expect(decodeCredentialToObject(jwt)).toEqual(normalizedCred)\n    expect(decodeCredentialToObject(normalizedCred)).toEqual(normalizedCred)\n    expect(decodeCredentialToObject(ldCred)).toEqual(ldCred)\n  })\n\n  it('decodePresentationToObject', () => {\n    const cred1 = {\n      issuer: { id: 'did:ethr:0x0301240a4851f45b568809baf35921f8d78ca966738a1a0a69e693fbbd232ff080' },\n      '@context': [\n        'https://www.w3.org/2018/credentials/v1',\n        'https://veramo.io/contexts/profile/v1',\n        'https://w3id.org/security/suites/secp256k1recovery-2020/v2',\n      ],\n      type: ['VerifiableCredential', 'Profile'],\n      issuanceDate: '2021-11-23T15:09:43.891Z',\n      credentialSubject: { name: 'Martin, the great' },\n      proof: {\n        type: 'EcdsaSecp256k1RecoverySignature2020',\n        created: '2021-11-23T15:09:44Z',\n        verificationMethod:\n          'did:ethr:0x0301240a4851f45b568809baf35921f8d78ca966738a1a0a69e693fbbd232ff080#controller',\n        proofPurpose: 'assertionMethod',\n        jws: 'eyJhbGciOiJFUzI1NkstUiIsImI2NCI6ZmFsc2UsImNyaXQiOlsiYjY0Il19..peNXS6DaNsCNfz8rnr_BJ49sF4yUugKqNZrcOfdX0qlPSw4iFM9Iw1e6bhmav7N2OCfauI6uCFQEpKfTc5Jm-wA',\n      },\n    }\n    const cred2 =\n      'eyJhbGciOiJFUzI1NksiLCJ0eXAiOiJKV1QifQ.eyJ2YyI6eyJAY29udGV4dCI6WyJodHRwczovL3d3dy53My5vcmcvMjAxOC9jcmVkZW50aWFscy92MSJdLCJ0eXBlIjpbIlZlcmlmaWFibGVDcmVkZW50aWFsIl0sImNyZWRlbnRpYWxTdWJqZWN0Ijp7InlvdSI6IlJvY2sifX0sInN1YiI6ImRpZDp3ZWI6ZXhhbXBsZS5jb20iLCJuYmYiOjE2Mzc2ODAzMTcsImlzcyI6ImRpZDpldGhyOnJpbmtlYnk6MHgwMmY2NDk1NWRkMDVkZGU1NTkxMGYzNzllYzU3ODVlZWUwOGJiZTZlNTBkZGFlNmJhY2UwNTk2ZmQ4ZDQ2MDE4ZjcifQ.ujM4zNm8h5-Cg01vh4ka_7NmdwYl8HAjO90XjxYYwSa0-4rqzM5ndt-OE6vS6y0gPwhwlQWHmDxg4X7OTzCUoQ'\n    const cred2Expanded = {\n      credentialSubject: { you: 'Rock', id: 'did:web:example.com' },\n      issuer: { id: 'did:ethr:rinkeby:0x02f64955dd05dde55910f379ec5785eee08bbe6e50ddae6bace0596fd8d46018f7' },\n      type: ['VerifiableCredential'],\n      '@context': ['https://www.w3.org/2018/credentials/v1'],\n      issuanceDate: '2021-11-23T15:11:57.000Z',\n      proof: {\n        type: 'JwtProof2020',\n        jwt: 'eyJhbGciOiJFUzI1NksiLCJ0eXAiOiJKV1QifQ.eyJ2YyI6eyJAY29udGV4dCI6WyJodHRwczovL3d3dy53My5vcmcvMjAxOC9jcmVkZW50aWFscy92MSJdLCJ0eXBlIjpbIlZlcmlmaWFibGVDcmVkZW50aWFsIl0sImNyZWRlbnRpYWxTdWJqZWN0Ijp7InlvdSI6IlJvY2sifX0sInN1YiI6ImRpZDp3ZWI6ZXhhbXBsZS5jb20iLCJuYmYiOjE2Mzc2ODAzMTcsImlzcyI6ImRpZDpldGhyOnJpbmtlYnk6MHgwMmY2NDk1NWRkMDVkZGU1NTkxMGYzNzllYzU3ODVlZWUwOGJiZTZlNTBkZGFlNmJhY2UwNTk2ZmQ4ZDQ2MDE4ZjcifQ.ujM4zNm8h5-Cg01vh4ka_7NmdwYl8HAjO90XjxYYwSa0-4rqzM5ndt-OE6vS6y0gPwhwlQWHmDxg4X7OTzCUoQ',\n      },\n    }\n\n    const presentation1 = {\n      holder: 'did:ethr:0x0301240a4851f45b568809baf35921f8d78ca966738a1a0a69e693fbbd232ff080',\n      '@context': ['https://www.w3.org/2018/credentials/v1'],\n      type: ['VerifiablePresentation'],\n      verifiableCredential: [cred1, cred2],\n      proof: {\n        type: 'EcdsaSecp256k1RecoverySignature2020',\n        created: '2021-11-23T15:09:55Z',\n        verificationMethod:\n          'did:ethr:0x0301240a4851f45b568809baf35921f8d78ca966738a1a0a69e693fbbd232ff080#controller',\n        proofPurpose: 'assertionMethod',\n        jws: 'eyJhbGciOiJFUzI1NkstUiIsImI2NCI6ZmFsc2UsImNyaXQiOlsiYjY0Il19..t34HTHSqdK0YLx_BW8VTKR6ON7QXdJbyhlPZmKH2HiOnmk0W05SuslwSPOU9NjjbtGU-IMvUU2pJVyzN6Pm2dQE',\n      },\n    }\n\n    const presentation1Expanded = {\n      holder: 'did:ethr:0x0301240a4851f45b568809baf35921f8d78ca966738a1a0a69e693fbbd232ff080',\n      '@context': ['https://www.w3.org/2018/credentials/v1'],\n      type: ['VerifiablePresentation'],\n      verifiableCredential: [cred1, cred2Expanded],\n      proof: {\n        type: 'EcdsaSecp256k1RecoverySignature2020',\n        created: '2021-11-23T15:09:55Z',\n        verificationMethod:\n          'did:ethr:0x0301240a4851f45b568809baf35921f8d78ca966738a1a0a69e693fbbd232ff080#controller',\n        proofPurpose: 'assertionMethod',\n        jws: 'eyJhbGciOiJFUzI1NkstUiIsImI2NCI6ZmFsc2UsImNyaXQiOlsiYjY0Il19..t34HTHSqdK0YLx_BW8VTKR6ON7QXdJbyhlPZmKH2HiOnmk0W05SuslwSPOU9NjjbtGU-IMvUU2pJVyzN6Pm2dQE',\n      },\n    }\n\n    const presentation2 =\n      'eyJhbGciOiJFUzI1NksiLCJ0eXAiOiJKV1QifQ.eyJ2cCI6eyJAY29udGV4dCI6WyJodHRwczovL3d3dy53My5vcmcvMjAxOC9jcmVkZW50aWFscy92MSIsImh0dHBzOi8vZXhhbXBsZS5jb20vMS8yLzMiXSwidHlwZSI6WyJWZXJpZmlhYmxlUHJlc2VudGF0aW9uIiwiQ3VzdG9tIl0sInZlcmlmaWFibGVDcmVkZW50aWFsIjpbImV5SmhiR2NpT2lKRlV6STFOa3NpTENKMGVYQWlPaUpLVjFRaWZRLmV5SjJZeUk2ZXlKQVkyOXVkR1Y0ZENJNld5Sm9kSFJ3Y3pvdkwzZDNkeTUzTXk1dmNtY3ZNakF4T0M5amNtVmtaVzUwYVdGc2N5OTJNU0pkTENKMGVYQmxJanBiSWxabGNtbG1hV0ZpYkdWRGNtVmtaVzUwYVdGc0lsMHNJbU55WldSbGJuUnBZV3hUZFdKcVpXTjBJanA3SW5sdmRTSTZJbEp2WTJzaWZYMHNJbk4xWWlJNkltUnBaRHAzWldJNlpYaGhiWEJzWlM1amIyMGlMQ0p1WW1ZaU9qRTJNemMyT0RBek1UY3NJbWx6Y3lJNkltUnBaRHBsZEdoeU9uSnBibXRsWW5rNk1IZ3dNbVkyTkRrMU5XUmtNRFZrWkdVMU5Ua3hNR1l6TnpsbFl6VTNPRFZsWldVd09HSmlaVFpsTlRCa1pHRmxObUpoWTJVd05UazJabVE0WkRRMk1ERTRaamNpZlEudWpNNHpObThoNS1DZzAxdmg0a2FfN05tZHdZbDhIQWpPOTBYanhZWXdTYTAtNHJxek01bmR0LU9FNnZTNnkwZ1B3aHdsUVdIbUR4ZzRYN09UekNVb1EiXX0sIm5iZiI6MTYzNzY4MDMxNywiaXNzIjoiZGlkOmV0aHI6cmlua2VieToweDAyZjY0OTU1ZGQwNWRkZTU1OTEwZjM3OWVjNTc4NWVlZTA4YmJlNmU1MGRkYWU2YmFjZTA1OTZmZDhkNDYwMThmNyIsImF1ZCI6W119.hlVtPgzHZhLXQSIU3_RTpabN30t-QJL2-KqELI6G0Dkk8_gTyQbJVIZX3OsaJUV4K99-MPL_oyMXzBXWba_iBQ'\n\n    const presentation2Expanded = {\n      verifiableCredential: [\n        {\n          credentialSubject: { you: 'Rock', id: 'did:web:example.com' },\n          issuer: {\n            id: 'did:ethr:rinkeby:0x02f64955dd05dde55910f379ec5785eee08bbe6e50ddae6bace0596fd8d46018f7',\n          },\n          type: ['VerifiableCredential'],\n          '@context': ['https://www.w3.org/2018/credentials/v1'],\n          issuanceDate: '2021-11-23T15:11:57.000Z',\n          proof: {\n            type: 'JwtProof2020',\n            jwt: 'eyJhbGciOiJFUzI1NksiLCJ0eXAiOiJKV1QifQ.eyJ2YyI6eyJAY29udGV4dCI6WyJodHRwczovL3d3dy53My5vcmcvMjAxOC9jcmVkZW50aWFscy92MSJdLCJ0eXBlIjpbIlZlcmlmaWFibGVDcmVkZW50aWFsIl0sImNyZWRlbnRpYWxTdWJqZWN0Ijp7InlvdSI6IlJvY2sifX0sInN1YiI6ImRpZDp3ZWI6ZXhhbXBsZS5jb20iLCJuYmYiOjE2Mzc2ODAzMTcsImlzcyI6ImRpZDpldGhyOnJpbmtlYnk6MHgwMmY2NDk1NWRkMDVkZGU1NTkxMGYzNzllYzU3ODVlZWUwOGJiZTZlNTBkZGFlNmJhY2UwNTk2ZmQ4ZDQ2MDE4ZjcifQ.ujM4zNm8h5-Cg01vh4ka_7NmdwYl8HAjO90XjxYYwSa0-4rqzM5ndt-OE6vS6y0gPwhwlQWHmDxg4X7OTzCUoQ',\n          },\n        },\n      ],\n      holder: 'did:ethr:rinkeby:0x02f64955dd05dde55910f379ec5785eee08bbe6e50ddae6bace0596fd8d46018f7',\n      verifier: [],\n      type: ['VerifiablePresentation', 'Custom'],\n      '@context': ['https://www.w3.org/2018/credentials/v1', 'https://example.com/1/2/3'],\n      issuanceDate: '2021-11-23T15:11:57.000Z',\n      proof: {\n        type: 'JwtProof2020',\n        jwt: 'eyJhbGciOiJFUzI1NksiLCJ0eXAiOiJKV1QifQ.eyJ2cCI6eyJAY29udGV4dCI6WyJodHRwczovL3d3dy53My5vcmcvMjAxOC9jcmVkZW50aWFscy92MSIsImh0dHBzOi8vZXhhbXBsZS5jb20vMS8yLzMiXSwidHlwZSI6WyJWZXJpZmlhYmxlUHJlc2VudGF0aW9uIiwiQ3VzdG9tIl0sInZlcmlmaWFibGVDcmVkZW50aWFsIjpbImV5SmhiR2NpT2lKRlV6STFOa3NpTENKMGVYQWlPaUpLVjFRaWZRLmV5SjJZeUk2ZXlKQVkyOXVkR1Y0ZENJNld5Sm9kSFJ3Y3pvdkwzZDNkeTUzTXk1dmNtY3ZNakF4T0M5amNtVmtaVzUwYVdGc2N5OTJNU0pkTENKMGVYQmxJanBiSWxabGNtbG1hV0ZpYkdWRGNtVmtaVzUwYVdGc0lsMHNJbU55WldSbGJuUnBZV3hUZFdKcVpXTjBJanA3SW5sdmRTSTZJbEp2WTJzaWZYMHNJbk4xWWlJNkltUnBaRHAzWldJNlpYaGhiWEJzWlM1amIyMGlMQ0p1WW1ZaU9qRTJNemMyT0RBek1UY3NJbWx6Y3lJNkltUnBaRHBsZEdoeU9uSnBibXRsWW5rNk1IZ3dNbVkyTkRrMU5XUmtNRFZrWkdVMU5Ua3hNR1l6TnpsbFl6VTNPRFZsWldVd09HSmlaVFpsTlRCa1pHRmxObUpoWTJVd05UazJabVE0WkRRMk1ERTRaamNpZlEudWpNNHpObThoNS1DZzAxdmg0a2FfN05tZHdZbDhIQWpPOTBYanhZWXdTYTAtNHJxek01bmR0LU9FNnZTNnkwZ1B3aHdsUVdIbUR4ZzRYN09UekNVb1EiXX0sIm5iZiI6MTYzNzY4MDMxNywiaXNzIjoiZGlkOmV0aHI6cmlua2VieToweDAyZjY0OTU1ZGQwNWRkZTU1OTEwZjM3OWVjNTc4NWVlZTA4YmJlNmU1MGRkYWU2YmFjZTA1OTZmZDhkNDYwMThmNyIsImF1ZCI6W119.hlVtPgzHZhLXQSIU3_RTpabN30t-QJL2-KqELI6G0Dkk8_gTyQbJVIZX3OsaJUV4K99-MPL_oyMXzBXWba_iBQ',\n      },\n    }\n    expect(decodePresentationToObject(presentation1)).toEqual(presentation1Expanded)\n    expect(decodePresentationToObject(presentation1Expanded)).toEqual(presentation1Expanded)\n    expect(decodePresentationToObject(presentation2)).toEqual(presentation2Expanded)\n    expect(decodePresentationToObject(presentation2Expanded)).toEqual(presentation2Expanded)\n  })\n\n  it('computeEntryHash for JWT', () => {\n    const jwt =\n      'eyJhbGciOiJFUzI1NksiLCJ0eXAiOiJKV1QifQ.eyJ2YyI6eyJAY29udGV4dCI6WyJodHRwczovL3d3dy53My5vcmcvMjAxOC9jcmVkZW50aWFscy92MSJdLCJ0eXBlIjpbIlZlcmlmaWFibGVDcmVkZW50aWFsIl0sImNyZWRlbnRpYWxTdWJqZWN0Ijp7InlvdSI6IlJvY2sifX0sInN1YiI6ImRpZDp3ZWI6ZXhhbXBsZS5jb20iLCJuYmYiOjE2Mzc2ODAzMTcsImlzcyI6ImRpZDpldGhyOnJpbmtlYnk6MHgwMmY2NDk1NWRkMDVkZGU1NTkxMGYzNzllYzU3ODVlZWUwOGJiZTZlNTBkZGFlNmJhY2UwNTk2ZmQ4ZDQ2MDE4ZjcifQ.ujM4zNm8h5-Cg01vh4ka_7NmdwYl8HAjO90XjxYYwSa0-4rqzM5ndt-OE6vS6y0gPwhwlQWHmDxg4X7OTzCUoQ'\n    const expandedCred = {\n      credentialSubject: { you: 'Rock', id: 'did:web:example.com' },\n      issuer: { id: 'did:ethr:rinkeby:0x02f64955dd05dde55910f379ec5785eee08bbe6e50ddae6bace0596fd8d46018f7' },\n      type: ['VerifiableCredential'],\n      '@context': ['https://www.w3.org/2018/credentials/v1'],\n      issuanceDate: '2021-11-23T15:11:57.000Z',\n      proof: {\n        type: 'JwtProof2020',\n        jwt,\n      },\n    }\n    const serializedCred = `{\"credentialSubject\":{\"you\":\"Rock\",\"id\":\"did:web:example.com\"},\"issuer\":{\"id\":\"did:ethr:rinkeby:0x02f64955dd05dde55910f379ec5785eee08bbe6e50ddae6bace0596fd8d46018f7\"},\"type\":[\"VerifiableCredential\"],\"@context\":[\"https://www.w3.org/2018/credentials/v1\"],\"issuanceDate\":\"2021-11-23T15:11:57.000Z\",\"proof\":{\"type\":\"JwtProof2020\",\"jwt\":\"${jwt}\"}}`\n    expect(computeEntryHash(expandedCred)).toEqual(computeEntryHash(serializedCred))\n    expect(computeEntryHash(jwt)).toEqual(computeEntryHash(serializedCred))\n    expect(computeEntryHash(serializedCred)).toEqual('QmYBWeZCoB1zbJwGou1svfgrq9muVQyy7uzokMfdeSEoHH')\n  })\n\n  it('computeEntryHash for LD', () => {\n    const expandedCred = {\n      issuer: { id: 'did:key:z6MkvGFkoFarw7pXRBkKqZKwDcc2L3U4AZC1RtBiceicUHqn' },\n      '@context': ['https://www.w3.org/2018/credentials/v1', 'https://veramo.io/contexts/profile/v1'],\n      type: ['VerifiableCredential', 'Profile'],\n      issuanceDate: '2021-11-23T15:06:12.820Z',\n      credentialSubject: {\n        id: 'did:key:z6MkvGFkoFarw7pXRBkKqZKwDcc2L3U4AZC1RtBiceicUHqn',\n        name: 'Martin, the great',\n      },\n      proof: {\n        type: 'Ed25519Signature2018',\n        created: '2021-11-23T15:06:12Z',\n        verificationMethod:\n          'did:key:z6MkvGFkoFarw7pXRBkKqZKwDcc2L3U4AZC1RtBiceicUHqn#z6MkvGFkoFarw7pXRBkKqZKwDcc2L3U4AZC1RtBiceicUHqn',\n        proofPurpose: 'assertionMethod',\n        jws: 'eyJhbGciOiJFZERTQSIsImI2NCI6ZmFsc2UsImNyaXQiOlsiYjY0Il19..wKMmMZNdIgL_19HYJgpRL9SeKVzYT85S-ZyVdF3IMiaiL8nhX8i48D82TQtuQlTT960h_TOQ18fQFula6QxADA',\n      },\n    }\n    const serializedCred =\n      '{\"issuer\":{\"id\":\"did:key:z6MkvGFkoFarw7pXRBkKqZKwDcc2L3U4AZC1RtBiceicUHqn\"},\"@context\":[\"https://www.w3.org/2018/credentials/v1\",\"https://veramo.io/contexts/profile/v1\"],\"type\":[\"VerifiableCredential\",\"Profile\"],\"issuanceDate\":\"2021-11-23T15:06:12.820Z\",\"credentialSubject\":{\"id\":\"did:key:z6MkvGFkoFarw7pXRBkKqZKwDcc2L3U4AZC1RtBiceicUHqn\",\"name\":\"Martin, the great\"},\"proof\":{\"type\":\"Ed25519Signature2018\",\"created\":\"2021-11-23T15:06:12Z\",\"verificationMethod\":\"did:key:z6MkvGFkoFarw7pXRBkKqZKwDcc2L3U4AZC1RtBiceicUHqn#z6MkvGFkoFarw7pXRBkKqZKwDcc2L3U4AZC1RtBiceicUHqn\",\"proofPurpose\":\"assertionMethod\",\"jws\":\"eyJhbGciOiJFZERTQSIsImI2NCI6ZmFsc2UsImNyaXQiOlsiYjY0Il19..wKMmMZNdIgL_19HYJgpRL9SeKVzYT85S-ZyVdF3IMiaiL8nhX8i48D82TQtuQlTT960h_TOQ18fQFula6QxADA\"}}'\n    expect(computeEntryHash(expandedCred)).toEqual(computeEntryHash(serializedCred))\n    expect(computeEntryHash(serializedCred)).toEqual('QmYeBhqpqiFUcsTS1qz7tkuVCJq8Z4VrrSJsjJc4Q7k9ig')\n  })\n\n  it('extractIssuer', () => {\n    const ldCred1 = {\n      issuer: { id: 'did:key:z6MkvGFkoFarw7pXRBkKqZKwDcc2L3U4AZC1RtBiceicUHqn' },\n      proof: {\n        type: 'fake',\n      },\n    }\n    const ldCred2 = {\n      issuer: 'did:key:z6MkvGFkoFarw7pXRBkKqZKwDcc2L3U4AZC1RtBiceicUHqn',\n      proof: {\n        type: 'fake',\n      },\n    }\n    const ldCred3 = {\n      issuer: 'did:key:z6MkvGFkoFarw7pXRBkKqZKwDcc2L3U4AZC1RtBiceicUHqn?versionTime=2023-01-01T00:00:00Z',\n      proof: {\n        type: 'fake',\n      },\n    }\n    const ldPres = {\n      holder: 'did:key:z6MkvGFkoFarw7pXRBkKqZKwDcc2L3U4AZC1RtBiceicUHqn',\n      proof: {\n        type: 'fake',\n      },\n    }\n    const jwt =\n      'eyJhbGciOiJFUzI1NksiLCJ0eXAiOiJKV1QifQ.eyJ2YyI6eyJAY29udGV4dCI6WyJodHRwczovL3d3dy53My5vcmcvMjAxOC9jcmVkZW50aWFscy92MSJdLCJ0eXBlIjpbIlZlcmlmaWFibGVDcmVkZW50aWFsIl0sImNyZWRlbnRpYWxTdWJqZWN0Ijp7InlvdSI6IlJvY2sifX0sInN1YiI6ImRpZDp3ZWI6ZXhhbXBsZS5jb20iLCJuYmYiOjE2Mzc2ODAzMTcsImlzcyI6ImRpZDpldGhyOnJpbmtlYnk6MHgwMmY2NDk1NWRkMDVkZGU1NTkxMGYzNzllYzU3ODVlZWUwOGJiZTZlNTBkZGFlNmJhY2UwNTk2ZmQ4ZDQ2MDE4ZjcifQ.ujM4zNm8h5-Cg01vh4ka_7NmdwYl8HAjO90XjxYYwSa0-4rqzM5ndt-OE6vS6y0gPwhwlQWHmDxg4X7OTzCUoQ'\n    expect(extractIssuer(ldCred1)).toEqual('did:key:z6MkvGFkoFarw7pXRBkKqZKwDcc2L3U4AZC1RtBiceicUHqn')\n    expect(extractIssuer(ldCred2)).toEqual('did:key:z6MkvGFkoFarw7pXRBkKqZKwDcc2L3U4AZC1RtBiceicUHqn')\n    expect(extractIssuer(ldCred3)).toEqual(\n      'did:key:z6MkvGFkoFarw7pXRBkKqZKwDcc2L3U4AZC1RtBiceicUHqn?versionTime=2023-01-01T00:00:00Z',\n    )\n    expect(extractIssuer(ldCred3, { removeParameters: true })).toEqual(\n      'did:key:z6MkvGFkoFarw7pXRBkKqZKwDcc2L3U4AZC1RtBiceicUHqn',\n    )\n    expect(extractIssuer(ldPres)).toEqual('did:key:z6MkvGFkoFarw7pXRBkKqZKwDcc2L3U4AZC1RtBiceicUHqn')\n    expect(extractIssuer(jwt)).toEqual(\n      'did:ethr:rinkeby:0x02f64955dd05dde55910f379ec5785eee08bbe6e50ddae6bace0596fd8d46018f7',\n    )\n    expect(extractIssuer('')).toEqual('')\n    expect(extractIssuer('header.payload.signature')).toEqual('')\n    expect(extractIssuer({} as any)).toEqual('')\n    expect(extractIssuer(null)).toEqual('')\n    expect(extractIssuer(undefined)).toEqual('')\n  })\n\n  describe('removeDIDParameters', () => {\n    it('should remove query parameters from DID URLs', () => {\n      expect(removeDIDParameters('did:example:abc:0x123?service=agent')).toEqual('did:example:abc:0x123')\n      expect(removeDIDParameters('did:example:abc:0x123?service=agent&relativeRef=%2Fpath')).toEqual(\n        'did:example:abc:0x123',\n      )\n      expect(\n        removeDIDParameters(\n          'did:key:z6MkvGFkoFarw7pXRBkKqZKwDcc2L3U4AZC1RtBiceicUHqn?versionTime=2023-01-01T00:00:00Z',\n        ),\n      ).toEqual('did:key:z6MkvGFkoFarw7pXRBkKqZKwDcc2L3U4AZC1RtBiceicUHqn')\n    })\n\n    it('should remove fragment components from DID URLs', () => {\n      expect(removeDIDParameters('did:example:abc:0x123#version=42')).toEqual('did:example:abc:0x123')\n      expect(removeDIDParameters('did:key:z6MkvGFkoFarw7pXRBkKqZKwDcc2L3U4AZC1RtBiceicUHqn#key-1')).toEqual(\n        'did:key:z6MkvGFkoFarw7pXRBkKqZKwDcc2L3U4AZC1RtBiceicUHqn',\n      )\n    })\n\n    it('should remove both query parameters and fragment components', () => {\n      expect(\n        removeDIDParameters('did:example:abc:0x123?service=agent&relativeRef=%2Fpath#version=42'),\n      ).toEqual('did:example:abc:0x123')\n      expect(removeDIDParameters('did:web:example.com?service=files#key-1')).toEqual('did:web:example.com')\n    })\n\n    it('should return unchanged DID URLs without parameters', () => {\n      expect(removeDIDParameters('did:example:abc:0x123')).toEqual('did:example:abc:0x123')\n      expect(removeDIDParameters('did:key:z6MkvGFkoFarw7pXRBkKqZKwDcc2L3U4AZC1RtBiceicUHqn')).toEqual(\n        'did:key:z6MkvGFkoFarw7pXRBkKqZKwDcc2L3U4AZC1RtBiceicUHqn',\n      )\n      expect(removeDIDParameters('did:web:example.com')).toEqual('did:web:example.com')\n      expect(removeDIDParameters('did:ethr:mainnet:0x1234567890abcdef')).toEqual(\n        'did:ethr:mainnet:0x1234567890abcdef',\n      )\n    })\n\n    it('should handle various DID methods', () => {\n      expect(\n        removeDIDParameters(\n          'did:ethr:rinkeby:0x02f64955dd05dde55910f379ec5785eee08bbe6e50ddae6bace0596fd8d46018f7?service=endpoint',\n        ),\n      ).toEqual('did:ethr:rinkeby:0x02f64955dd05dde55910f379ec5785eee08bbe6e50ddae6bace0596fd8d46018f7')\n      expect(removeDIDParameters('did:web:example.com:user:alice?versionId=1#publicKey')).toEqual(\n        'did:web:example.com:user:alice',\n      )\n      expect(\n        removeDIDParameters('did:ion:EiClkZMDxPKqC9c-umQfTkR8vvZ9JPhl_xLDI9Nfk38w5w?service=hub#auth-key'),\n      ).toEqual('did:ion:EiClkZMDxPKqC9c-umQfTkR8vvZ9JPhl_xLDI9Nfk38w5w')\n    })\n\n    it('should handle edge cases gracefully', () => {\n      // Empty string\n      expect(removeDIDParameters('')).toEqual('')\n\n      // Non-DID URLs (URL constructor behavior)\n      expect(removeDIDParameters('https://example.com:123/456?param=value#fragment')).toEqual(\n        'https://example.com:123/456',\n      )\n      expect(removeDIDParameters('not-a-url')).toEqual('not-a-url')\n\n      // Malformed DIDs (fallback behavior)\n      expect(removeDIDParameters('did:')).toEqual('did:')\n      expect(removeDIDParameters('did:invalid')).toEqual('did:invalid')\n    })\n\n    it('should handle complex query parameters', () => {\n      expect(removeDIDParameters('did:example:123?service=files&transform=upper&version=1.0')).toEqual(\n        'did:example:123',\n      )\n      expect(removeDIDParameters('did:example:123?hl=en-US&service=agent%20endpoint')).toEqual(\n        'did:example:123',\n      )\n    })\n\n    it('should handle only query parameters', () => {\n      expect(removeDIDParameters('did:example:123?service=agent')).toEqual('did:example:123')\n      expect(removeDIDParameters('did:example:123?')).toEqual('did:example:123')\n    })\n\n    it('should handle only fragment components', () => {\n      expect(removeDIDParameters('did:example:123#key-1')).toEqual('did:example:123')\n      expect(removeDIDParameters('did:example:123#')).toEqual('did:example:123')\n    })\n  })\n})\n"
  },
  {
    "path": "packages/utils/src/__tests__/did-utils.test.ts",
    "content": "import {\n  compressSecp256k1PublicKeyHex,\n  extractPublicKeyHex,\n  getChainId,\n  getEthereumAddress,\n} from '../did-utils.js'\nimport { bytesToMultibase, hexToBytes } from '../encodings.js'\n\ndescribe('@veramo/utils did utils', () => {\n  it(`should return correct chainId for did:ethr`, () => {\n    expect(() =>\n      getChainId({\n        id: 'did:ethr:0x1B54DaD834f2017ab66C1a1ffF74425889141e51#controller',\n        type: 'EcdsaSecp256k1RecoveryMethod2020',\n        controller: 'did:ethr:0x1B54DaD834f2017ab66C1a1ffF74425889141e51',\n        blockchainAccountId: 'did:key:0x32234234234234',\n      }),\n    ).toThrow()\n    expect(\n      getChainId({\n        id: 'did:ethr:0x1B54DaD834f2017ab66C1a1ffF74425889141e51#controller',\n        type: 'EcdsaSecp256k1RecoveryMethod2020',\n        controller: 'did:ethr:0x1B54DaD834f2017ab66C1a1ffF74425889141e51',\n        blockchainAccountId: 'eip155:1:0x1B54DaD834f2017ab66C1a1ffF74425889141e51',\n      }),\n    ).toEqual(1)\n    expect(\n      getChainId({\n        id: 'did:ethr:0x1B54DaD834f2017ab66C1a1ffF74425889141e51#controller',\n        type: 'EcdsaSecp256k1RecoveryMethod2020',\n        controller: 'did:ethr:0x1B54DaD834f2017ab66C1a1ffF74425889141e51',\n        blockchainAccountId: 'eip155:1:did:ethr:0x1B54DaD834f2017ab66C1a1ffF74425889141e51',\n      }),\n    ).toEqual(1)\n    expect(\n      getChainId({\n        id: 'did:ethr:sepolia:0x1B54DaD834f2017ab66C1a1ffF74425889141e51#controller',\n        type: 'EcdsaSecp256k1RecoveryMethod2020',\n        controller: 'did:ethr:sepolia:0x1B54DaD834f2017ab66C1a1ffF74425889141e51',\n        blockchainAccountId: 'eip155:11155111:0x1B54DaD834f2017ab66C1a1ffF74425889141e51',\n      }),\n    ).toEqual(11155111)\n  })\n\n  it('should return correct chainId for did:pkh', () => {\n    expect(\n      getChainId({\n        id: 'did:pkh:eip155:59144:0x19711CD19e609FEBdBF607960220898268B7E24b#blockchainAccountId',\n        type: 'EcdsaSecp256k1RecoveryMethod2020',\n        controller: 'did:pkh:eip155:59144:0x19711CD19e609FEBdBF607960220898268B7E24b',\n        blockchainAccountId: 'eip155:59144:0x19711CD19e609FEBdBF607960220898268B7E24b',\n      }),\n    ).toEqual(59144)\n  })\n\n  it('should throw on invalid chainId', () => {\n    expect(() => {\n      getChainId({\n        id: 'did:pkh:eip155:59144:0x19711CD19e609FEBdBF607960220898268B7E24b#blockchainAccountId',\n        type: 'EcdsaSecp256k1RecoveryMethod2020',\n        controller: 'did:pkh:eip155:59144:0x19711CD19e609FEBdBF607960220898268B7E24b',\n        blockchainAccountId: 'eip155:linea:0x19711CD19e609FEBdBF607960220898268B7E24b',\n      })\n    }).toThrow('chainId is not a number')\n  })\n\n  it('should return blockchainAccountId for did:ethr', () => {\n    const verificationMethod = {\n      id: 'did:ethr:0x1B54DaD834f2017ab66C1a1ffF74425889141e51#controller',\n      type: 'EcdsaSecp256k1RecoveryMethod2020',\n      controller: 'did:ethr:0x1B54DaD834f2017ab66C1a1ffF74425889141e51',\n      blockchainAccountId: 'eip155:1:0x1B54DaD834f2017ab66C1a1ffF74425889141e51',\n    }\n\n    expect(getEthereumAddress(verificationMethod)).toEqual(\n      '0x1B54DaD834f2017ab66C1a1ffF74425889141e51'.toLowerCase(),\n    )\n  })\n\n  it('should return blockchainAccountId for did:key', () => {\n    const verificationMethod = {\n      id: 'did:key:zQ3shdHG4u9wPDoEzSokyLm3readHkrpYaXFf9jbc8Eiz1UM5#zQ3shdHG4u9wPDoEzSokyLm3readHkrpYaXFf9jbc8Eiz1UM5',\n      type: 'EcdsaSecp256k1VerificationKey2019',\n      controller: 'did:key:zQ3shdHG4u9wPDoEzSokyLm3readHkrpYaXFf9jbc8Eiz1UM5',\n      publicKeyJwk: {\n        kty: 'EC',\n        crv: 'secp256k1',\n        x: '6805tExt2N3AcS9cxs_RJT_RtAkfK6rqIix5B4k0oEg',\n        y: 'qw0mojIWWljYFYHvsSkcBfaUVfeSf1YEbyFZmzAif2Q',\n      },\n    }\n\n    expect(getEthereumAddress(verificationMethod)).toEqual(\n      '0x923f7158062db4761a8917ad1628d11536c5f07b'.toLowerCase(),\n    )\n  })\n\n  it('should convert to multibase and back', async () => {\n    const publicKeyHex = '6bb3f30242ac89bb6baa169fd5d1fea5adb61ce5b3cfee9e157e699a51983869'\n    const computedMultibase = bytesToMultibase(hexToBytes(publicKeyHex), 'base58btc', 'ed25519-pub')\n    // // multibase\n    // let expectedMultibase = `z8FRmkyRH9xAsLCk51yXN2Qy6uq4eN4iAesa3v3Hv889v`;\n\n    // // multibase + multicodec\n    let expectedMultibase = `z6MkmhgpMDfiVVfLShamhYVCsWX6jQLVmwxXLtUykKFw3LwJ`\n\n    expect(computedMultibase).toEqual(expectedMultibase)\n\n    const computed = extractPublicKeyHex({\n      publicKeyMultibase: expectedMultibase,\n      type: 'Ed25519VerificationKey2020',\n      id: 'dummy key',\n      controller: 'dummy controller',\n    })\n\n    expect(computed).toEqual({ publicKeyHex, keyType: 'Ed25519' })\n  })\n\n  it('should convert to multibase and back', async () => {\n    const publicKeyHex = '6bb3f30242ac89bb6baa169fd5d1fea5adb61ce5b3cfee9e157e699a51983869'\n    const computedMultibase = bytesToMultibase(hexToBytes(publicKeyHex), 'base58btc', 'ed25519-pub')\n\n    // // multibase + multicodec\n    let expectedMultibase = `z6MkmhgpMDfiVVfLShamhYVCsWX6jQLVmwxXLtUykKFw3LwJ`\n\n    expect(computedMultibase).toEqual(expectedMultibase)\n\n    const computedXMultibase = bytesToMultibase(hexToBytes(publicKeyHex), 'base58btc', 'x25519-pub')\n    let expectedXMultibase = `z6LSivbwHHE9FQtcRb7qYd3KM1Bakybm4ftKXrHjQVwSqVvg`\n\n    expect(computedXMultibase).toEqual(expectedXMultibase)\n\n    const computed = extractPublicKeyHex({\n      publicKeyMultibase: expectedMultibase,\n      type: 'Ed25519VerificationKey2020',\n      id: 'dummy key',\n      controller: 'dummy controller',\n    })\n\n    expect(computed).toEqual({ publicKeyHex, keyType: 'Ed25519' })\n  })\n\n  it('compresses a secp256k1 public key', async () => {\n    const uncompressedPubKeyHex =\n      '04a5c9734922890f0e76cce0bb2645925a9712fe89eb00eb2d9c480208a5de48cbaded6443a8668e0eef5205d08e7614374d659a1aa1beb0ef9ffec810988f2da3'\n    const compressedPubKeyHex = '03a5c9734922890f0e76cce0bb2645925a9712fe89eb00eb2d9c480208a5de48cb'\n    expect(compressSecp256k1PublicKeyHex(uncompressedPubKeyHex)).toEqual(compressedPubKeyHex)\n    expect(compressSecp256k1PublicKeyHex(compressedPubKeyHex)).toEqual(compressedPubKeyHex) // no change\n  })\n})\n"
  },
  {
    "path": "packages/utils/src/__tests__/encodings.test.ts",
    "content": "import { bytesToHex, hexToBytes } from '../encodings.js'\n\ndescribe('@veramo/utils encoding utils', () => {\n  describe('hexToBytes', () => {\n    it('should convert hex string to bytes', () => {\n      expect(hexToBytes('0x0102')).toEqual(Uint8Array.from([1, 2]))\n      expect(hexToBytes('0x0A0b')).toEqual(Uint8Array.from([10, 11]))\n      expect(hexToBytes('0102')).toEqual(Uint8Array.from([1, 2]))\n      expect(hexToBytes('0A0b')).toEqual(Uint8Array.from([10, 11]))\n      expect(hexToBytes('A0b')).toEqual(Uint8Array.from([10, 11]))\n    })\n\n    it('should mirror uint8array', () => {\n      // @ts-ignore\n      expect(hexToBytes(Buffer.from('0102', 'hex'))).toEqual(Uint8Array.from([1, 2]))\n    })\n\n    it('should refuse non-string types', () => {\n      expect(() => {\n        // @ts-ignore\n        hexToBytes({})\n      }).toThrow(/illegal_argument/)\n      expect(() => {\n        // @ts-ignore\n        hexToBytes(undefined)\n      }).toThrow(/illegal_argument/)\n      expect(() => {\n        // @ts-ignore\n        hexToBytes(null)\n      }).toThrow(/illegal_argument/)\n      expect(() => {\n        // @ts-ignore\n        hexToBytes(1234)\n      }).toThrow(/illegal_argument/)\n    })\n\n    it('should refuse wrong charset', () => {\n      expect(() => {\n        // @ts-ignore\n        hexToBytes('zxcv')\n      }).toThrow()\n    })\n  })\n\n  describe('bytesToHex', () => {\n    it('should convert bytes to hexString', () => {\n      expect(bytesToHex(Uint8Array.from([1, 2]))).toEqual('0102')\n      expect(bytesToHex(Buffer.from([11, 12]))).toEqual('0b0c')\n      expect(bytesToHex(Uint8Array.from([1, 2]), true)).toEqual('0x0102')\n      expect(bytesToHex(Buffer.from([11, 12]), true)).toEqual('0x0b0c')\n    })\n\n    it('should refuse non-uint8Array types', () => {\n      expect(() => {\n        // @ts-ignore\n        bytesToHex({})\n      }).toThrow(/illegal_argument/)\n      expect(() => {\n        // @ts-ignore\n        bytesToHex(undefined)\n      }).toThrow(/illegal_argument/)\n      expect(() => {\n        // @ts-ignore\n        bytesToHex(null)\n      }).toThrow(/illegal_argument/)\n      expect(() => {\n        // @ts-ignore\n        bytesToHex(1234)\n      }).toThrow(/illegal_argument/)\n      expect(() => {\n        // @ts-ignore\n        bytesToHex([1, 2, 3, 4])\n      }).toThrow(/illegal_argument/)\n    })\n  })\n})\n"
  },
  {
    "path": "packages/utils/src/__tests__/utils.test.ts",
    "content": "import { asArray, intersect, isDefined } from '../type-utils.js'\n\ndescribe('@veramo/utils type utils', () => {\n  it('isDefined should return correct results', () => {\n    const a = {\n      b: 'defined',\n    }\n    const arr = [null, undefined, 'a', 'b']\n    expect(isDefined(undefined)).toBe(false)\n    expect(isDefined(null)).toBe(false)\n    expect(isDefined(false)).toBe(true)\n    expect(isDefined(a.b)).toBe(true)\n    expect(isDefined((a as any).c)).toBe(false)\n    expect(arr.filter(isDefined)).toEqual(['a', 'b'])\n  })\n\n  it('asArray should return an array', () => {\n    expect(asArray('a')).toEqual(['a'])\n    expect(asArray(['a', 'b'])).toEqual(['a', 'b'])\n    expect(asArray(undefined)).toEqual([])\n    expect(asArray(null)).toEqual([])\n  })\n\n  describe('intersect', () => {\n    it('should work with primitive types', () => {\n      expect(intersect(['a'], ['b'])).toStrictEqual([])\n      expect(intersect(['a', 'a'], ['b'])).toStrictEqual([])\n      expect(intersect(['a', 'a', 'b'], ['b'])).toStrictEqual(['b'])\n      expect(intersect(['a', 'a', 'b'], ['b', 'a'])).toStrictEqual(['a', 'b'])\n      expect(intersect(['a', 'a', 'b', 1], ['b', 'a', 2])).toStrictEqual(['a', 'b'])\n      expect(intersect(['a', 'a', 'b', 1], ['b', 1, 2])).toStrictEqual(['b', 1])\n      expect(intersect([1, false], [true])).toStrictEqual([])\n      expect(intersect([1, false, null], [true, null])).toStrictEqual([null])\n      expect(intersect([1, false, undefined], [true, undefined])).toStrictEqual([undefined])\n      expect(intersect([1], [true])).toStrictEqual([])\n    })\n\n    it('does not work with objects since references are different', () => {\n      expect(intersect([{}], [{}])).toStrictEqual([])\n    })\n  })\n})\n"
  },
  {
    "path": "packages/utils/src/credential-utils.ts",
    "content": "import { asArray, isDefined } from './type-utils.js'\nimport {\n  CredentialPayload,\n  IMessage,\n  IssuerType,\n  PresentationPayload,\n  VerifiableCredential,\n  VerifiablePresentation,\n  W3CVerifiableCredential,\n  W3CVerifiablePresentation,\n} from '@veramo/core-types'\nimport { decodeJWT } from 'did-jwt'\nimport { normalizeCredential, normalizePresentation } from 'did-jwt-vc'\nimport { code, encode, prepare } from '@ipld/dag-pb'\nimport * as Digest from 'multiformats/hashes/digest'\nimport { CID } from 'multiformats/cid'\nimport { UnixFS } from 'ipfs-unixfs'\nimport { sha256 } from '@noble/hashes/sha256'\n\n/**\n * Every Verifiable Credential `@context` property must contain this.\n *\n * @public\n */\nexport const MANDATORY_CREDENTIAL_CONTEXT = 'https://www.w3.org/2018/credentials/v1'\n\n/**\n * Processes an entry or an array of entries into an array of entries. If a `startWithEntry` param is provided, it is\n * set as the first item in the result array.\n * @param inputEntryOrArray - The input that needs to be transformed to an array.\n * @param startWithEntry - If this is provided, this element will be the first in the resulting array.\n *\n * @beta This API may change without a BREAKING CHANGE notice.\n */\nexport function processEntryToArray(\n  inputEntryOrArray?: string | string[] | any,\n  startWithEntry?: string,\n): string[] {\n  const result: string[] = asArray<string>(inputEntryOrArray) || [startWithEntry]\n  if (startWithEntry && result[0] !== startWithEntry) {\n    result.unshift(startWithEntry)\n  }\n  return result.filter<string>(isDefined).filter((item, index, arr) => arr.indexOf(item) === index)\n}\n\n/**\n * Parses a {@link @veramo/core-types#W3CVerifiableCredential | W3CVerifiableCredential} and converts it to a\n * {@link @veramo/core-types#VerifiableCredential | VerifiableCredential} so it is easier to use programmatically.\n *\n * @param input - the raw credential to be transformed\n * @beta This API may change without a BREAKING CHANGE notice.\n */\nexport function decodeCredentialToObject(input: W3CVerifiableCredential): VerifiableCredential {\n  return typeof input === 'string' ? normalizeCredential(input) : <VerifiableCredential>input\n}\n\n/**\n * Parses a {@link @veramo/core-types#W3CVerifiablePresentation | W3CVerifiablePresentation} and converts it to a\n * {@link @veramo/core-types#VerifiablePresentation | VerifiablePresentation} so it is easier to use programmatically.\n *\n * @param input - the raw presentation to be transformed.\n *\n * @beta This API may change without a BREAKING CHANGE notice.\n */\nexport function decodePresentationToObject(input: W3CVerifiablePresentation): VerifiablePresentation {\n  let result: VerifiablePresentation\n  if (typeof input === 'string') {\n    result = normalizePresentation(input)\n  } else {\n    result = input as VerifiablePresentation\n    result.verifiableCredential = asArray<W3CVerifiableCredential>(result.verifiableCredential).map(\n      decodeCredentialToObject,\n    )\n  }\n  return result\n}\n\n/**\n * Computes a hash for a given credential or presentation.\n * This hash is usable as an internal ID for database indexing\n *\n * @param input - the Credential or Presentation whose hash is neeeded\n *\n * @beta This API may change without a BREAKING CHANGE notice.\n */\nexport function computeEntryHash(\n  input: W3CVerifiableCredential | W3CVerifiablePresentation | IMessage,\n): string {\n  let hashable: string\n  if (typeof input === 'string') {\n    try {\n      const cred = JSON.parse(input)\n      hashable = cred?.proof?.jwt || input\n    } catch (e) {\n      hashable = input\n    }\n  } else if ((<VerifiableCredential>input)?.proof?.jwt) {\n    hashable = (<VerifiableCredential>input).proof.jwt\n  } else {\n    hashable = JSON.stringify(input)\n  }\n\n  const unixfs = new UnixFS({\n    type: 'file',\n    data: new TextEncoder().encode(hashable),\n  })\n\n  const bytes = encode(prepare({ Data: unixfs.marshal() }))\n  const digest = Digest.create(18, sha256(bytes))\n  return CID.create(0, code, digest).toString()\n}\n\n/**\n * Decodes a credential or presentation and returns the issuer ID\n * `iss` from a JWT or `issuer`/`issuer.id` from a VC or `holder` from a VP\n *\n * @param input - the credential or presentation whose issuer/holder needs to be extracted.\n * @param options - options for the extraction\n *   removeParameters - Remove all DID parameters from the issuer ID\n *\n * @beta This API may change without a BREAKING CHANGE notice.\n */\nexport function extractIssuer(\n  input?:\n    | W3CVerifiableCredential\n    | W3CVerifiablePresentation\n    | CredentialPayload\n    | PresentationPayload\n    | null,\n  options: { removeParameters?: boolean } = {},\n): string {\n  if (!isDefined(input)) {\n    return ''\n  } else if (typeof input === 'string') {\n    // JWT\n    try {\n      const { payload } = decodeJWT(input)\n      const iss = payload.iss || ''\n      return !!options.removeParameters ? removeDIDParameters(iss) : iss\n    } catch (e: any) {\n      return ''\n    }\n  } else {\n    // JSON\n    let iss: IssuerType\n    if (input.issuer) {\n      iss = input.issuer\n    } else if (input.holder) {\n      iss = input.holder\n    } else {\n      iss = ''\n    }\n    if (typeof iss !== 'string') iss = iss.id || ''\n    return !!options.removeParameters ? removeDIDParameters(iss) : iss\n  }\n}\n\n/**\n * Remove all DID query parameters and fragment components from a DID URL\n *\n * @param did - the DID URL that may contain query parameters\n * @returns DID URL without query parameters\n *\n * @example\n * ```TypeScript\n * removeDIDParameters('did:example:abc:0x123?service=agent&relativeRef=%2Fpath#version=42')\n * // Returns: 'did:example:abc:0x123'\n *\n * removeDIDParameters('https://example.com:3128/:abc:0x123?service=agent&relativeRef=%2Fpath#version=42')\n * // Returns: 'https://example.com:3128/:abc:0x123'\n *\n * removeDIDParameters('did:example:abc:0x123#version=42')\n * // Returns: 'did:example:abc:0x123'\n * ```\n *\n * @beta This API may change without a BREAKING CHANGE notice.\n */\nexport function removeDIDParameters(did: string): string {\n  try {\n    const { origin, protocol, pathname } = new URL(did)\n    // Reconstruct URL without search parameters or hash\n    return origin !== 'null' ? `${origin}${pathname}` : `${protocol}${pathname}`\n  } catch (error) {\n    // Fallback: return original input for malformed URLs or non-URL strings\n    return did\n  }\n}\n"
  },
  {
    "path": "packages/utils/src/did-utils.ts",
    "content": "import { computeAddress, SigningKey } from 'ethers'\nimport {\n  DIDDocumentSection,\n  IAgentContext,\n  IIdentifier,\n  IKey,\n  IKeyManager,\n  IResolver,\n  TKeyType,\n} from '@veramo/core-types'\nimport { DIDDocument, DIDResolutionOptions, VerificationMethod } from 'did-resolver'\nimport { extractPublicKeyBytes } from 'did-jwt'\nimport {\n  _ExtendedIKey,\n  _ExtendedVerificationMethod,\n  _NormalizedVerificationMethod,\n  ImportOrCreateKeyOptions,\n} from './types/utility-types.js'\nimport { isDefined } from './type-utils.js'\nimport Debug from 'debug'\nimport { bytesToHex, hexToBytes } from './encodings.js'\nimport { ed25519 } from '@noble/curves/ed25519'\n\nconst debug = Debug('veramo:utils')\n\n/**\n * Converts Ed25519 public keys to X25519\n * @param publicKey - The bytes of an Ed25519P public key\n *\n * @beta This API may change without a BREAKING CHANGE notice.\n */\nexport function convertEd25519PublicKeyToX25519(publicKey: Uint8Array): Uint8Array {\n  // FIXME: Once https://github.com/paulmillr/noble-curves/issues/31 gets released, this code can be simplified\n  const Fp = ed25519.CURVE.Fp\n  const { y } = ed25519.ExtendedPoint.fromHex(publicKey)\n  const _1n = BigInt(1)\n  return Fp.toBytes(Fp.create((_1n + y) * Fp.inv(_1n - y)))\n}\n\n/**\n * Converts Ed25519 private keys to X25519\n * @param privateKey - The bytes of an Ed25519P private key\n *\n * @beta This API may change without a BREAKING CHANGE notice.\n */\nexport function convertEd25519PrivateKeyToX25519(privateKey: Uint8Array): Uint8Array {\n  // FIXME: Once https://github.com/paulmillr/noble-curves/issues/31 gets released, this code can be simplified\n  const hashed = ed25519.CURVE.hash(privateKey.subarray(0, 32))\n  return ed25519?.CURVE?.adjustScalarBytes?.(hashed)?.subarray(0, 32) ?? new Uint8Array(0)\n}\n\n/**\n * Converts any Ed25519 keys of an {@link @veramo/core-types#IIdentifier | IIdentifier} to X25519 to be usable for\n * encryption.\n *\n * @param identifier - the identifier with keys\n *\n * @returns the array of converted keys filtered to contain ONLY X25519 keys usable for encryption.\n *\n * @beta This API may change without a BREAKING CHANGE notice.\n */\nexport function convertIdentifierEncryptionKeys(identifier: IIdentifier): IKey[] {\n  return identifier.keys\n    .map((key: IKey) => {\n      if (key.type === 'Ed25519') {\n        const publicBytes = hexToBytes(key.publicKeyHex)\n        key.publicKeyHex = bytesToHex(convertEd25519PublicKeyToX25519(publicBytes))\n        if (key.privateKeyHex) {\n          const privateBytes = hexToBytes(key.privateKeyHex)\n          key.privateKeyHex = bytesToHex(convertEd25519PrivateKeyToX25519(privateBytes))\n        }\n        key.type = 'X25519'\n      } else if (key.type !== 'X25519') {\n        debug(`key of type ${key.type} is not supported for [de]encryption`)\n        return null\n      }\n      return key\n    })\n    .filter(isDefined)\n}\n\n/**\n * Converts any Secp256k1 public keys of an {@link @veramo/core-types#IIdentifier | IIdentifier} to their compressed\n * form.\n *\n * @param identifier - the identifier with keys\n *\n * @returns the array of keys where the Secp256k1 entries are compressed.\n *\n * @beta This API may change without a BREAKING CHANGE notice.\n */\nexport function compressIdentifierSecp256k1Keys(identifier: IIdentifier): IKey[] {\n  return identifier.keys\n    .map((key: IKey) => {\n      if (key.type === 'Secp256k1') {\n        if (key.publicKeyHex) {\n          const publicBytes = hexToBytes(key.publicKeyHex)\n          key.publicKeyHex = SigningKey.computePublicKey(publicBytes, true).substring(2)\n          key.meta = { ...key.meta }\n          key.meta.ethereumAddress = computeAddress('0x' + key.publicKeyHex)\n        }\n      }\n      return key\n    })\n    .filter(isDefined)\n}\n\n/**\n * Compresses a Secp256k1 public key in hex format.\n *\n * @returns the compressed public key hex string without 0x prefix, or an empty string if no input was provided.\n * @param publicKeyHex - the (un)compressed public key hex string\n * @internal\n */\nexport function compressSecp256k1PublicKeyHex(publicKeyHex?: string): string {\n  if (typeof publicKeyHex !== 'string') {\n    return ''\n  }\n  const publicBytes = hexToBytes(publicKeyHex)\n  return SigningKey.computePublicKey(publicBytes, true).substring(2)\n}\n\n/**\n * Compares the `blockchainAccountId` of a `EcdsaSecp256k1RecoveryMethod2020` verification method with the address\n * computed from a locally managed key.\n *\n * @returns true if the local key address corresponds to the `blockchainAccountId`\n *\n * @param localKey - The locally managed key\n * @param verificationMethod - a {@link did-resolver#VerificationMethod | VerificationMethod} with a\n *   `blockchainAccountId`\n *\n * @beta This API may change without a BREAKING CHANGE notice.\n */\nfunction compareBlockchainAccountId(localKey: IKey, verificationMethod: VerificationMethod): boolean {\n  if (localKey.type !== 'Secp256k1') {\n    return false\n  }\n  let vmEthAddr = getEthereumAddress(verificationMethod)\n  const localAccount = localKey.meta?.account ?? localKey.meta?.ethereumAddress\n  if (localKey.meta?.account) {\n    return vmEthAddr === localAccount.toLowerCase()\n  }\n  const computedAddr = computeAddress('0x' + localKey.publicKeyHex).toLowerCase()\n  return computedAddr === vmEthAddr\n}\n\n/**\n * Extracts an ethereum address from a {@link did-resolver#VerificationMethod | verification method} supporting legacy\n * representations.\n *\n * @param verificationMethod - the VerificationMethod object (from a DID document)\n *\n * @returns an ethereum address `string` or `undefined` if none could be extracted\n *\n * @beta This API may change without a BREAKING CHANGE notice.\n */\nexport function getEthereumAddress(verificationMethod: VerificationMethod): string | undefined {\n  let vmEthAddr = verificationMethod.ethereumAddress?.toLowerCase()\n  if (!vmEthAddr) {\n    if (verificationMethod.blockchainAccountId?.includes('@eip155')) {\n      vmEthAddr = verificationMethod.blockchainAccountId?.split('@eip155')[0].toLowerCase()\n    } else if (verificationMethod.blockchainAccountId?.startsWith('eip155')) {\n      vmEthAddr = verificationMethod.blockchainAccountId.split(':')[2]?.toLowerCase()\n    } else {\n      const { keyBytes, keyType } = extractPublicKeyBytes(verificationMethod)\n      if (keyType !== 'Secp256k1') {\n        return undefined\n      }\n      const pbHex = SigningKey.computePublicKey(keyBytes, false)\n\n      vmEthAddr = computeAddress(pbHex).toLowerCase()\n    }\n  }\n  return vmEthAddr\n}\n\n/**\n * Extracts the chain ID from a {@link did-resolver#VerificationMethod | verification method} supporting legacy\n * representations as well.\n *\n * @param verificationMethod - the VerificationMethod object (from a DID document)\n *\n * @returns a chain ID `number` or `undefined` if none could be extracted.\n *\n * @beta This API may change without a BREAKING CHANGE notice.\n */\nexport function getChainId(verificationMethod: _NormalizedVerificationMethod): number {\n  let result\n  if (verificationMethod.blockchainAccountId?.includes('@eip155')) {\n    result = parseInt(verificationMethod.blockchainAccountId!.split(':').slice(-1)[0])\n  } else if (verificationMethod.blockchainAccountId?.startsWith('eip155')) {\n    result = parseInt(verificationMethod.blockchainAccountId!.split(':')[1])\n  }\n  if (!Number.isInteger(result)) {\n    throw new Error('chainId is not a number')\n  }\n  if (result) {\n    return result\n  }\n  throw new Error('blockchainAccountId does not include eip155 designation')\n}\n\n/**\n * Maps the keys of a locally managed {@link @veramo/core-types#IIdentifier | IIdentifier} to the corresponding\n * {@link did-resolver#VerificationMethod | VerificationMethod} entries from the DID document.\n *\n * @param identifier - the identifier to be mapped\n * @param section - the section of the DID document to be mapped (see\n *   {@link https://www.w3.org/TR/did-core/#verification-relationships | verification relationships}), but can also be\n *   `verificationMethod` to map all the keys.\n * @param context - the veramo agent context, which must contain a {@link @veramo/core-types#IResolver | IResolver}\n *   implementation that can resolve the DID document of the identifier.\n * @param resolutionOptions - optional parameters to be passed to the DID resolver\n *\n * @returns an array of mapped keys. The corresponding verification method is added to the `meta.verificationMethod`\n *   property of the key.\n *\n * @beta This API may change without a BREAKING CHANGE notice.\n */\nexport async function mapIdentifierKeysToDoc(\n  identifier: IIdentifier,\n  section: DIDDocumentSection = 'keyAgreement',\n  context: IAgentContext<IResolver>,\n  resolutionOptions?: DIDResolutionOptions,\n): Promise<_ExtendedIKey[]> {\n  const didDocument = await resolveDidOrThrow(identifier.did, context, resolutionOptions)\n  // dereference all key agreement keys from the DID document and normalize\n  const documentKeys: _NormalizedVerificationMethod[] = await dereferenceDidKeys(\n    didDocument,\n    section,\n    context,\n  )\n\n  let localKeys = identifier.keys.filter(isDefined)\n  if (section === 'keyAgreement') {\n    localKeys = convertIdentifierEncryptionKeys(identifier)\n  } else {\n    localKeys = compressIdentifierSecp256k1Keys(identifier)\n  }\n  // finally, map the didDocument keys to the identifier keys by comparing `publicKeyHex`\n  return documentKeys\n    .map((verificationMethod) => {\n      const localKey = localKeys.find(\n        (localKey: IKey) =>\n          localKey.publicKeyHex === verificationMethod.publicKeyHex ||\n          compareBlockchainAccountId(localKey, verificationMethod),\n      )\n      if (localKey) {\n        const { meta, ...localProps } = localKey\n        return { ...localProps, meta: { ...meta, verificationMethod } }\n      } else {\n        return null\n      }\n    })\n    .filter(isDefined)\n}\n\n/**\n * Resolve a DID document or throw an error if the resolution fails.\n *\n * @param didUrl - the DID to be resolved\n * @param context - the veramo agent context, which must contain a {@link @veramo/core-types#IResolver | IResolver}\n *   implementation that can resolve the DID document of the `didUrl`.\n * @param resolutionOptions - optional parameters to be passed to the DID resolver\n *\n * @returns a {@link did-resolver#DIDDocument | DIDDocument} if resolution is successful\n * @throws if the resolution fails\n *\n * @beta This API may change without a BREAKING CHANGE notice.\n */\nexport async function resolveDidOrThrow(\n  didUrl: string,\n  context: IAgentContext<IResolver>,\n  resolutionOptions?: DIDResolutionOptions,\n): Promise<DIDDocument> {\n  // TODO: add caching\n  const docResult = await context.agent.resolveDid({ didUrl: didUrl, options: resolutionOptions })\n  const err = docResult?.didResolutionMetadata?.error\n  const msg = docResult?.didResolutionMetadata?.message\n  const didDocument = docResult.didDocument\n  if (!isDefined(didDocument) || err) {\n    throw new Error(`not_found: could not resolve DID document for '${didUrl}': ${err} ${msg}`)\n  }\n  return didDocument\n}\n\n/**\n * Dereferences keys from DID document and normalizes them for easy comparison.\n *\n * When dereferencing keyAgreement keys, only Ed25519 and X25519 curves are supported.\n * Other key types are omitted from the result and Ed25519 keys are converted to X25519\n *\n * @returns a Promise that resolves to the list of dereferenced keys.\n *\n * @beta This API may change without a BREAKING CHANGE notice.\n */\nexport async function dereferenceDidKeys(\n  didDocument: DIDDocument,\n  section: DIDDocumentSection = 'keyAgreement',\n  context: IAgentContext<IResolver>,\n): Promise<_NormalizedVerificationMethod[]> {\n  const convert = section === 'keyAgreement'\n  if (section === 'service') {\n    return []\n  }\n  return (\n    await Promise.all(\n      (didDocument[section] || []).map(async (key: string | VerificationMethod) => {\n        if (typeof key === 'string') {\n          try {\n            return (await context.agent.getDIDComponentById({\n              didDocument,\n              didUrl: key,\n              section,\n            })) as _ExtendedVerificationMethod\n          } catch (e) {\n            return null\n          }\n        } else {\n          return key as _ExtendedVerificationMethod\n        }\n      }),\n    )\n  )\n    .filter(isDefined)\n    .map((key) => {\n      const { publicKeyHex: hexKey, keyType } = extractPublicKeyHex(key, convert)\n      const {\n        publicKeyHex,\n        publicKeyBase58,\n        publicKeyMultibase,\n        publicKeyBase64,\n        publicKeyJwk,\n        ...keyProps\n      } = key\n      const newKey = { ...keyProps, publicKeyHex: hexKey }\n\n      // With a JWK `key`, `newKey` does not have information about crv (Ed25519 vs X25519)\n      // Should type of `newKey` change?\n      if (convert) {\n        if ('Ed25519VerificationKey2018' === newKey.type) {\n          newKey.type = 'X25519KeyAgreementKey2019'\n        } else if ('Ed25519VerificationKey2020' === newKey.type || 'X25519' === keyType) {\n          newKey.type = 'X25519KeyAgreementKey2020'\n        }\n      }\n\n      return newKey\n    })\n}\n\n/**\n * Converts the publicKey of a VerificationMethod to hex encoding (publicKeyHex), with no 0x prefix.\n * Secp256k1 public keys are compressed.\n *\n * @param pk - the VerificationMethod to be converted\n * @param convert - when this flag is set to true, Ed25519 keys are converted to their X25519 pairs\n * @returns the hex encoding of the public key along with the inferred key type\n *\n * @beta This API may change without a BREAKING CHANGE notice.\n */\nexport function extractPublicKeyHex(\n  pk: _ExtendedVerificationMethod,\n  convert: boolean = false,\n): {\n  publicKeyHex: string\n  keyType: string | undefined\n} {\n  let { keyBytes, keyType } = extractPublicKeyBytes(pk)\n  if (convert) {\n    if (keyType === 'Ed25519') {\n      keyBytes = convertEd25519PublicKeyToX25519(keyBytes)\n      keyType = 'X25519'\n    }\n  }\n  const publicKeyHex =\n    keyType === 'Secp256k1' ? compressSecp256k1PublicKeyHex(bytesToHex(keyBytes)) : bytesToHex(keyBytes)\n  return { publicKeyHex, keyType }\n}\n\n/**\n * Picks a signing key from a managed identifier.\n * If a keyRef is provided, it tries to find the key with that kid. Otherwise, it picks the first available\n * signing key based on known key types and algorithms.\n * @param identifier - the identifier to pick the signing key from\n * @param keyRef - optional key reference (kid) to select a specific key\n * @internal\n */\nexport function pickSigningKey(identifier: IIdentifier, keyRef?: string): IKey {\n  let key: IKey | undefined\n\n  if (!keyRef) {\n    key = identifier.keys.find(\n      (k) => k.type === 'Secp256k1' || k.type === 'Ed25519' || k.type === 'Secp256r1',\n    )\n    if (!key) throw Error('key_not_found: No signing key for ' + identifier.did)\n  } else {\n    key = identifier.keys.find((k) => k.kid === keyRef)\n    if (!key) throw Error('key_not_found: No signing key for ' + identifier.did + ' with kid ' + keyRef)\n  }\n\n  return key as IKey\n}\n\n/**\n * Imports a key if privateKeyHex is provided, otherwise creates a new key.\n *\n * @param args - The arguments for importing or creating the key.\n * @param context - The agent context containing the key manager.\n * @internal\n */\nexport async function importOrCreateKey<K extends TKeyType = TKeyType>(\n  args: {\n    kms: string\n    options: ImportOrCreateKeyOptions<K>\n  },\n  context: IAgentContext<IKeyManager>,\n) {\n  if (args.options.privateKeyHex) {\n    return context.agent.keyManagerImport({\n      ...args.options,\n      kms: args.kms,\n      privateKeyHex: args.options.privateKeyHex,\n    })\n  }\n  return context.agent.keyManagerCreate({\n    ...args.options,\n    kms: args.kms,\n  })\n}\n"
  },
  {
    "path": "packages/utils/src/encodings.ts",
    "content": "import { fromString, toString, concat as concatArrays } from 'uint8arrays'\nimport {\n  hexToBytes as hexToBytesRaw,\n  bytesToHex as bytesToHexRaw,\n  bytesToBase58,\n  base58ToBytes,\n  base64ToBytes,\n  bytesToBase64url,\n  bytesToMultibase,\n  multibaseToBytes,\n} from 'did-jwt'\n\nconst u8a = { toString, fromString, concatArrays }\n\nexport {\n  bytesToBase58,\n  base58ToBytes,\n  bytesToBase64url,\n  base64ToBytes,\n  multibaseToBytes,\n  bytesToMultibase\n}\n\n/**\n * Encodes a Uint8Array to a base64 string representation with padding.\n * @param b - the byte array to convert\n *\n * @public\n */\nexport function bytesToBase64(b: Uint8Array): string {\n  return u8a.toString(b, 'base64pad')\n}\n\n/**\n * Encodes the bytes of an input string to base64url\n * @param s - the original string\n *\n * @beta This API may change without a BREAKING CHANGE notice.\n */\nexport function encodeBase64url(s: string): string {\n  return bytesToBase64url(u8a.fromString(s))\n}\n\n/**\n * Decodes a base64url string to a utf8 string represented by the same bytes.\n * @param s - the base64url string to be decoded\n *\n * @beta This API may change without a BREAKING CHANGE notice.\n */\nexport function decodeBase64url(s: string): string {\n  return u8a.toString(base64ToBytes(s))\n}\n\n/**\n * Builds a string from a Uint8Array using the utf-8 encoding.\n * @param b - the array to be converted\n *\n * @public\n */\nexport function bytesToUtf8String(b: Uint8Array): string {\n  return u8a.toString(b, 'utf-8')\n}\n\n/**\n * Encodes a string to a Uint8Array using the utf-8 encoding.\n * @param s - the string to be encoded\n *\n * @public\n */\nexport function stringToUtf8Bytes(s: string): Uint8Array {\n  return u8a.fromString(s, 'utf-8')\n}\n\n/**\n * Stringifies a JSON object and encodes the bytes of the resulting string to a base64url representation.\n * @param payload - the object to be encoded\n *\n * @beta This API may change without a BREAKING CHANGE notice.\n */\nexport function encodeJoseBlob(payload: {}) {\n  return u8a.toString(u8a.fromString(JSON.stringify(payload), 'utf-8'), 'base64url')\n}\n\n/**\n * Decodes a base64url string representing stringified JSON to a JSON object.\n *\n * @param blob - The base64url encoded stringified JSON to be decoded\n *\n * @beta This API may change without a BREAKING CHANGE notice.\n */\nexport function decodeJoseBlob(blob: string) {\n  return JSON.parse(u8a.toString(u8a.fromString(blob, 'base64url'), 'utf-8'))\n}\n\n/**\n * Converts a hex string (with or without prefix) to a byte array (Uint8Array)\n *\n * @param hexString - The string representing the encoding\n * @returns the `Uint8Array` represented by the given string\n *\n * @throws `illegal_argument` error if the parameter is not a string\n *\n * @beta This API may change without a BREAKING CHANGE notice.\n */\nexport function hexToBytes(hexString: string): Uint8Array {\n  // @ts-ignore\n  if (hexString instanceof Uint8Array) {\n    return Uint8Array.from(hexString)\n  }\n  if (typeof hexString !== 'string') {\n    throw new Error('illegal_argument: a string must be provided for a hex-string to byte array conversion')\n  }\n  return hexToBytesRaw(hexString)\n}\n\n/**\n * Converts a Uint8Array input to a hex string\n *\n * @param byteArray - The array to be converted\n * @param prefix - If this is set to true, the resulting hex string will be prefixed with 0x\n *\n * @returns the hex encoding of the input byte array\n *\n * @throws `illegal_argument` error if the input is not a Uint8Array\n *\n * @beta This API may change without a BREAKING CHANGE notice.\n */\nexport function bytesToHex(byteArray: Uint8Array, prefix: boolean = false): string {\n  if (!(byteArray instanceof Uint8Array)) {\n    throw new Error('illegal_argument: only byte arrays can be converted to hex encoding')\n  }\n  const result = bytesToHexRaw(byteArray)\n  return prefix ? `0x${result}` : result\n}\n\n/**\n * Concatenates a bunch of arrays into one Uint8Array\n * @param arrays - the arrays to be concatenated\n * @param length - the maximum length of the resulting array\n *\n * @beta This API may change without a BREAKING CHANGE notice.\n */\nexport function concat(arrays: ArrayLike<number>[], length?: number): Uint8Array {\n  return u8a.concatArrays(arrays, length)\n}\n"
  },
  {
    "path": "packages/utils/src/index.ts",
    "content": "/**\n * Contains helper methods for Veramo plugins.\n *\n * @packageDocumentation\n */\n\nexport * from './types/utility-types.js'\nexport * from './credential-utils.js'\nexport * from './did-utils.js'\nexport * from './encodings.js'\nexport * from './type-utils.js'\nexport * from './jwk-did-utils.js'\n"
  },
  {
    "path": "packages/utils/src/jwk-did-utils.ts",
    "content": "import { JwkDidSupportedKeyTypes, KeyUse, SupportedKeyTypes } from './types/utility-types.js'\nimport type { VerificationMethod, JsonWebKey } from 'did-resolver'\nimport { secp256k1 } from '@noble/curves/secp256k1'\nimport { p256 } from '@noble/curves/p256'\nimport { bytesToBase64url, hexToBytes } from 'did-jwt'\nimport { extractPublicKeyHex } from './did-utils.js'\n\n/**\n * Determine the key use based on the type of key and an optional passed key use param.\n * @param keyType - The type of key (e.g., 'Ed25519', 'X25519', 'Secp256k1', 'Secp256r1').\n * @param passedKeyUse - Optional key use parameter ('sig' for signature, 'enc' for encryption).\n *\n * @returns The determined key use ('sig' or 'enc').\n * @internal\n */\nexport function getKeyUse(keyType: JwkDidSupportedKeyTypes, passedKeyUse?: KeyUse): KeyUse {\n  if (passedKeyUse) {\n    if (passedKeyUse !== 'sig' && passedKeyUse !== 'enc') {\n      throw new Error('illegal_argument: Key use must be sig or enc')\n    }\n    if (passedKeyUse === 'sig' && keyType === 'X25519') {\n      throw new Error('illegal_argument: X25519 keys cannot be used for signing')\n    }\n    if (passedKeyUse === 'enc' && keyType === 'Ed25519') {\n      throw new Error('illegal_argument: Ed25519 keys cannot be used for encryption')\n    }\n    return passedKeyUse\n  }\n  switch (keyType) {\n    case 'Secp256k1':\n    case 'Secp256r1':\n    case 'Ed25519':\n      return 'sig'\n    case 'X25519':\n      return 'enc'\n    default:\n      throw new Error('illegal_argument: Unknown key type')\n  }\n}\n\n/**\n * Check if the provided data is a valid JSON Web Key (JWK).\n * @param data - The data to be checked.\n *\n * @internal\n */\nexport function isJWK(data: unknown): data is JsonWebKey {\n  if (\n    typeof data === 'object' &&\n    data &&\n    'crv' in data &&\n    typeof data.crv === 'string' &&\n    'kty' in data &&\n    'x' in data &&\n    typeof data.x === 'string' &&\n    ((data.kty === 'EC' && 'y' in data && typeof data.y === 'string') ||\n      (data.kty === 'OKP' && !('y' in data)))\n  ) {\n    return true\n  }\n  return false\n}\n\n/**\n * Create a JSON Web Key (JWK) from the given public key material and key type.\n *\n * @param keyType - The type of key (e.g., 'Ed25519', 'X25519', 'Secp256k1', 'Secp256r1').\n * @param pubKey - The public key material as a hex string or Uint8Array.\n * @param passedKeyUse - Optional key use parameter ('sig' for signature, 'enc' for encryption).\n * @returns The generated JWK or undefined if the key type is not supported.\n *\n * @internal\n */\nexport function createJWK(\n  keyType: JwkDidSupportedKeyTypes,\n  pubKey: string | Uint8Array,\n  passedKeyUse?: KeyUse,\n): JsonWebKey | undefined {\n  try {\n    const keyUse = getKeyUse(keyType, passedKeyUse)\n    switch (keyType) {\n      case SupportedKeyTypes.Secp256k1: {\n        const point = secp256k1.ProjectivePoint.fromHex(pubKey).toAffine()\n\n        return {\n          alg: 'ES256K',\n          crv: 'secp256k1',\n          kty: 'EC',\n          ...(keyUse && { use: keyUse }),\n          // FIXME: test endianness of the toString(16) output\n          x: bytesToBase64url(hexToBytes(point.x.toString(16))),\n          y: bytesToBase64url(hexToBytes(point.y.toString(16))),\n        } as JsonWebKey\n      }\n      case SupportedKeyTypes.Secp256r1: {\n        const point = p256.ProjectivePoint.fromHex(pubKey).toAffine()\n\n        return {\n          alg: 'ES256',\n          crv: 'P-256',\n          kty: 'EC',\n          ...(keyUse && { use: keyUse }),\n          x: bytesToBase64url(hexToBytes(point.x.toString(16))),\n          y: bytesToBase64url(hexToBytes(point.y.toString(16))),\n        } as JsonWebKey\n      }\n      case SupportedKeyTypes.Ed25519:\n        return {\n          alg: 'EdDSA',\n          crv: 'Ed25519',\n          kty: 'OKP',\n          ...(keyUse && { use: keyUse }),\n          x: bytesToBase64url(typeof pubKey === 'string' ? hexToBytes(pubKey) : pubKey),\n        } as JsonWebKey\n      case SupportedKeyTypes.X25519:\n        return {\n          alg: 'ECDH-ES',\n          crv: 'X25519',\n          kty: 'OKP',\n          ...(keyUse && { use: keyUse }),\n          x: bytesToBase64url(typeof pubKey === 'string' ? hexToBytes(pubKey) : pubKey),\n        } as JsonWebKey\n      default:\n        throw new Error(`not_supported: Failed to create JWK using ${keyType}`)\n    }\n  } catch (error) {\n    throw error\n  }\n}\n\n/**\n * Generate a JSON Web Key (JWK) from a given verification method.\n *\n * @param keyType - The type of key (e.g., 'Ed25519', 'X25519', 'Secp256k1', 'Secp256r1').\n * @param key - The verification method containing the public key information.\n * @param keyUse - Optional key use parameter ('sig' for signature, 'enc' for encryption).\n * @returns The generated JWK.\n *\n * @internal\n */\nexport function generateJwkFromVerificationMethod(\n  keyType: JwkDidSupportedKeyTypes,\n  key: VerificationMethod,\n  keyUse?: KeyUse,\n) {\n  const { publicKeyHex } = extractPublicKeyHex(key)\n  return createJWK(keyType, publicKeyHex, keyUse)\n}\n"
  },
  {
    "path": "packages/utils/src/type-utils.ts",
    "content": "/**\n * Checks if a variable is defined and not null.\n * After this check, typescript sees the variable as defined.\n *\n * @param arg - The input to be verified\n *\n * @returns true if the input variable is defined.\n *\n * @beta This API may change without a BREAKING CHANGE notice.\n */\nexport function isDefined<T>(arg: T): arg is Exclude<T, null | undefined> {\n  return arg !== null && typeof arg !== 'undefined'\n}\n\n/**\n * Ensures that a given input is an array. If the input is a single item, it is converted to an array with a single\n * entry.\n *\n * @param arg - a variable that needs to be converted to array\n *\n * @beta This API may change without a BREAKING CHANGE notice.\n */\nexport function asArray<T>(arg?: T | T[] | any): (T | any)[] {\n  return isDefined(arg) ? (Array.isArray(arg) ? arg : [arg]) : []\n}\n\n/**\n * Checks if an object is iterable (can be used for `for..of`)\n * @param obj - the variable to be checked\n *\n * @beta This API may change without a BREAKING CHANGE notice.\n */\nexport function isIterable<T>(obj: any): obj is Iterable<T> {\n  return obj != null && typeof obj[Symbol.iterator] === 'function'\n}\n\n/**\n * Compute the intersection of two arrays\n * Elements are compared by reference so object types will appear as unique even if they contain the same data.\n *\n * @param a - first array\n * @param b - second array\n * @returns The intersection of the two arrays.\n *\n * @public\n */\nexport function intersect<T>(a: T[] | any, b: any[] | any): T[] {\n  const setB = new Set<T>(asArray(b));\n  return [...new Set(asArray(a))].filter(x => setB.has(x));\n}\n"
  },
  {
    "path": "packages/utils/src/types/utility-types.ts",
    "content": "import { IKey, IKeyManagerCreateArgs, KeyMetadata, MinimalImportableKey, TKeyType, } from '@veramo/core-types'\n\nimport { VerificationMethod } from 'did-resolver'\n\n/**\n * Broader definition of Verification method that includes the legacy publicKeyBase64\n * @internal\n */\nexport type _ExtendedVerificationMethod = VerificationMethod & { publicKeyBase64?: string }\n\n/**\n * Represents an {@link @veramo/core-types#IKey} that has been augmented with its corresponding\n * entry from a DID document.\n * `key.meta.verificationMethod` will contain the {@link did-resolver#VerificationMethod}\n * object from the {@link did-resolver#DIDDocument}\n * @internal\n */\nexport interface _ExtendedIKey extends IKey {\n  meta: KeyMetadata & {\n    verificationMethod: _NormalizedVerificationMethod\n  }\n}\n\n/**\n * Represents a {@link did-resolver#VerificationMethod} whose public key material\n * has been converted to `publicKeyHex`\n *\n * @internal\n */\nexport type _NormalizedVerificationMethod = Omit<\n  VerificationMethod,\n  'publicKeyBase58' | 'publicKeyBase64' | 'publicKeyJwk' | 'publicKeyMultibase'\n>\n\n/**\n * Accept a Type or a Promise of that Type.\n *\n * @internal\n */\nexport type OrPromise<T> = T | Promise<T>\n\n/**\n * A mapping of string to another type.\n * Both Map and Record are accepted.\n *\n * @beta This API may change without a BREAKING CHANGE notice.\n */\nexport type RecordLike<T> = Map<string, T> | Record<string, T>\n\n/**\n * Supported key types for JWK DID method\n * @internal\n */\nexport const SupportedKeyTypes = {\n  Secp256r1: 'Secp256r1',\n  Secp256k1: 'Secp256k1',\n  Ed25519: 'Ed25519',\n  X25519: 'X25519',\n} as const\n\n/**\n * Key usage types as per JWK spec\n * @see https://datatracker.ietf.org/doc/html/rfc7517#section-4.2\n * @internal\n */\nexport type KeyUse = 'sig' | 'enc'\n\n/**\n * Supported key types for JWK DID method\n * @internal\n */\nexport type JwkDidSupportedKeyTypes = keyof typeof SupportedKeyTypes\n\n/**\n * Options for importing or creating a key\n * @internal\n */\nexport type ImportOrCreateKeyOptions<TKey extends TKeyType = TKeyType> = Omit<\n  Partial<IKeyManagerCreateArgs & MinimalImportableKey>,\n  'kms'\n> & { type: TKey }\n\n/**\n * Basic options for creating an identifier\n * @internal\n */\nexport type CreateIdentifierBaseOptions<T extends TKeyType = TKeyType> = {\n  keyRef?: string\n  key?: ImportOrCreateKeyOptions<T>\n}\n"
  },
  {
    "path": "packages/utils/tsconfig.json",
    "content": "{\n  \"extends\": \"../tsconfig.settings.json\",\n  \"compilerOptions\": {\n    \"rootDir\": \"src\",\n    \"outDir\": \"build\",\n    \"declarationDir\": \"build\",\n    \"skipLibCheck\": true\n  },\n  \"references\": [{ \"path\": \"../core-types\" }]\n}\n"
  },
  {
    "path": "pnpm-workspace.yaml",
    "content": "packages:\n  - packages/*\n\nignoredBuiltDependencies:\n  - '@scarf/scarf'\n  - bufferutil\n  - core-js\n  - core-js-pure\n  - nx\n  - secp256k1\n  - utf-8-validate\n\nonlyBuiltDependencies:\n  - puppeteer\n  - sqlite3\n\nprefer-workspace-packages: true\n"
  },
  {
    "path": "renovate.json",
    "content": "{\n  \"extends\": [\n    \"config:base\",\n    \"group:allNonMajor\",\n    \"schedule:earlyMondays\",\n    \":preserveSemverRanges\"\n  ],\n  \"labels\": [\n    \"maintenance\"\n  ],\n  \"automerge\": true,\n  \"automergeType\": \"branch\",\n  \"packageRules\": [\n    {\n      \"groupName\": \"did-vc-libraries\",\n      \"matchPackagePatterns\": [\n        \"did\",\n        \"credential\"\n      ],\n      \"schedule\": [\n        \"before 5am every day\"\n      ],\n      \"matchUpdateTypes\": [\n        \"major\",\n        \"minor\",\n        \"patch\",\n        \"bump\",\n        \"digest\"\n      ],\n      \"commitMessagePrefix\": \"fix(deps):\"\n    },\n    {\n      \"groupName\": \"builders-and-testers\",\n      \"matchPackagePatterns\": [\n        \"jest\",\n        \"codecov\",\n        \"lint\",\n        \"jsdoc\",\n        \"bundle\",\n        \"prettier\",\n        \"webpack\",\n        \"typescript\",\n        \"@microsoft\"\n      ],\n      \"matchUpdateTypes\": [\n        \"major\",\n        \"minor\"\n      ]\n    },\n    {\n      \"groupName\": \"automation\",\n      \"matchPackagePatterns\": [\n        \"semantic\",\n        \"lerna\"\n      ],\n      \"matchUpdateTypes\": [\n        \"major\",\n        \"minor\"\n      ]\n    },\n    {\n      \"groupName\": \"devDeps\",\n      \"matchDepTypes\": [\n        \"devDependencies\"\n      ],\n      \"matchUpdateTypes\": [\n        \"major\",\n        \"minor\"\n      ]\n    }\n  ]\n}\n"
  },
  {
    "path": "scripts/docs-build.ts",
    "content": "import { readdir, createReadStream, writeFile } from 'fs-extra'\nimport { createInterface } from 'readline'\nimport { join, parse } from 'path'\nimport { exec } from 'child_process'\nimport * as fs from 'fs'\n\nconst DOCS_DIR = './docs/api'\n\nasync function main() {\n  await fs.promises.mkdir(DOCS_DIR, { recursive: true })\n\n  await new Promise((resolve, reject) =>\n    exec(`api-documenter markdown -i ./temp -o ${DOCS_DIR}`, (err, stdout, stderr) => {\n      console.log(stdout)\n      console.error(stderr)\n      if (err) {\n        reject(err)\n      } else {\n        resolve('')\n      }\n    }),\n  )\n\n  const docFiles = await readdir(DOCS_DIR)\n  for (const docFile of docFiles) {\n    try {\n      const { name: id, ext } = parse(docFile)\n      if (ext !== '.md') {\n        continue\n      }\n\n      const docPath = join(DOCS_DIR, docFile)\n      const input = createReadStream(docPath)\n      const output: string[] = []\n      const lines = createInterface({\n        input,\n        crlfDelay: Infinity,\n      })\n\n      let title = ''\n      lines.on('line', (line) => {\n        let skip = false\n        if (!title) {\n          const titleLine = line.match(/## (.*)/)\n          if (titleLine) {\n            title = titleLine[1]\n          }\n        }\n        const indexHomeLink = line.match(/\\[Home]\\(.\\/index\\.md\\)/)\n        const homeLink = line.match(/\\[Home]\\(.\\/index\\.md\\) &gt; (.*)/)\n        if (homeLink) {\n          line = line.replace('Home', 'Packages')\n        }\n\n        if (indexHomeLink) {\n          // Skip the breadcrumb for the toplevel index file.\n          if (id === 'index') {\n            skip = true\n          }\n\n          skip = true\n        }\n\n        // See issue #4. api-documenter expects \\| to escape table\n        // column delimiters, but docusaurus uses a markdown processor\n        // that doesn't support this. Replace with an escape sequence\n        // that renders |.\n        if (line.startsWith('|')) {\n          line = line.replace(/\\\\\\|/g, '&#124;')\n        }\n\n        // MDX cries when you put commects in there :(\n        line = replaceAll(line, '<!-- -->', '')\n\n        if (id === 'core') {\n          line = line.replace('core package', 'Veramo Core')\n        }\n\n        if (!skip) {\n          output.push(line)\n        }\n      })\n\n      await new Promise((resolve) => lines.once('close', resolve))\n      input.close()\n\n      const header = ['---', `id: ${id}`, `title: ${title}`, `hide_title: true`, '---']\n      let outputString = header.concat(output).join('\\n')\n\n      outputString = outputString.replace(/<a\\nhref=/g, '<a href=')\n\n      await writeFile(docPath, outputString)\n    } catch (err) {\n      console.error(`Could not process ${docFile}: ${err}`)\n    }\n  }\n}\n\nfunction escapeRegExp(string: string) {\n  return string.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&') // $& means the whole matched string\n}\n\nfunction replaceAll(str: string, find: string, replace: string) {\n  return str.replace(new RegExp(escapeRegExp(find), 'g'), replace)\n}\n\nmain()\n"
  },
  {
    "path": "scripts/docs-copy.ts",
    "content": "import * as path from 'path'\nimport { resolve } from 'path'\nimport { existsSync, readdirSync, copyFileSync, mkdirSync, unlinkSync } from 'fs'\n\nconst outputFolder = './temp'\nconst { documentPackages } = require('../docsconfig.json')\n\nif (!existsSync(resolve(outputFolder))) {\n  console.log('Creating', outputFolder)\n  mkdirSync(resolve(outputFolder))\n} else {\n  console.log('Removing files in', outputFolder)\n  readdirSync(resolve(outputFolder)).forEach((file) => {\n    unlinkSync(resolve(outputFolder, file))\n  })\n}\n\nfor (const packageName of documentPackages) {\n  const apiDocsPath: string = path.join(__dirname, `../packages/${packageName}/api`)\n\n  readdirSync(apiDocsPath).forEach((file) => {\n    console.log('Copying', resolve(outputFolder, file))\n    copyFileSync(resolve(apiDocsPath, file), resolve(outputFolder, file))\n  })\n}\n"
  },
  {
    "path": "scripts/prepare-integration-tests.ts",
    "content": "import { resolve } from 'path'\nimport { copyFileSync, existsSync, mkdirSync, readdirSync, readFileSync, unlinkSync, writeFileSync } from 'fs'\nimport * as TJS from 'ts-json-schema-generator'\nimport { DocFencedCode } from '@microsoft/tsdoc'\nimport {\n  ApiMethodSignature,\n  ApiModel,\n  ApiParameterListMixin,\n  ApiReturnTypeMixin,\n} from '@microsoft/api-extractor-model'\n\nconst outputFolder = './temp'\nconst inputFolders = [\n  'packages/core/api/',\n  'packages/core-types/api/',\n  'packages/credential-w3c/api/',\n  'packages/selective-disclosure/api/',\n  'packages/did-comm/api/',\n  'packages/data-store/api/',\n]\n\nif (!existsSync(resolve(outputFolder))) {\n  console.log('Creating', outputFolder)\n  mkdirSync(resolve(outputFolder))\n} else {\n  console.log('Removing files in', outputFolder)\n  readdirSync(resolve(outputFolder)).forEach((file) => {\n    unlinkSync(resolve(outputFolder, file))\n  })\n}\n\nfor (const inputFolder of inputFolders) {\n  readdirSync(resolve(inputFolder)).forEach((file) => {\n    console.log('Copying', resolve(outputFolder, file))\n    copyFileSync(resolve(inputFolder, file), resolve(outputFolder, file))\n  })\n}\n\nconst apiJsonFilePath = './temp/<unscopedPackageName>.api.json'\n\nconst agentPlugins: Record<string, Array<string>> = {\n  'core': [\n    'createAgent'\n  ],\n  'core-types': [\n    'IResolver',\n    'IDIDManager',\n    'IMessageHandler',\n    'IDataStore',\n    'IDataStoreORM',\n    'IKeyManager',\n    'ICredentialIssuer',\n    'ICredentialVerifier',\n    'ICredentialPlugin',\n  ],\n  'selective-disclosure': ['ISelectiveDisclosure'],\n  'did-comm': ['IDIDComm'],\n}\n\ninterface RestMethod {\n  packageName: string\n  pluginInterfaceName: string\n  operationId: string\n  description?: string\n  example?: DocFencedCode\n  parameters?: string\n  response: string\n}\n\nlet allMethods: Array<RestMethod> = []\n\nfor (const packageName of Object.keys(agentPlugins)) {\n  const generator = TJS.createGenerator({\n    path: resolve('packages/' + packageName + '/src/index.ts'),\n    encodeRefs: false,\n    // TODO: https://github.com/transmute-industries/vc.js/issues/60\n    skipTypeCheck: true,\n  })\n\n  const apiModel: ApiModel = new ApiModel()\n  const apiPackage = apiModel.loadPackage(apiJsonFilePath.replace('<unscopedPackageName>', packageName))\n\n  const entry = apiPackage.entryPoints[0]\n\n  for (const pluginInterfaceName of agentPlugins[packageName]) {\n    console.log(packageName, pluginInterfaceName)\n    const pluginInterface = entry.findMembersByName(pluginInterfaceName)[0]\n\n    // Collecting method information\n    const methods: RestMethod[] = []\n    for (const member of pluginInterface.members) {\n      const method: Partial<RestMethod> = {}\n      method.packageName = packageName\n      method.pluginInterfaceName = pluginInterfaceName\n      method.operationId = member.displayName\n      // console.log(member)\n      method.parameters = (member as ApiParameterListMixin).parameters[0]?.parameterTypeExcerpt?.text\n      method.response = (member as ApiReturnTypeMixin).returnTypeExcerpt.text\n        .replace('Promise<', '')\n        .replace('>', '')\n\n      const methodSignature = member as ApiMethodSignature\n      method.description = methodSignature.tsdocComment?.summarySection\n        ?.getChildNodes()[0]\n        // @ts-ignore\n        ?.getChildNodes()[0]?.text\n\n      method.example =\n        methodSignature.tsdocComment?.customBlocks[0]?.content?.getChildNodes()[1] as unknown as DocFencedCode\n\n      method.description = method.description || ''\n\n      methods.push(method as RestMethod)\n    }\n\n    allMethods = allMethods.concat(methods)\n  }\n}\n\nlet tests = ''\nfor (const method of allMethods) {\n  if (method.example) {\n    tests += `\\nit('${method.packageName}-${method.pluginInterfaceName}-${method.operationId} example', async () => {\\n${method.example.code}\\n})\\n`\n  }\n}\ntests = `DO NOT EDIT MANUALLY START\\n ${tests}\\n//DO NOT EDIT MANUALLY END`\n\nconst testsFile = '__tests__/shared/documentationExamples.ts'\nconst source = readFileSync(testsFile).toString()\nconst newSource = source.replace(/DO NOT EDIT MANUALLY START(.+?)DO NOT EDIT MANUALLY END/s, tests)\nwriteFileSync(testsFile, newSource)\n"
  },
  {
    "path": "tsconfig.scripts.json",
    "content": "{\n  \"extends\": \"./packages/tsconfig.settings.json\",\n  \"compilerOptions\": {\n    \"baseUrl\": \".\",\n    \"outDir\": \"./build\",\n    \"rootDir\": \".\",\n    \"types\": [\"node\", \"jest\"]\n  },\n  \"include\": [\n    \"scripts/**/*\",\n    \"packages/**/*\"\n  ],\n  \"exclude\": [\n    \"node_modules\",\n    \"build\",\n    \"**/__tests__/**/*\",\n    \"**/build/**/*\"\n  ],\n  \"ts-node\": {\n    \"compilerOptions\": {\n      \"module\": \"CommonJS\",\n      \"target\": \"ES2020\",\n      \"moduleResolution\": \"node\",\n      \"types\": [\"node\"]\n    }\n  }\n}\n"
  }
]